new shaders shipped with Maya/Max 2008


I added a more advanced example.

The idea is if you have your textures (from this file) in the same directory as your scene, when you render you should get this:

(note the shadow of the pole leaning against the bike shed :wink: )

And when you render you get this:

However, those are both “in render” comped. What if you want to have all those nice lighting, reflections, etc, but you want to do the “real” comping in post?

Well, to do that you need to add a couple of tweaks.

First, you go into the mip_rayswitch_environment in your camera, and put “transparent black” into the background slot. Since Maya’s color swatches doesn’t have an alpha, you can connect the “mib_color_alpha” and turn it’s blend down to 0 to get the same result.

Secondly, in your mip_matteshadow, rather than using a mip_cameramap directly for the background color, we add another mip_rayswitch_environment. Again in it’s “background” slot we put in transparent black (i.e. mib_color_alpha), and in it’s “environment” slot, we put in the mip_cameramap we previously had stuck directly into mip_matteshadow.

The result is mip_matteshadow2b.mawhich renders like this:

…which has THIS alpha channel:

…which can be comped straight onto your background (interpret as premultiplied)!

Here is the .iff with alpha for anyone wanting to try it.



Thanks for the response Zap.

I’m hoping it works with the old ‘blur2d’ (although I really doubt it), because we work with after effects…and it will not look at motion vectors. I’ll also try the motion blur shader, it seems like a great idea, because we were using Reelsmart with mixed results, hence the ‘jbblur2d’ usage.

What image format does the motion vector have to be in? .iff like Maya Software?, or OpenEXR pehaps? I’m really happy we can now use displacements and not have render a different pass just for Motion Blur…I just hope we can integrate it into our pipeline.

Thanks again.:thumbsup:


Interesting; most people sing praises of “ReelSmart” moblur.

For the floating point formats, OpenEXR, yes. But unless you have Toxik, I don’t think most software expects the floating point format. In floating point mode “1” the floating point data really is the pixel displacement in X/Y, counted in pixels, which means it can include negative values.

For the default non_fp mode, it takes pixel motion, divides it by the “max_displace” parameter, and converts to a color… i.e. = ((pixel_motion.x / max_displace) / 2.0) + 0.5; = ((pixel_motion.y / max_displace) / 2.0) + 0.5;

I.e. red/green 0.5 is zero movement, red=0 means moving max_displace pixels to the left, red=1 means moving max_displace pixels to the right, etc…



Also, I think you may need to have motion blur on in mental ray, but shutter length should be 0 and time contrast should be 1 1 1 1… that way no actual extra time is spent doing actual motion blur during the render, but actual motion vectors get written.

Problem is that Maya8.5 and Maya2008 have a bug…
If you have a Shutter Close = 0, mayatomr disable motion blur at all and no any motion vectors.
I found solution:
- Shutter Open = 1
- Shutter Close = 1
- Custom Motion Offset = On
- Motion Back Offset = 1
it gets motion vectors and no motion blur itself (and motion vectors in right place)

Maybe I miss something and it’s possible to get motion vectors with shutter = 0?


Oh, actaually, for the longest time in Maya you would have to do it by setting shutter to 0.001 or something… apparently this may still be the case…

It’s actually not really Maya’s fault, it’s really mental ray that is trying to be smart and optimize away motion blur if it can… I think some other apps get around this in the UI so if you set shutter = 0 it actually is set to 0.001 under the hood :wink:

Besides, if you are rendering 2d blur, you should really have your shutter set to open and close at 0.25 with the “shutter” value in mip_motionblur set to 0.5, so that the blur is “the same” as traditional 3d blur opening at t=0 and closing a t=0.5



Nevertheless, I suppose it should works. I just pass some tests with mrsa and it’s not maya’s bug, it’s mr bug.
Because in mr release notes you can see:

Changes in Version
-The handling of motion vectors in cases where the motion option is turned on but both the shutter open and shutter close times are 0, has been corrected. This is useful in order to output motion vectors for a 2D motion blur postprocess without computing 3D motion blur in mental ray.

It should works, but actually not works.


Well, it actually works in mr if done correctly… it’s a long story, don’t have time to get into it right now, but it has to do with the order of parameter assignments…



Thanks a lot for those examples Zap.

The only thing I’m struggling to figure out is how to do that with a proper IBL sphere instead of the mirrorball. If i plug an IBL Sphere instead of the mirrorball it goes black.
It works with the SphericalLookup node, but that one doesn’t give me any controls and is not visible in the viewport either.

Is it possible at all?



thanks a lot for theses new shaders, the only thing is when i render the scene " " i get this warning msg in script editor:
// Warning: (Mayatomr.Nodes) : initialShadingGroup: connection of a material shader not returning a single color value: mip_matteshadow2, may be dangerous. //

the same warnig msg with “”.

so are theses new sahders stable when use it in production? say u have a camera flying trought a bakground and objects moving around …etc
sory for my english


This warning can be safely ignored. The keyword in the message is “may” be dangerous, i.e. a shader that is returning a struct and that is connected to a “material root” needs to be aware of this (which mip_matteshadow is) or it may return “too much data” and muck things up.

If you don’t like to see the error, you can connected mip_matteshadow1.result to some other shader and connect that shader to the shading group. A great tip is to use mip_card_opacity for this purpouse, because this gives you a way to do opacity mapping on the matte objects, which can be very useful.

For example, you want to do a snake wrapper around someones arm. So you create a matte object for the arm… but the arm has a very very complex shape, hard to make your matte object match the contour exactly (there may even be motion blur, causing the edge to be “fuzzy”)

