Thursday, April 25, 2013

The Precomp Node

WORKING WITH PRECOMP NODE
The Precomp node is similar to the Group node. However, its contents are stored in an separate NukeX script file. It helps in breaking a large script into smaller process trees. The Precomp node enhances the workflow and speeds up the rendering process as NukeX has to process a single image input instead of all nodes. This node enhances the collaborative workflow where one user can work on the main composition while others can work on sub-comps that can be modified independent of the main composition.

To add a Precomp node, select the nodes that you want to include in the separate script and then choose the Other button from the Nodes toolbar; the Other menu will be displayed. Next, choose Precomp from the menu; the Precomp Nodes dialog box will be displayed, as shown in Figure 1.

The Precomp Nodes dialog box
Figure 1  The Precomp Nodes dialog box 
Note:
If no node is selected when you create a Precomp node, the Precomp Nodes dialog box will not be displayed. However, you can add link to an existing script file to the empty Precomp node by using the file parameter from the Precomp# node properties panel.
In this dialog box, click on the folder icon corresponding to the Precomp script path parameter; the panelNode: Replace Precomp#_v01.nk dialog box will be displayed. Next, browse to the location where you want to save the precomp .nk script. Enter a name in the pathname name field for the precomp and then choose the Open button. Now, click on the folder icon corresponding to the Precomp render path parameter; the panelNode: Replace Precomp#.####.exr dialog box will be displayed. In this dialog box, browse to the location where you need to save the render of the precomp. Enter a name in the pathname field for the render file and then choose the Open button.
Note:By default, the precomp script is saved at the location where the main script exists. If you have not saved the main script, the precomp script is saved in the main directory.
Select the channels that you need to include in the precomp from the Channels drop-down of the Precomp Nodes dialog box. Select the desired option from the Original nodes drop-down. The options in this drop-down are used to determine the behavior of the selected nodes. Select the add backdrop option from this drop-down to add a backdrop behind the precomped nodes. Select delete option from the drop-down to delete the precomped nodes. Select no change option from the drop-down to retain its existing state.

Now, choose the delete option from the Original nodes drop-down and then choose the OK button from the Precomp Nodes dialog box; the Group Output dialog box will be displayed. In this dialog box, select the node that will work as output. Next, choose the OK button to close the dialog box. NukeX automatically creates a Write and an Output node in the precomp. On rendering, if NukeX can not find any Write or Output node in the precomp, it produces an error in the precomp.

Note:1. You should render the image in the .exr format as it is capable of storing hash value. NukeX uses hash value to match, the changes between the incoming node tree and the rendered file. If hash values do not match NukeX notifies you about the mismatch. If you are using any other format than .exr, you will not get this notification and there is a risk of using out of date render file. 
2. It is recommended that you set the project settings in the main comp. The precomp uses project settings of the main comp. If you open the precomp in a separate instance of NukeX and change its project settings, the change will have no effect on the main comp when it is loaded into the main comp.
Tip:To display hash value of a node, select the node in the Node Graph panel and press I; a window with information about node, including the hash value, will be displayed, refer to Figure 2.
A window displaying hash value of the Grade1 node
Figure 2  A window displaying hash value of the Grade1 node 
Rendering a Precomp Node
Create a Precomp node as discussed earlier. In the Precomp tab of the Precomp# node properties panel, choose the Render button; the Execute dialog box will be displayed, as shown in Figure 3. 

The Execute dialog box
Figure 3  The Execute dialog box
Specify the frame range that you need to render in the frame_range_string field located next to the Frame range drop-down and then choose the OK button to close the dialog box. On doing so, the Progress window will be displayed showing the rendering progress. It will automatically close once the rendering process completes. When the rendering process finishes, the read file for output check box in the Precomp tab of the Precomp node properties panel will be automatically selected. As a result, NukeX will read image sequence rather than calculating output of the precomp. You will also notice that the Precomp# node in the Node Graph panel has turned green. Also, the label (Read) will be displayed on it, refer to Figure 4. In case NukeX generates error on opening the rendered output, you can select the response from the missing frames drop-down. This drop-down has four options, namely error, black, checkerboard, and read input.

The green colored Precomp1 node with the Read label on it
Figure 4  The green colored Precomp1 node with the Read label on it
Viewing and Editing a Precomp Script
To view and edit a precomp script, choose the Open button in the Precomp node properties panel. On doing so, a new NukeX session will be launched and the precomp will be loaded in it. If you are using version numbers in the Write node, make sure to choose Edit > Node > Filename > Version Up from the menu bar; the version number of the file will be increased by one. For example, the myPrecomp_v01_###.exr will change to myPrecomp_v02_###.exr. Now render the Write node. Next, choose File > Save New Version from the menu bar or press ALT+SHIFT+S; the script will be saved with a new version. Fox example, the myPrecomp_v01.nk script will change to myPrecomp_v02.nk.

Reloading a Revised Precomp Script
To reload a revised precomp script, load the main comp. Next, in the Precomp tab of the Precomp# node properties panel make sure the name of the script in the file field matches with the current name of the precomp script. Next, choose the Reload button to reload the revised precomp into the main comp.

This article is taken from the Nuke Book: The Foundry Nuke 7 for Compositors.

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...