Q100418: Using VectorBlur as an alternative to ScanlineRender for 3D motion blur
The standard way to increase motion blur for a 3D object in Nuke, is to increase the samples within the ScanlineRender node. These sample values control the amount of interpolated data used to calculate between frames. As such, the larger the sample values the more detailed the motion blur will become.
Increasing these sample values will increase the image processing time quite significantly and this can affect performance within more complex projects.
To avoid this processing overhead, as an alternative you can process this calculation outside of the ScanlineRender node itself. This can be achieved by using the ScanlineRender node's generated motion vectors within a VectorBlur node.
This article explains how the workflow can be created using the VectorBlur node (VectorBlur2 iteration) and also includes and example scenario.
The ScanlineRender node by default, generates motion vector passes from a 3D object in Nuke. Motion vector passes themselves store positional information as numeric values within the red and green channels of a layer. The values of these passes are not representative of an intended colour, but used by Nuke to determine changes in the direction, speed and position of moving objects in the shot.
The motion vector information within the ScanlineRender node is stored by default in the forward layer, but it can also be stored in the motion layer or a custom created layer.
This motion vector information that is being generated, can then be read into a VectorBlur node to allow a faster level of image processing. The process is as simple as defining the uv channels source as the layer being generated from the ScanlineRender node. There are several preset options, but we suggest the Nuke ScanlineRender preset for the best results.
There are several advantages to this workflow:
1) As the VectorBlur node has the option to use the GPU for processing, if your machine matches our recommended specifications for GPU acceleration, this process will be quite efficient.
For more information on our recommended minimum specifications for GPU Acceleration, please see the following link: Nuke System Requirements
2) The VectorBlur node is only interpreting the 2D-based information through the u and v values, which in turn reduce the amount of processing required.
3) As the VectorBlur node and the motion vector calculations are outside of the ScanlineRender node, it is easy to disable the motion blur by disabling the VectorBlur node itself.
4) The motion vector calculations can be rendered out as 2D data and read back into Nuke, then used to avoid any previous processing through the 3D scene altogether.
Below is an example workflow with a list of steps to recreate this process.
This process requires two phases. The first phase is the correct creation of the motion vector passes in the ScanlineRender node, and the second phase is the correct integration of these motion vector passes into the VectorBlur node.
Phase 1: ScanlineRender
1) Create a CheckerBoard node to be used as a Shader for the 3D object
2) Create a Sphere node, setting a keyframe at the value of '-2' on translate x and another keyframe at the value to '2' on frame 10. (This will be used animate the Sphere in 3D space and create the basis of the motion blur)
Frame 1 Frame 10
3) Connect the img input of the Sphere node to the CheckerBoard node
4) Create a Camera node and set the translate z value to '10'. (This will frame up the Sphere in 3D space)
5) Create a ScanlineRender node and connect the Camera node to the cam input and the Sphere node into the obj/scn input.
6) Within the ScanlineRender, ensure the sample value knob in the MultiSample tab is set to '1'
7) Also ensure that the Shader tab's knob for motion vectors is set to 'distance' and motion vector channels to 'forward'.
Phase 2: VectorBlur
1) Create a VectorBlur node and connect the input into the ScanlineRender node
2) Alter the uv channels knob and set to the 'forward' layer
3) Ensure that the mv presets knob is set to 'Nuke ScanlineRender'
4) Alter the blur uv knob and set it to 'linear'. (If this remains default, this will create incorrect interpolation on the edges)
5) Alter the motion amount knob and set to desired amount of motion blur you would like.
6) Alter the motion falloff knob to a value of '0.2'. (This control can be used to control the falloff depending on intended interpolation)
7) As per this example, if your ScanlineRender node's output is on black and using a bounding box to calculate just the area of the image itself, you will need to alter the expand blur bbox knob to a value that will allow your bounding box to not cut the image.
This size will vary based on your input image, in my example I am using a value of '50'.
You can see a comparison below of varied values:
expand blur bbox = 0 expand blur bbox = 50
NOTE: The above workflow has also been recreated within the attached script: Alternative3DMotionBlur.nk
RESULTS COMPARISON TEST
As an example, you can find attached a screen recording of the comparison between the original process and the VectorBlur suggested alternative process: Alternative3DMotionBlur_comparison.mp4.
In addition, we have added the comparison test which will allow you to run this test yourself, within the following attached script: Alternative3DMotionBlur.nk
Below are two comparison images from the above mentioned recording which shows motion blur generated via the VectorBlur node is noticeably faster when comparing a 25 frame render:
NOTE: The motion blur samples in the ScanlineRender node have been matched as closely as possible, using the minimal amount of samples required to achieve the same result.
You can see from the above comparison that using motion vectors within a VectorBlur node as an alternative to increasing ScanlineRender node's samples, reduces the amount of processing required. This will be more noticeably within larger and complex 3D rendering-based scripts.
NOTE: This process can also be achieved with the RayRender node instead of the ScanlineRender node. The following options within the RayRender nodes 'AOV' tab will need to be altered for this to work correctly:
1) Output AOV checkbox needs to be toggled on
2) the motion vector pass will need to be set to output the correct layer, in our example from above the 'forward' layer.
More information on both the VectorBlur and ScanlineRender nodes can be found via the following links to our Online Help documentation:
We're sorry to hear that!Please tell us why.