mentalray bump exploited


Or: mentalray bump, demystified

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:

mib_texture_vector2.outValue> mib_texture_remap2.input

mib_bump_basis2.u> mib_bump_map1.u

mib_bump_basis2.v> mib_bump_map1.v

mib_texture_remap2.outValue> mib_bump_map1.coord

mentalrayTexture2.message> mib_bump_map1.tex

Whereas the mentalrayTexture is being automagically 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:

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 25602560 pixels. If we had 2-2 tiles we would have to set it to 1/(25602), the formula is

step = 1/(textureResolution*tiles)

Let’s see:

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:

mib_bump_map1.stepX = mib_bump_map1.stepY = mib_bump_map1.stepZ = 0.000390625

You probably ask yourself, how differntly 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 dont 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_passthrough_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 dont 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 lambert. It’s Blender value is very low at 0.001, just as low to be non-zero, and the blendColors node itself goes into the mentalray material slot of your shading group. 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 plus as long as you dont have no bumpCombiner around, it’s wasted time to build this networks (not in every case of course).

In reverse, the bump2d has some big bonus like the Bump Filter and the ability to use texture filters (quadratic etc.) to reduce texture artifacts.

NB: This is a rough comparison between the two methods to get mentalray bumping. It may, of course, not apply to all possible situations. And do try this at home!


Great :slight_smile:

is there any difrent inn render speed between the two?


Custom mr bumps rendered a bit faster in my very simple test. Dont know about complex scenes though. But naturally custom nodes should be faster - it’s sometimes a trade between ease of workflow and rendering times.


shaders from the public libraries (base, physics, contour) were made just as examples for shader writers, to use as a reference. Also, these shaders accomplish very minimal tasks, so you need bunch of nodes to have the “equivalent” maya node. I remember I compared graphically, in one of my old masterclasses (must put those docs online actually), a maya blinn with all its features (reflect, refract…) with a ‘base’ blinn network matching the same features and a phenomenized version of the previous aka 1 image s better than 50 words.

Anyway, for user which have access to mayabase, the maya 2d/3d bumps are excellent and there is no reason that comes up to my mind to use mib_* shading networks for bump.

other shader such as mib_amb_occlusion are insted very useful for production work.
we will extend the mib_* library with the time, so expect other cool shaders in the future.



Thanks for confirming me in that question, Paolo. I’d love to see the masterclasses you mentioned being online! :slight_smile:


I can only see one reason to use that bump shading network, to use it with DGS, for me is the only one.



yeah, that can be a reason, but again if you have access to mayabase you can obtain blurred reflections/refractions with any specular material shader (there are attributes for that in the mental ray tab of the AE: reflection/refraction blur and relative oversampling).
I have no idea in other OEMs.



Hi floze et all,

   Is it possible to plug this MR bump into bump combiner?*

The reason I ask is that with really large .map files (converted with the –r tag) the normal maya file/2dplacement doesn’t work – the image is all skewed and broken.

   Using MR texture/remap/vector cures this problem.

Using the MR version of a bump combiner will mean I can use massive .map file for bump and use the region feature of the .map format.

The problem (I have) with the maya file setup is that the .map are reported as being to big and the preview take ages to load (MR textures don’t have a preview ;).

   I want to change all material and set ups to MR and eventually remove all Maya setups.

   Big shout to floze for doing all this research, it really it great to read and very inspiring :D




wait, do you mean that for smaller file it works fine? - r rearranges pixels in tiles rather than scanlines.
can you quantify “large”? Like 20K? Do you have any conversion problem when running imf_copy? Which version of mr are you using?


Apologies, I meant [i]I[/i] am using really large .map files, I didn’t mean to imply that is worked for small images!

  Moving on, will the MR bump a la floze work with this and the bumpcombiner without issues?


I don’t know, have you tried?

Anyway, if you have enough memory you can use non-tiled textures (imf_copy -p), which are always memory mapped but non-tiled (scanline) and faster to access than tiled ones (which on the other hand have better cache efficiency).


    Yep, works a treat.
    I’m trying to keep the memory foot print down so MR doesn’t get too upset (also scanline turned off!).

Hmm, does that make any difference?



what do you mean scaline turned off? that you are rendering also 1st generation rays
(eye rays) with the raytracer?


 Scanline in Render Globals, set to off

   I now have a feeling I’m being dense?

Have I got this all wrong?



relying on raytracing eye rays will slow down rendering
except if you have a very good motivation…
only one I can think of is in some scenes where very small task sizes are required (which is useful if you are doing massive parallell rendering), in that case the overhead of initializing the scanline algorithm could be spared…

I have no idea what you are rendering though…



No real reason to use –r then?

   Or can I use –r and leave scanline on?

   I thought you’d have to turn it off if using regions in .maps?

   I’m full of questions me :)



we are going offtopic…

-p: memory mapped textures which are loaded line by line aka ‘scanline’ (pro: loads faster)
-r: memory mapped textures which are loaded tile by tile (pro: better caching, con: loads slower)

this ad nothing to do with using rendering algorithms scanline and raytracing on or off… all clear?



This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.