Motion Blur as a Post Process
July 5th, 2006 by Stefano Jannuzzo - Viewed 16949 times - Popularity: 27% [?]Due to the long rendering times involved, most people prefer to perform motion blur as a post process.
A motion vector pass is rendered and used in Shake or another compositing application. The popular way to export a motion vector pass is by using lm2DMV, a shader from Guy Rabiller whose source code is also available online.
Let’s see how to exploit this tool at its best.
Although it is a texture shader, intended to override the existing materials, it can be applied at a camera level.
Since the shader uses information stored in the mental ray state structure, it is sufficient to push it after an eye ray has been traced. So, we simply use a lazy tracer (Lens Effect, with nothing enabled), and override its result by lm2DMV through a mixer. This way, you also have the motion null result in the background.
How to best output this buffer?
Given the motion vector Speed, expressed in raster space, and L being its magnitude in pixels, if we take a look at the code we see that the way a motion vector is encoded is the following:
result->r = (Speed.x / L) * 0.5 + 0.5; result->g = (Speed.y / L) * 0.5 + 0.5; result->b = L / normalizer;
So, in r and g it outputs the motion vector direction, in b its magnitude divided by the normalizer parameter, which is meant to shrink the magnitude range [-inf, +inf] to the more sensible [0..1].
In theory, this normalizer factor should be the maximum raster speed animation wise. In most cases, outputting a regular picture format, will either crop large and significant speed areas, or not exploit the full picture color range.
To fix these limitations we can stop caring about normalization. Setting the shader’s normalizer value to 1 and outputting the motion vector pass to a floating point format (.ct for example) we can manage to keep the full original information (L) in the b channel. This floating point data is then correctly read by nodes such as ndo_IDirBlur for Shake.
This technique can be used also to create other standard passes (depth, normals, points, etc), that will correctly preserve the geometry information. For instance, you could output a point buffer, that is a file which holds, for each pixel, the rendered point’’s x,y,z, preserving the negative coordinates.
Too bad the FxTree will crop the negative colors even though allowing ct inputs. Shake, instead, seems to be behave correctly.
Popularity: 27% [?]






I dont understand the normalize part of the documentation. How did they get the normalize value of 128 I am kinda lost in the math :) Please help!
I can”t get the geometry to show up i did the same thing as it is shown on above with the sphere mix2 coloer and 2 shaders same settings, I get solid color full frame no geo?
Does your sphere move?
lm2DMV rules, I use it all the time, under normal circumstances, the usual technique would be sufficient, Also I use After Effects, not Shake so not sure about the ”un-normalised” technique working there. But there ARE cicumstances when this technique could be handy when objects exhibit a whole range of fast and slow movements.
for Erin > from La Maison’’s website >>
A simple way to retrieve a good estimation of this value is to activate the logging of MentalRay Progress Reports (in the logged message tab of render options) and render an image showing the maximum objects motion speed
You will get the following information when the rendering ends, either in the message bar or in the logged messages part of the Script Editor:
“INFO : “PHEN 0.2 info : [lm_2DMV] >> Max Displace -> 29 pixels”
Note the ”Max Displace” value and set the shader ”Normalize” parameter accordingly.
thanks for the article Stefano
See, the full workflow with the default usage would be to first render the whole animation, go check the maximim Max Displace animation wise, not just for a single frame, set the normalizing factor to that value and render again.
I prefer my way, because I don”t have to care for normalizing at all.
Ciao
Hi Stefano, i have a couple ( maybe three :D ) of question.
1)How do you “check the maximim Max Displace animation wise ” ? I”ve notice that the max displace value, changes every frame, so i don”t know witch one to choose for the entire animation.
2)Using your tecnique, should i choose :ReelSmart or SmmothKit in the lamaison plugin ? Beacause if i choose ReelSmart and I render with a value like “1″ it renders all with bands of color, not gradient, with a complete wasted vector motion blur. If i choose SmoothKit, it work well also with “1″; rendering with Smookit works the same then in compositing in AE with Reelsmart Plugin ?
3)I can”t understand why do you use this “lens” tree, and not an ovverride pass on the objs ? Can you explain it to me ?
Thx for your replys !
Simone ;)
1. You should take the maximum of the maxima, as in my previous reply.
2. Do not use realsmart, in realsmart mode the conversion from motion to rgb is different.
3. That’’s just a possibility that I prefer. I don”t love overrides, and this way you have just a single instance of the shader. Besides, I also wanted to show a different, and I think more elegant, way to render passes. As mentioned, linking a shader to the lens and exploiting the State nodes allows you to easily export other kinds of passes.
Stefano
Hi people -
I just finished developing a plugin for After Effects called RPF Motion Blur.
It adds the possibility of adding motion blur to a RPF file rendered in 3DS MAX, XSI or other 3D application.
You can download a free demo from http://www.rpfmotionblur.com
Also, a free RPF Viewer application; useful for fast viewing rpf in win xp http://www.rpfviewer.com
Thanks a lot, hope you like it
German Heller
3Dar Inc.
http://www.3dar.com
Hi German,
I think that not is possible to generate a *.rpf output inside xsi, maybe i”m wrong? Only *.mt from the mental ray renderer…
Javier Mansilla
Hi!
Is it possible to use this technique with reelsmart motion blur in fusion (or AE or Combusiton)?
Can we use it at all in fusion?
Check Guy Rabiller site, Combustion is mentioned. I have no idea how it deals with ct files, though