| ||||||
![]() |
![]() |
![]() |
Download
Softimage|XSI / mental ray shader for use with RevisionFX ' SmoothKit ' and/or 'ReelSmart Motion Blur v3' plugins.
lm_2DMV.v1.3p.xsiaddon - ( new addition to version 1.3p: RSMB v3 2D motion vectors encoding format )
lm_2DMV.v1.3p.zip - dll, so and spdl
For Maya users, take a look at Horvatth Szabolcs page lm_2DMV - Maya files
Disclamer
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 .
Introduction
This document describe the lm_2DMV shader
wich 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.
Encoding
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:
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.
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.
The Intensity information require a particular attention.
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.
Use
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
3) Normalize
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 choose the next superior value from the shader 'Normalize' parameter.


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.
Etc..
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.
Notes
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.
| guy rabiller - Copyright ©2003-2004, LaMaison | [rev. 04/03/26 - y/m/d] |