Q100472: How to create a Batch render for Nuke on the Windows Platform.
Warning: This article contains links to external websites
SUMMARY
This article explains how to create a Batch file for rendering multiple Nuke scripts on a Windows operating system. This would be beneficial for a user to implement the rendering of more than one script at a time, especially those with asynchronous frame output.
MORE INFORMATION
This process will allow the user to run a single Batch file to achieve the same results as opening multiple command windows to render with. This process is fairly complex, and requires working knowledge of Windows directories, and specific Nuke command-line operations to complete.
Example:
1. Launch a text editor, such as Notepad.
2. Begin scripting the batch file by adding a path to Nuke with the following code:
path="C:\Program Files\Nuke11.1v1\" - using whichever version of Nuke is currently installed.
2a. Then, implement the script to be rendered with this line:
start Nuke11.1.exe -x -F 1-10 “path/to/script_v1.nk"
NOTE: The start command opens Nuke 11.1 and then executes (-x) all Write nodes of the script for frames (-F) 1-10 in a specific script titled “test_v1.nk”.
2b. Repeat the above command for each specific script to be rendered. Please see the example below to reference this.
3. Select File > Save As…
4. Create a filename with the extension .bat. (i.e batchRender.bat) and confirm with Save.
5. Double-click the batch file in the saved location to run the script. Alternatively, right-click the file and select Open.
6. Once the batch file completes, view the specified directory for output of the renders.
Please view this example batch file for rendering 3 scripts at once, which also includes additional lines that are not referenced above. You may view additional information regarding these lines in the Further Reading section:
@echo off title Batch Render Nuke Scripts! mode 45, 10 rem ====================== rem MAKE A CHOICE rem ====================== echo. echo WELCOME! echo. echo. CHOICE /M "Would you like to begin rendering?" IF ERRORLEVEL 2 GOTO :End IF ERRORLEVEL 1 GOTO :Begin rem ============================ rem BEGIN THE BATCH RENDER rem ============================ :Begin rem ====================================== rem SETTING PATH TO EXECUTE RENDER rem ====================================== path="C:\Program Files\Nuke11.1v1\" rem ========================= rem BEGIN SCRIPT 1 RENDER rem ========================= start Nuke11.1.exe -x -F 1-10 "C:\temp\test_v1.nk" rem ========================= rem BEGIN SCRIPT 2 RENDER rem ========================= start Nuke11.1.exe -x -F 1-10 "C:\temp\test_v2.nk" rem ========================= rem BEGIN SCRIPT 3 RENDER rem ========================= start Nuke11.1.exe -x -F 1-10 "C:\temp\test_v3.nk" :End title No Renders made... cls exit
Additional Notes:
With the above batch file example, the path of Nuke is set first for the program to initialize correctly. Then, the specific script locations for test_v1.nk, test_v2.nk, and test_v3.nk will open a command prompt for each file, and execute the specified frames called out in the start line.
For more information regarding Batch scripts, please view the provided links in the Further Reading section. You may also download the above script from the attachments.
Any command line operations that Nuke accepts can be used in the batch file, such as Render Order with -sro, or using specific Write nodes by using the -X command and the name of the Write node.
FURTHER READING
Please view our documentation more information on Command Line Operations.
Please view these articles for understanding what a Batch file does:
- Official Microsoft documentation for Batch files
- Overall Batch file information
- Batch file commands and usage
Keywords: output, frames, render, nuke, frame server, batches
Download the example script:
Attachments