Rendering via command line is a handy way to render Nuke scripts in the background or remotely in the absence of a render farm/manager such as Deadline. This method also allows you to leverage your gpu(s) for rendering which is not currently supported when rendering with Frame Server.
Here's a few tips, examples and references to get started along with some bonus flags to debug the Frame Server as well.
* This guide was performed in Windows and there are slight differences for the system environment variables if you are using MacOS/Linux shell documented in the Nuke user guide.
Open a command line/terminal shell prompt and change directory to Nuke.exe path
cd C:\Program Files\Nuke13.2v3\
I recommend adding the Nuke.exe path to your system environment variables to avoid having to type/cd into that path each time.
Alternatively, you can set a doskey to point to Nuke and then you can launch Nuke from any directory:
doskey nuke="C:\Program Files\Nuke13.2v2\Nuke13.2.exe"
If you want to doskey NukeX, enter:
doskey NukeX="C:\Program Files\Nuke13.2v2\Nuke13.2.exe" --nukex
If you want to doskey Nuke Studio, enter:
doskey nukes="C:\Program Files\Nuke13.2v2\Nuke13.2.exe" --studio
Nuke Command Line render flags:
# Launch Nuke Studio
--studio
# Launch NukeX
--nukex
# Launch in safe mode
--safe
# Enable Interactive License
-i
# Enable GPU Rendering
-gpu
# Display version info
--version
# Verbose mode low/med/high: (0/1/2)
-V 1
# Pause viewers
--pause
# Measure Performance
-P
# Open script(s) at proxy resolution
-p
# Measure your nodes performance metrics and write them to an XML file at render
time. See Using Script Profiling for more information.
-Pf <filename>
# Set render range frame '1-100'
-F 1-100
# Open Nuke script at full resolution
-f
# Continue on errors
--cont
# Background mode
-b
# Anamorphic format
-a
# Open script without Postage stamp nodes
-n
# Nuke priority specifiy: (low/medium/high)
--priority p
# Quite mode
-q
# Limit the cache memory usage, where size equals a number in bytes. You can specify a
different unit by appending k (kilobytes), M (megabytes), or G (gigabytes) after size.
-c size (k, M, or G)
Examples:
Run NukeX in interactive mode (-i) and render 'Write_EXR' node with frame range '1-240' with gpu acceleration and verbose level 2
Nuke13.2.exe --nukex -i -F 1-240 -gpu -V 2 -X Write_EXR --pause S:\PROJECTS\path_to_my_nuke_script_v01.nk
You can also have multiple terminal/shell instances running without the overhead of the Nuke gui saving you precious memory and VRAM.
Using a StickyNote or Backdrop node you can grab the Nuke script path easily and append it to a command line render with this TCL snippet:
Nuke13.2.exe --nukex -i -F 1-240 -gpu -V 2 -X Write_EXR --pause [join [lrange [split [file dirname [knob root.name]] "/"] 0 end-1] "/"]/[lindex [split [value root.name] /] end]
Frame Server debugging commands (useful for troubleshooting Frame Server issues):
# Frame Server Debug Log
--frameserver-loglevel DEBUG
# Manually launch Frame Server with 3 workers and 6 threads each, 48gb max memory
python.exe pythonextensions\site-packages\foundry\frameserver\nuke\runframeserver.py --numworkers=3 --nukeworkerthreads=6 --nukeworkermemory=48192 --workerconnecturl tcp://hostip:5560 --nukepath=Nuke13.2.exe --useInteractiveLicense
# Check Frame Server connection (Nuke/NukeX)
from hiero.ui.nuke_bridge.FnNsFrameServer import frameServer
print([worker.address for worker in frameServer.getStatus(1).workerStatus])
# Check Frame Server connection (Nuke Studio)
from hiero.ui.nuke_bridge.nukestudio import frameServer
print([worker.address for worker in frameServer.getStatus(1).workerStatus])
# Disable Frame Server Nuke
"C:\Program Files\Nuke13.1v1\Nuke13.1.exe" --disable-nuke-frameserver
# Disable Frame Server Nuke Studio
"C:\Program Files\Nuke13.1v1\Nuke13.1.exe" --studio --disable-nuke-frameserver
# Disable Frame Server Hiero
"C:\Program Files\Nuke13.1v1\Nuke13.1.exe" --hiero --disable-nuke-frameserver
References:
Command Line Operations: https://learn.foundry.com/nuke/content/comp_environment/configuring_nuke/command_line_operations.html
Rendering Using the Frame Server: https://learn.foundry.com/nuke/content/comp_environment/rendering/frame_server_renders.html
How to Render Using the GPU in Nuke (macOS): https://cristianogiardina.com/general/nuke-render-gpu-macos/