Advanced: Customising the render process¶
smartRender works out of the box producing fast render results. However, you can customize the actual render process command modules to your needs.
If you have some python programming knowledge then you can edit the command modules and add your own commands to them. This can become very useful if you need to tailor smartRender to your existing pipeline. Feel free to edit both command modules to your needs.
smartRender includes two modules that you can edit:
render_cmd.py: This module creates the terminal input commands render_process.py: This module will be executed from your terminal when it comes to processing a frame
Both modules can be found inside the custom folder in the smartRender package. If you installed smartRender using connect it can be found here:
If you installed smartRender using the manual method then the custom folder can be found at the according location inside the smartRender package.
CAUTION: CHANGING BOTH MODULES COULD POTENTIALLY BREAK SMARTRENDER FROM WORKING CORRECTLY. WE HIGHLY RECOMMEND MAKING A BACKUP OF BOTH MODULES BEFORE CHANGING THEM. PLEASE HANDLE WITH CAUTION.
The render_cmd module¶
The render_cmd module contains one function
create_cmd() which assembles
a render command for the worker threads to be executed it in NUKE’s terminal
mode. The command is returned as a string.
By default, a render command is build out of NUKE internal flags and some additional arguments and looks like this:
<path to nuke executable> -i -t <path to render_process.py> job_id thread_id script write frame views
<path to nuke executable>: Absolute path of nuke executable that will run in terminal mode.
-i: Flag to tell NUKE to use an interactive (nuke_i) FLEXlm license key. If you happen to have enough render licenses, you might skip this flag so that no interactive licenses will be used.
-t: Flag to tell NUKE to run in terminal mode.
<path to render_process.py>: Absolute path to the render batch script called render_process that will be processed. The absolute path will be assembled by smartRender automatically.
job_id: A unique job id for identifying the current job in log file
and writing process to log file. A job id looks like this:
thread_id: The id of the thread that will process the current job. Threads
are named as
script: The absolute path of nuke script to process.
frame: The Frame to process. Named as
f1 for frame 1,
frame 2, ...
views: The views to render. In most cases this might be
main if the
current working file is not a stereo working file. Multiple views are separated
by comma like
The first three arguments (nuke executable, -i, -t) are NUKE internal flags that will be called.
- The NUKE executable is pointing to the absolute path of the executable nuke application that will run in terminal mode.
- The NUKE executable will be executed using the
-iflag to use an interactive (nuke_i) FLEXlm license key.
- The NUKE executable will run with the
-tflag which means it will run in terminal mode without any GUI (graphical user interface) being loaded.
The following arguments are additional arguments that will be used in the render_process module which is documented in render_process_module.
- render_process.py: The absolute path of the renderProcess module that will be executed.
- job_id: This is the internal job id as it will be used for logging information.
- thread_id: This is the internal thread id as it will be used for logging information.
- script: Absolute path of the NUKE script that will be opened in
terminal mode and executed.
- frame: The frame to process. The frame will need to be casted as a String for being send as an argument and will look like
f1for frame 1,
f10for frame 10 and so on. Once being in render_process.py, this string will be casted back to an integer like 1, 10, ...
- views: Views to render. The default is main.
Additional external resources¶
When customizing the render process, chances are high that you might want to have a look at the following two resources.
The NUKE terminal documentation can be found here:
A list of additional NUKE internal flags please can be found here:
The render_process module¶
The render_process module will be executed in NUKE’s terminal mode. Each thread calls this render batch script.
The module includes two functions:
This function creates an std out which will be fetched internally by smartRender to write log information.
This is the render function that will be executed to process a frame. Inside the function these commands will be executed:
- Re-cast the frame argument back to an integer.
- Open the nuke script.
- Check for some script errors (disabled write node, error in tree) and log the information about the frame that was processed.
- Try to render the frame and log the information.