Mental Ray Texturing
Many people keep asking if anyone got the custom mentalray bump nodes to work. Because many people think custom mentalray bump nodes are waaay better than the maya's default bump2d nodes. Let's have a look.
First off we need to get the mr bump shading-network actually working. Here's a hypershade snapshot of the raw bump-vector generating part:
The connections are as follows:
Whereas the mentalray Texture is being automatically created and connected when clicking on the checker button next to 'tex' in the mib_bump_map node.
Ok, but what should we do now with the created network? There are several things we could do:
We could plug it into the bump input of one of Francesca Luce's bumpCombiner, or we could plug it into the NormalCamera (Bump Mapping slot) of any standard Maya shader - basically the mib_bump_map has the same output as a bump2d:
Did I say the same? Well, it's not quite the same as you can see. What did happen? I left all settings at default - that was a failure. It's the 'step' vector we need to adjust, just to give you a hint. But why, and more important: how? Here's an explanation, thanks Gonzalo GarramuÃ±o:
If you read through the above link, you know we have to set our step value (the texture is tiled 1-1) to 1/2560, because it has a resolution of 2560*2560 pixels. If we had 2-2 tiles we would have to set it to 1/(2560*2), the formula is
step = 1/(textureResolution*tiles)
Looks better, doesnt it? Because 1/2560 is quite a small number (0.000390625) I decided to write an expression to not lose any precision:
[code] mib_bump_map1.stepX = mib_bump_map1.stepY = mib_bump_map1.stepZ = 0.000390625 [/code]
You probably ask yourself, how differently than a bump2d this shaders actually work. Let's compare, here's a bump2d with default settings, I only set the Bump Depth to -0.010 because mr custom bump shaders bump in negative direction, and their factor acts different. Factor 1 is Bump Depth -0.010 in this example:
Bump Filter is 1, texture filter is Quadratic with Filter 1 - all default. Quite dull compared to a standard bump you might think. Let's remove all the filters; but [i]dont[/i] set the Texture Filter to off, leave it at Mipmap - I only set the Filter under Effects to 0, as well as the Bump Filter of the bump2d node:
Hey, it's almost the same! Maybe we can assimilate it even more? We can, because apparently the step value of our mr custom bump needs to be 10 times lower and it's factor 10 times higher to compensate the differences - this is the adjusted mr custom bump:
Except a few pixels, the result is exactly the same as with a bump2d. Exciting, isnt it?!
Well... You probably ask yourself what the other available bump node, the mib_pass through_bump_map is good for. It has the same effect, it is only connected differently to the shading network. Here's a snapshot of what I mean:
Ugh. What's that blendColors node doin there? Well, I guess the mentalray developers simply had a good idea to pass a bump vector through a shading network if you don't have a Bump Mapping slot around, as with all mr custom shaders like the Cook-Torrance or DGS for example. The blendColors color1 is the mib_passthrough_bump_map, and color2 is the texture (a plain gray color in our case). It's Blender value is very low at 0.001, just as low to be non-zero. It's a trick of course. The result is the very same though (with adjusted step settings etc.):
So. What are the reasons to use custom mr bump shaders? If you ask me, I dont see any. The bump2d has, with all filters off and mipmap activated, the exact same output. As long as you dont use mr custom shaders [i]plus[/i] as long as you dont have no bumpCombiner or bump passthrough around (*), it's wasted time to build this networks (probably not in [i]every[/i] case of course).
In reverse, the bump2d has some big bonus like the bumpFilter and the ability to use texture filters (quadratic etc.) to reduce texture artifacts, and all the other benefits that come with the regular maya file and texture nodes.
NB: This is a rough comparison between the two methods to get mentalray bumping. It may, of course, not apply to [i]all[/i] possible situations. And do try this at home!
You could set your surface's normal (bump it) by passing any shader through a plain standard maya lambert's incandescence, set the lambert's color to black, it's diffuse value to 0.0, and plug a regular bump2d into the Bump Mapping slot as you would do as usual. The shader in the incandescence slot inherits the altered surface normal from it's parent, the maya lambert.