This is solved by creating a mask in something like after effects/photoshop/etc. for the arm, in screen space, then putting mip_card_opacity on top of mip_matteshadow, then use mip_cameramap to screen-project your opacity map to the opacity slot of mip_card_opacity… and you have a perfect outline of the arm, even though the geometry didn’t match “perfectly”. (You can even get away with a stupidly simple stand-in geometry for the arm, like a cylinder!)



Thanks so much this explanation is very helpfull.


Has anyone created little xpm icons for these shaders? I live for icons and hate getting “Warning: File not found:…” errors when I open Hypershade.



Maybe you or MasterZAP could write down how to connect and use this motion vector shader? Or maybe attach an example scene with it in use. Can’t really get the hang of it.

What compprogram do you use your vector passes in? I want to use them in nuke with the vector blur node.


As I understand mip_motion_vector don’t support nuke motion vectors format, Master Zap please correct me if I’m wrong.

But if you need it, you may use some another shader, for example my p_motion_to_rgb, it work fine with Nuke (and possible with new vector blur in DF 5.2).
You may find tutorial in docs in archive or online version here:
direct link to 2d motion blur tutorial here:
shaders pack you may dowload here: and here is updated dll for Maya 2008 (win32 and win64 only):

Sorry for offtopic.


Another motion vector format? Why can’t these people just make up their mind? :rolleyes:


So, what exactly is the “Nuke motion vector format”. If I know that, I can either confirm or deny if it works, plus if not, add it in the next version…

As for “how to use it”.

Now, this is kind of funny. When I wrote the docs, and actually designed the mip_motion* shaders was actually quite long ago.

Maya 2008 has added some “new” way to add output shaders which I couldn’t quite figure out, so I used the one marked as “obsolete”, which amusingly worked correctly; just make sure to check the “depth” and “motion vector” passes.

But it works fine even for a shutter=0 settin, so that “misfeature” (mentioned above) is indeed fixed in 2008/mental ray (i.e. no need for a 0.0001 shutter setting)

Here is a file showing the motion blur and here is one showing motion vector (same file, different output shader applied).



Oooh! You added it almost like I did last night when I kinda got it to work. =) But would still be interesting with somekind of doc for it. Can’t find anything in the maya2008 docs or in any subdir of the docs.

What I wonder is how the different settings in the mip_motion_vector shader affect the result. I had to crank my max Displace in my scene up to about 3000 or something to get a result. And what about the pixel threshold? can’t see any difference no matter how I adjust it.

And the different framebuffer slots in the shader? Should they be used or left alone?

And I also got pretty rough edges on my tests but guess that is ok with a “vector pass”.

I am not really the correct person to answer on how Nuke works with the vectors. But here is an interesting thread about it.

Puppet: I do have some issues with your shader. I will start a new thread about that instead of taking it in here.

Big thanks to both Puppet and Zap for looking into this! =)))


I’m working on getting docs online. Some minor technicalities. Please stay tuned.

If you are not using floating point, then the “max_displace” is the maximum amount of motion (in pixels) your output values can express… since “red” encodes the X motion, if max_displace is 100, it means that “100% red” means 100 pixels to the right, and “0% red” means 100 pixels to the left. Similar for green.

max_displace=0 is a special value; then the values are related to image width and height instead. If your image is 1280x720, then “100% red” means 1280 to the right, “0% red” 1280 pixels to the left, “100% green” means 720 pixels upwards, “0% green” means 720 pixels downwards. This does not work well with 8 bit output files, so you would output to 16 bit files (or EXR/float) in this mode.

It culls out slow movement. So any movement less than this number of pixels is actually exported as no movement at all. This is because really slow pans you really dont want motion blur on, coz it just makes it look smeary… because the viewer will actually “track” the pan with the eyes and if you are “trackign” a moving object with your eyes, it wouldn’t actually motion blur at all…

“Left alone” means “use defaults”, which is what you want 90% of the time, unless you want to write your motion vector buffer to a separate frame buffer (which you can) which would mean you would set the “blur_fb” to the number of the buffer.

Yeah, you can use the shader with a interpolation motion vector/depth map, but I’m not sure how to get maya to output that… by default maya seems to generate a non-interpolated motion/depth buffer.



Sorry, I was wrong and mip_motion_vector works fine with Nuke! :slight_smile:
You just need enable ‘Floating point Format’ or remap 8bit to float. Both methods works fine.
Same graph in Nuke as with my shader :slight_smile:

Master Zap, your settings for getting motion vectors have one defect in comparison with my one :slight_smile:
For getting motion vectors in same place (phase) that beauty pass you should compute beauty pass with motion blur enabled too (as mb vectors) and it may slowdown mi generation, mostly for heavy scenes.


Yeah, well, Maya has this odd behaviour of moving the time for motion blur renders… I don’t quite get that…

…anway, the point is that you are “supposed” (i.e. the idea is) to create your motion vectors is the same render pass as your beauty. And use the “blur_fb” to write it to a separate one. Then you will have them in sync, guaranteed.

But your point is quite correct. Why is maya changing the time for motion blur renders? To match some maya software rendered blur, or … (?)



the mip_motion is really nice, but as being new to mental i really have a problem with rendering (as you proposed) the 2 framebuffers at once. (beauty and motion). i really dont get what the manuals say - and with the “blur fb”: do you mean the “motion fb” in mip_motion?

if anyone could share some light on that for me that would be great :slight_smile: