Famous mental ray myths...

Rusty Teapots Unite

There is a lot of misinformation out in the world, misunderstandings that gets repeated and turn into "truths" over time.

I ran into a couple of those at EUE and frankly, I had no idea they were so widespread. So from now on, any time I run into these I'm gonna make a post about it.... here's a collection:

You should always use the mental ray shaders, not the built in max/maya/xsi/whatever...

This myth is both true and false at the same time.

The reality is, there are a ton of "mental ray" shaders, from the very old and very primitive "base" shader library (danger) to very new and very modern "architectural" and "production" shader libraries.

So - yes - if there is a brand new shader that comes directly from mental images that does X, and your embedded application may have some other shader that claims to do X as well, then most likely picking the "mental ray" one is better.

But if there is some ancient shader, from the mists of pre-cambrium, that has a "mental ray" variant, and your application has something that looks as nice, is better integrated, etc.... use that in your application

As an example: The base shader library contains a set of shaders like mib_illum_phong, mib_illum_blinn etc.... never use those! Those are the simplest, most primitive shaders. Avoid!

Much rather than anything "mib_illum_blinn" use the Maya "Blinn" or the 3ds max "Standard" material in "Blinn" mode, or whatever. But even better, use the mental ray mia_material (Arch&Design in max). This is new, mental ray optimized, and we try to integrate it as much as possible into each app.

The old rusty mib_illum_* shaders will have all sorts of issues, interface poorly with the product (no render elements/channel support, no support for diffuse/specular switches on the lights, etc.), handle indirect illumination incorrectly, and so on.

Your apps own integrated materials are mental ray translations of the applications software-renderers material to the "best possible" mental ray counterpart. Your apps own materials are the one most guaranteed to interface with the app's own "features", such as specual switches on light, render channels, whatnot.

And then the mia_material(_x) ("Arch&Design") which we try to make as a "top of the line" thing, and we really try to integrate with as many of the applications own feature as humanly possible.

If it doesn't say "mental ray" dont use it

Similar to above, people have gotten the idea that if a feature doesn't explicitly say "mental ray" or "mr" on it, it is directly unsuitable for use with mental ray.

While this may happen in some odd cases, most of the time, most application features are actually quite well integrated with mental ray.

One of the most scary thing I heard at EUE was someone who asked "You can't use the 3ds max photometric lights with mental ray, right?".

I almost fell off my chair. If you want to render anything even remotely physically correct you should always use the photometric lights. But this guy had been misled by some other lights in the non-photometric category having "mr" in the name.

The reality is that those lights (The "mr Omni" and "mr Spot") are simply lights supporting things that do not exist at all in the other 3ds max lights.

All 3ds max lights are "mental ray lights" when you render with mental ray. Those two simply expose things that only mental ray can do. This does not mean the others "don't work" with mental ray, or that others are "unsuitable" for mental ray.

(Of course, in the case of max lights, what actually is unsupported in mental ray is the 3ds max "trick" to do "area shadows" on any given light, you instead have to make it a real area light. Hence the "extra" light types, although one could argue that perhaps this distinction could have been hidden away from the user in some other way. Alas, water under the bridge....)

So: Please use the photometric lights!

Never use Shadow Maps

This "myth" is the truest of them all. Yes, most of the time you really shouldn't use shadow maps with mental ray (you should use area lights). As a matter of fact I think at least 3ds max ships with shadow maps globally disabled in the mental ray render globals.... this is simply to get around the fact that max lights actually default to shadow maps.

However, there is a couple of cases where you should use shadow maps. And not just any shadow maps - the mental ray detail shadow maps: Hair. Fur.

Yes - any time you want to render hair, that's the time you whip out the rasterizer and detail shadow maps. Not for an architectural interior, but for your fuzzy sidekick in your space drama!

mental ray is slow

Actually mental ray is very fast, if you do things correctly. If you don't do things correctly it - as well as any other renderer - can be very slow.

First of all - suboptimal defaults. If an application ships with a default final gather setting of 500 rays, a way too low spatial oversampling contrast of 0.002 (which makes very little sense), and the default number of motion blur samples set to "19" when "5" is quite enough, of course it will appear slow.

Fixing all those settings can speed it up an order of magnitude.

But yes, I always get this "PRMan displaces faster" stuff. Of course it does.... until you actually trace a ray.

You see, PRMan lives in mindset where raytracing is so slow that you avoid it like the plague. So it uses a completely different method to render things (the REYES engine) which micro-dices things and spits the micro-polygons into subpixels then into pixels. The very nature of this algorithm gives you displacement practically "for free". Coz they work one micro-poly at the time, and never have to keep a single thing in memory.

A raytracer on the other hand (I alost said "a real renderer" *grin*) would out of necessity need to keep all those poly- and micro-polys in memory to have to intersect rays against. So not only do they need to be created, stored in memory, an accelleration structure must be built to speed up the ray intersections. All taking - yes - more time and complexity than dinking away one micropoly at the time and throwing the results over your shoulder when you are done.

The thing is that in PRMan, if you try to shoot a ray, it too has to do all those things. So the minute you actually shoot a single ray in some .sl shader, *grind*, PRMan has to do what mental ray always does.... and the comparasion suddenly isn't so much in favour of PRMan any more.

Since I am of the opinion that there exists no interesting shading that doesn't involve raytracing, I find the fact that "yes, PRMan can be faster with raytracing off" a completely academic opinion of no practical value (but of course, all speed-tests are run like that, naturally.... *sigh*). I am wholly uninterested in oldschool dinky-toys rendering in a fisher-price universe of reflection maps and reflective occlusion (a trick invented solely to "avoid tracing rays". And of course they build their reflective occlusion maps with mental ray... LOL)

Alas, that's all I have time for today.... more later.



Deke Kincaid said...

>> You see, PRMan lives in mindset where raytracing is so slow that you avoid it like the plague.

This should be added to another list called "Famous Prman myths..." :P This hasn't been true for a couple years now.

Master Zap said...

Lets rephrase this to say that the first people to use "raytracing" and "slow" in the same sentence is PRMan users.

The subject wasn't about the truth or untruth of the statement, but the existance of the mindset.


Jude said...

Well it was true 2 years ago but now prman is well more advanced in new ways to mimic raytracing with faster and more stable sens for production movie scene. Raytracing are slow and problematic with high memory issue. All the trick you spoke about are good and fast for animation in non hero object or motion blured, very handy. Prman had always been a trick renderer and will always , simply because tricks are fast for unusefull raytracing job. I love mental ray for archicad rendering, but for animation I prefer to use prman, and for many reason, motion blur displacement, scattering depth of field, shading language, hair and fur and openexr compositing, Many characters are a lot faster and better in quality than with mental ray, hairs are photorealistic and fast, it only depend on your shader level, and it's only one example to me. what a pain in the ass to setup a final gather GI with moving objects with mental, and how easy it is to add multiple bounce of GI with point based inside prman free of flicking and 10 to 20 time faster than mental.
don't forget some of old mental ray develloper are working on renderman, but renderman is a hybrid renderer using reyes raytrace and GPU technics to improve the best possible the rendering time for animation. mental is a pure raytracer

I don't recommand PRman for still image, mental is really good for still and easier in many ways. but animation is another world for PRman. you should try the last pro server zap you could be impressed by some of the new ways to render photons or new shading language. pixar created lot of good approcimation technology trough the years like deep shadow or point cloud brickmap geometry, all those tricks are very handy in production environment.

I love the speed and quality of approximation compare to the accuracy but slow of the raytracing, time is money for me.


Ino said...

But Zap... for exterior daylight setup, shouldn't I get more realistic results using the mrSun and mrSky than using max's photometric IES sun and IES sky lights???

I'd really like your opinion on this, since max's daylight lights make shadows a bit too dark....

Master Zap said...

Yes of course! mr Sun and mr Sky.

Like I said, basically, go by the age of the shader when you use it. The IES sun/sky are pretty much useless.


Ino said...

great zap!!! thx, my f5 pressing really payed off

David said...

My, where to start. . .

Oddly enough no one seems to remember that raytracing is actually MORE efficient than scanline. Scanline has a linear performance while raytracing is logarithmic. In fact, there's the argument that as images become more complex and systems more powerful, it will completely replace scanline. And while I like PRman for some things (Particles and AOVs) in practical use I have never had it outperform mental ray, when setup correctly.

The problem is no one runs a fair comparison. No one compares the Rasterizer to PRman. For a lot of tasks PRman is still not built for multithreading on a lot of CPUs. (I believe shading operations only and 4 threads) As such, when I setup a scene with detail shadow maps, mapped reflections, and motion blur I can generally outperform PRman by a factor of almost 2. (This is a machine with dual 8 cores running mental ray 3.5 and Rman for Maya 2.0)

No one seems to run that comparison. Honestly. . .no one runs a comparison between software at all where there's an attempt to match the features. That applies to everything.

As for who invented the wheel for a lot of the methods, the prize doesn't really go to Pixar or mental images. While the features themselves are unique to the software, chances are, it was tried at a university first.

I use whichever tool is appropriate at the time, be it PRman or mental ray and as such I can say that I find no flaw with mental ray that has been purported as true to be actually true.

It's a shame that without actual experience with these tools many will believe what they hear. It's a bit like asking the wolf about the missing chickens.

"Education: that which reveals to the wise, and conceals from the stupid, the vast limits of their knowledge." -- Mark Twain

Sylvain Berger said...

Thanks Zap for these great comments and tips.

I totally agree with that sentense: "I am wholly uninterested in oldschool dinky-toys rendering in a fisher-price universe of reflection maps and reflective occlusion"

And yes maybe Prman got some advance on raytracing in a last few years... but seting up a scene to raytrace is a fraking pain the ass compared to mental ray. At least is was in Renderman 11 for me.

Yes cheating raytracing will always be faster in rendering time... but never in setup time...never. I don't believe anyone who can say it is faster... setting a boolean value to TRUE in Mr to get raytrace shadow or setting up some insane array of shadow maps shader in prman is not the same.

Rockin Horea said...


I tried searching the net but could not find an answer> what is the best value for the oversampeling contrast?


Unknown said...
This comment has been removed by a blog administrator.
Unknown said...

MentalRay software engineers will always tell you that they can do this or that better or faster. Yet in the REAL WORLD of film production they are the ones left alone at 2am crying over broken features and slow renders whilst PRman users are at home with their families knowing that their renders are in the bag.

Unknown said...

Sure MR is a great renderer, its such a shame its such a mess of an implementation within Maya with the need to rely on some guy in tim buck two making shaders to actually get things working and then having to rely on that person to update shader because they wont work in the next version of Maya.

Unknown said...

You seem to know quite a bit about Mental Ray. Is it true that if your object is far away from the origin, (the center of the grid), it will render slower? I have been told this twice and didn't believe it at first but now I'm starting to think it's possible. (Though I haven't tested it yet).

Anonymous said...

Why we have to spend so many hours to setup MentalRay to give us Photorealistic results?

Do you setup reality when you capture an image by camera?! .. you just setup stage, light
and camera parameters, then hit the capture button, thats it !!

That is why I like Maxwell Render, Vray, FinalRender and Modo's internal render .. You just turn on GI, AA and set few other things, and result is photorealistic image !!

Sorry, But I can't understand philosophy behind massive render settings, while our goal is almost same .. we just want something to simulate physix and capture image .. just like Maxwell!!

Anonymous said...

hello Zap, Thanks a lot for your tips, they are great, but i was wondering if you could give some tips on adding realism to the shaders, like finger prints on glass, or dirt a car.
Thanks you