Monday, June 3, 2013

How to generate motion vector fields by using the VectorGenerator node

The VectorGenerator node in NukeX is used to create the images with the motion vector fields. This node generates two sets of motion vectors for each frame which are stored in the vector channels. The output of the VectorGenerator node can be used with the nodes that take vector input such as the Kronos and MotionBlur nodes. The image with the fields contains an offset (x, y) per pixel. These offset values are used to wrap a neighboring frame into the current frame. Most of the frames in the sequence will have two neighbors therefore two vector fields are generated for each frame: backward vector and forward vector fields.

To add a VectorGenerator node to the Node Graph panel, select the node in the Node Graph panel from which you need to generate fields and then choose VectorGenerator from the Time menu; the VectorGenerator# node will be added to the Node Graph panel. Make sure the VectorGenerator# node is selected and then press 1 to view its output in the Viewer# panel. To view the forward motion vectors, select forward from the Channel Sets drop-down. Select backward from the Channel Sets drop-down to view the backward motion vectors. To view the backward and forward motion vectors, choose motion from the Channel Sets drop-down. Figure 1 through 4 show the input image, forward and backward motion vectors, forward, and backward motion vectors, respectively.


Figure 1
Figure 2
Figure -3
Figure 4
While viewing the motion vectors in the Viewer# panel, the x values are represented by the red channel while the y values are represented by the green channel. Figures 5 and 6 show the backward x and backward y values in the red and green channels, respectively.
Figure 5
Figure 6
If you have an image sequence in which the foreground object is moving over the background, you might not get the desired result because the motion estimation might not get calculated properly around the edges between the foreground and background. To rectify this, create a matte for the foreground object and then connect it with the matte input of the VectorGenerator node. Then, select the required matte channel from the matte channel drop-down in the VectorGenerator tab of the VectorGenerator# node properties panel. On doing so, the motion approximation will be proper between the edges. If you use the matte channel, you can output vectors for the foreground or background by selecting Foreground or Background from the Output drop-down.
Note: In the VectorGenerator tab of the VectorGenerator# node properties panel, the Use GPU if available check box is selected by default. As a result, Nuke uses GPU instead of CPU for processing vector fields. It helps in enhancing the processing performance.
To increase the resolution of the vector fields, adjust the Vector Detail parameter. This parameter is helpful in adjusting the density of the calculated motion vector fields. Higher values will give you more accurate results but will tax you on the processing time. If you specify the value 1 for the Vector Detail parameter, a vector will be generated for each pixel. If you set a higher value for the Smoothness parameter, the vector fields will be less detailed. The default value of 0.5 is fine for most of the image sequences. If there is a change in luminance in your image sequence, select the Flicker Compensation check box in the Advance area of the VectorGeerator# node properties panel. When you select this check box, Nuke will take into account the change in luminance and flickering.
Note: On selecting the Flicker Compensation check box, the processing time will increase.
The VectorGenerator node uses luminance values (monochrome) to generate motion estimation. The options in the Advanced > Tolerances area are used to fine tune the weight of color channels while calculating the luminance values.

Once you have generated the fields, you can use the output of the VectorGenerator node with the Kronos or MotionBlur node.

You might also like: Create motion blur effect using the motion vector pass

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...