17 march 2005 : lm_2DMV_v2
new in version v2 :
The normalize parameter is now a slider instead of a dropdown menu.
(for maya users : the normalize parameter will now work as expected)
There are others minor changes , and we encourage everyone to update with this version , especially if you are using RSMB for XSI.
lm_2DMV.v2.0p.xsiaddon - xsi addon (d&d inside xsi)
lm_2DMV.v2.0p.zip - dll, so and spdl
other softwares and other os ...
For Maya users, take a look at Horvatth Szabolcs page lm_2DMV - Maya files
For Max users, it seems that lm_2DMV doesn't work with Max7
take a look here for complete details
Tom Cowland has compiled a version for MacOSX you can find it here
a Windows 64 bits version of the lm_2dmv shader (dll and spdl) (thanks to Halfdan Ingvarsson from Softimage)
if you need to recompile lm_2DMV yourself on an exotic os , you can download the source code .
(you can still download the old version here)
The software is released as is, without any written or implied warranty. The software cannot be redistributed without permission from LaMaison. The program will not be supported. LaMaison is not responsible for any damage or loss of data incurred by the use of this software. lm_2DMV was developed by Guy Rabiller for LaMaison.
This document describe the lm_2DMV shader
which is used to export 'motion vectors' encoded as
color informations in standard image files.
This encoding respect precisely the motion blur 2D plugin specifications named 'SmoothKit' as well as the 'ReelSmart Motion Blur' ( new to v1.3p ) plugin from RevisionFX.
Those 'motion vectors' are vectors generated by mental ray from the 3D motion informations transmited by Softimage|XSI, gathered and converted by our shader at render time as image files used by SmoothKit or RSMB to recreate '2D Motion Blur'.
We call this process '2D Motion Blur' because those 'motion vectors' lives in the 2D image space, rather than in the 3D space of the scene.
They represent the motion of pixels.
Given the fact that at first the motion informations are expressed as 3D motion vectors, not normalised ( values range beyond [-1,1] ), that can have negative values ( not allowed in standard image files ), three operations have to be done in order to export them as image files:
- Projection of 3D vectors to 2D screen space
- Remap to positive values
This process - followed by the distribution of those informations to the color channels - called 'encoding', is exactly the purpose of our lm_2DMV shader.
According to the RevisionFX SmoothKit specifications, Red and Green color channels hold normalized direction vectors, and the Blue one holds the normalized intensity - the speed - of the motion.
- Red Channel: X [0,1]
- Green Channel: Y [0,1]
- Blue Channel: Intensity [0,1]
According to the RevisionFX ReelSmart Motion Blur v3 specifications, Red and Green color channels hold direction vectors scaled by normalized intensity - the speed - of the motion.
- Red Channel: X scaled by normalized Intensity [0,1]
- Green Channel: Y scaled by normalized Intensity [0,1]
- Blue Channel: not used.
The Intensity information require a
It has to be encoded with values ranging from 0 to 1, but the motion of objects into the screen space can have great variations, ranging from few pixels to hundreds, even thousends, pixels during the time spent by only one image.
These variations are unpredictable for the shader writer. That's why a user parameter has been added proposing a list a normalization values.
The shader is also able to log the maximum pixel motion value encountered during a frame rendering, in pixel units. This allows to precisely estimate the right value to choose from the normalize parameter.
1) Connecting Shader
The first thing to do is to load the shader into the rendertree, and connect its output to the 'Surface' input of a ' Material' node.
Typicaly its a good idea to create a motion vectors 'Pass' and connect the shader to a material applyed to the object partition.
2) Render Options Settings
For the shader to work, the 'Motion Blur' must be enabled by checking the 'Enable' parameter from the Render Options.
- Shutter Open / Close
We want the motion vectors being transmitted to our shader, be we don't want that the image itself being actualy blurred. So we have to activate the Motion Blur but neutralize it at the same time by setting the Shutter Open and Shutter Close to 0.
- Motion Transformation
'Evaluate Motion SRT for the entire frame' so we get the maximum motion blur information available for the frame time. We will be able to reduce this time range when we will process the Motion Blur, so better have the maximum one available at first.
- Motion Deformation
'Considere Shape changes in motion blur' because we want that Skinned Envelope, QuickStretch, ShapeJitter, etc.. being taken into account.
- Interpolation Steps
We don't actualy blur the image, so let this to 1.
The Intensity value, encoded into the Blue color channel
must have values ranging from 0 and 1.
However the motion of objects into the screen space can range from few pixels to hundreds, even thousends, pixels.
To remap these values to a range from 0 to 1, we have to 'normalize' them, wich means divide them by a value supposed to be the maximum pixel motion generated by the animated objects. This value is the 'normalize' value.
A simple way to retrieve a good estimation of this value is to activate the logging of MentalRay Progress Reports 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:
Note the 'Max Displace' value and set the shader 'Normalize' parameter accordingly.
4) Image Format
To have a great precision for the motion values, we use a 16bits per channel image file format that gives 65536 possible values rather than the usual 256 available in classical 8bits per channel image file formats.
We use 16Bits per channel 'SGI' file format:
5) SmoothKit Parameters
Here is a setting exemple of the SmoothKit parameters ( here in Combustion ):
The important setting to adjust is the
'Blur Length' parameter.
This parameter is directly related to the 'Normalize' shader parameter.
If we setted the 'Normalize' parameter to 128, for instance, and report the same value here, we would obtain a full blur, that is a blur occuring for the entire frame time.
To stay coherent with a real camera, giving the half value of the 'Normalize' parameter would be a good start. Then its more a matter of apreciation unless you know precisely the shutter speed used by the real camera.
For example, if we setted the 'Normalize' parameter to 128, setting the 'Blur Length' parameter to 64 would be a good start.
If we know that the camera Shutter Speed was setted to 1/48s, we would know for sure that we have to set the 'Blur Length' parameter to 64.
If the camera Shutter Speed was setted to 1/96s, we would know for sure that we have to set the 'Blur Length' parameter to 32.
6) RealSmart Motion Blur v3 Parameters
Here is a setting exemple of the ReelSmart Motion Blur v3 parameters ( here in Combustion ):
With RSMB you just have to copy here your 'Max Displace' value from XSI.
Then adjust the 'Blur Amt' - Blur Amount - parameter. 1.0 is full blur.
You don't have to touch the 'Vec Scale X/Y' parameters, they are here if you want yo invert the direction or tweak it, but don't 'scale' the Motion Blur amount with it, better use the 'Blur Amt' parameter.
Given the fact that the 'motion vectors' transmitted by MentalRay to the shader are evaluated from the precedent frame to the current frame, if the first rendered frame is the first animated frame, the first frame will contains 'null' motion vectors - without any motion information.
So always use an animation that start at least 1 frame before the actual first rendered frame.