Stuff you never even knew about mental ray 3.5

One of the coolest features of mental ray 3.5 is the way the final gathering feature works.

It may deceptively seem to work the same way as before, but it doesn't. One really important point is that each FG point stored isn't just a color, it's a whole set of colors - with directional information (for the tech heads: think spherical harmonics).

What does this mean? It means a lot for bump-mapping!!

In earlier version of mental ray, bumps basically had to be resolved by the adaptivity of the final gathering, causing an extreme density of final gather points due to the variation in the bumps.

But in mr 3.5 it works completely differently; the final gathering is actually calculated on the un-bumped normal vector, and the result is stored including directional data... and then at render time, data is looked up into this directional data.

The result is:

  • Much lower density of final gather points needed, the existance of bump maps does not increase the density!
  • Very high quality of directional effects of indirect light on the bump maps, at levels previously impossible.

This makes bumpy surfaces render faster, and resolve in much greater detail, causing details in the bump maps in "dark" areas, i.e. areas only lit by bounce lights or other forms of indirect light such as photons.

The catch:

Some earlier shaders out in the wild intentionally tried to work around this problem. These workaround can potentially interfere with the "correctness" of the new method.

The good stuff:

The cool stuff is that due to this new FG storage format, it is possible to do directional lookups into the FG map. This is how the "Highlights Only" mode in the Arch&Design material works, which can give a very good "visual simulation" of extremely glossy reflections, without actually shooting a ton of rays and taking almost no extra render time!



RSS Feed added.....

An RSS feed has been added so you can plug this blog in your RSS catcher thingamabob. Enjoy. Or not. ;)



Public shader sources has been updated

The public shader source code available at the mental images FTP site has been updated as of today to the level of the shaders as-shipped with mental ray 3.5 - enjoy.

The public shader sources are available at



Who took my "temporal contrast"?

I've received some questions about the "temporal contrast" option and who stole it from the 3ds max 9 UI.

Here's the deal:

In mental ray 2.1 and earlier, it actually used a temporal contrast, which worked very similar to the overal adaptive sampling contrast. However, this actually yeilds suboptimal motion blur.

So mental ray 3.0 or newer actually takes a fixed number of temporal samples for each spatial sample.

However, the parameter, as exposed in the .mi file format still is "temporal contrast" and is an RGBA color. However, this color isn't actually interpreted neither as a color nor as a contrast at all!

What happens is that a number of temporal samples is calculated from this color as such:

samples = 1.o / min(temporal_contrast)

So this means a "temporal contrast" of 0.2 0.2 0.2 0.2 really only means "5 temporal samples". Nothing else. There is no "contrast" comparisions being done between temporal samples at all!

So... since mental ray does this internally, this was propagated to the max 9 UI as a temporal samples spinner, rather than the old "temporal contrast".

It most likely will be changed in the .mi file format in a future version to a "time samples" instead of "time contrast" keyword.

Hope this is clear as mud... ;)



DOF and Sun & Sky issue

There is a known issue when using the Sun & Sky in max 9 together with depth of field. Objects turn out like odd wireframe-looking... things.

The cause for this is actually the long list of lens shaders that gets added by the "Aerial Pespective" feature built into Sun & Sky.

For now there is a workaround.

Proceed as follows:

  1. Create a Sun & Sky system as normal, by creating a daylight system and choosing "mr Sun" and "mr Sky", affirming the pop up question of "do you want to ad a 'mr Physical Sky' environment" with a resounding YES.
  2. Then, change the skylight option from "mr Sky" to "Skylight"
  3. Change the Skylights option to "Use Scene Environment"
Now a nearly identical rendering (but without any Aerial Perspective) will result, since the standard mad Skylight will pick up the "mr Physical Sky" environment shader for the lighting. The net result is nearly identical to the normal rendering using a "mr Sky" and the depth of field will now work.

The difference is that now one needs to do any "tweaks" to the sky strictly in the "mr Physical Sky" shader, and to do this, one needs to "drag-and-drop" it (as an "instance") from the "Environment" dialog into a free slot of the material editor, then tweak away.




A new site has opened, www.mymentalray.com

It is not an "official" site in any way, but run by enthusiasts, but indeed contains a lot of information or links to "the best" info out there. (Which means lots of links to lamrug.org ;) )



mental ray sun&sky and rapid motion blur

There is an issue in the initially released version of max 9 (the one with mental ray which makes the sun&sky system not behave with rapid scanline motion blur.

The workaround is to turn of the "Aerial perspective". Go to the "mr Sky" light and uncheck the "Aerial Perspective", and you will find the rapid scanline motion blur working fine.



Swedish Max/Maya launch

Tomorrow (Nov 7:th 2006) will be the launch event for 3ds max 9 and Maya 8 in Sweden. It'll be in Gothemburg (Chalmers) and I'll be there speaking about mental ray and...stuff.

So anyone around wanting to say hi, well, I'm the blonde swedish guy. Uhm. Which may not be so easy to find among all the other blond swedes. Well, I'm the only one that is mental.



Welcome to this new blog

This blog is a place for me to store "frequently asked questions" about mental ray and shaders; instead of having to reply to it multiple times, I create a blog post.....

...well that's the idea, anyway.