Nuke – Rendering with the GPU in Nuke

Since I’ve been working in-house as a compositor I’ve been rendering all my Nuke scriptsgeforce_gt_03 in the Terminal on my Mac. All good… or so I thought.

I have recently discovered that Nuke does not use the GPU (Graphics Processing Unit) by default when rendering this way.  I guess it’s to do with rendering with the command line which is used for render farms which often won’t have a GPU.

Luckily the fix is simple. Add ‘–gpu’ to the terminal command and hey presto… the GPU is used when rendering.  So now the NVIDIA GeForce GT 750M in my MacBook Pro is used when rendering by the GPU accelerated nodes in my scripts.  Winner.

I have re-writen my Nuke Applescript droplet to use the GPU when rendering which you can download.

Happy rendering!


Nuke – Applescript Droplet to Render Nuke Scripts in Terminal


**UPDATE 21/04/17**
I have updated this script to use the GPU when rendering.  Please see this post for more details – Rendering with the GPU in Nuke

Since working on Spectre I’ve started rendering all my Nuke scripts in terminal shells and not the gui.  This feels a lot tidier and also seems to run much faster.

I’ve created an Applescript droplet to help with this.  Simply drop your script on to the droplet and it will open a terminal, enter the necessary information and then start rendering.


Thanks to jweaks on Stack Overflow for the help on this!

Please note – the version of Nuke you are running must be set up in your .bash_profile file for this droplet to work.  The Foundry have written an excellent piece on this if you need help.

Command-Line Operations

Nuke – ZDefocus Edge Errors

Has anyone had this problem with the ZDefocus Node?

I get very weird artefacts when I defocus a monitor graphic that I’m tracking into a shot.  It looks fine straight out of the ZDefocus node but when I gamma up to 10 I can see artefacts around my element.

I’ve uploaded the script to dropbox.

Any thoughts would be greatly appreciated!

My conversation on The Foundry Nuke forum.


Nuke – The Amazing AutoWrite Node by Tim Bowman

I thought I’d share this beauty with you all.

I’m currently working as part of a two man comp team and as such we are missing so many of the lovely scripts and buttons you get when you work in a large facility. Finding this little beauty is going to save us a lot of time. It wasn’t completely plain sailing to install so I thought I would share my findings here.

The node automatically creates and names the folders to render to based on your script name.  Genius!  And a huge time saver.

The Autowrite node is written by Tim Bowman and can be downloaded from Nukepedia.

AutoWrite v1.0


It takes the existing write node and adds Python to it that works out your directory structure based on your current Nuke script location. The numbers in the window above are changed to suit your pipeline.  The node has a read out in the node graph – this gives you feedback on where the write node is going to render to.  This is a very useful feature.

The tricky part of using the node comes when you want Nuke to create the directories when they don’t already exist. Also in our two man team we wanted the write node to overwrite anything that’s there already (this last part proved difficult to find the code for).

Add the following to your file and all will be well with the world… and your Autowrite node.

def createWriteDir():
#Create dir callack
def createWriteDir():
import nuke, os, errno
file = nuke.filename(nuke.thisNode())
dir = os.path.dirname( file )
osdir = nuke.callbacks.filenameFilter( dir )
# cope with the directory existing already by ignoring that exception
os.makedirs( osdir )
except OSError, e:
if e.errno != errno.EEXIST:

It took me a while to work out this part of the puzzle.  It uses the callback Python function ‘beforeRender’.  This is run before a render is executed.  It checks if the directory structure for the write node exists and if it doesn’t it creates it.

Nuke Callbacks

Happy rendering.

Nuke – Framehold Using Current Frame

When I create a FrameHold node I’m normally on frame I want to… well… frame hold.  Therefore wouldn’t it be great if Nuke held the frame you created the FrameHold on?  Well now it can with this simple piece of Python.  Just pop it in to your file in your home/.nuke folder and off you go.

# FrameHold creation frame'Nodes').addCommand( "Time/FrameHold", "nuke.createNode('FrameHold')['first_frame'].setValue( nuke.frame() )", icon='FrameHold.png')


It uses the nuke.frame() function which calls the current frame.

Happy frame holding!

Thanks to David Emney for the heads up on this.
FrameHold default to current frame

Nuke – Backdrop Utility by Geoffroy Givry

backdrop1 Nukes backdrop feature promises to keep your scripts neat and tidy and in order… but it seems to always want to pick bright pink or fluro orange! 18% grey please Nuke!

Luckily Geoffroy Givry has come up with a nifty little python script that replaces the backdrop feature with a far superior utility.  A name can be added to the group, the font size can be adjusted and the colour always defaults to… grey!  Other muted tones can also be selected.

The python script can be downloaded from Nukepedia.

labelAutobackdrop v1.0

Place the file in your home/.nuke folder.  Then add the following to your ‘’ file which should be in same location (or create a ‘’ file if you don’t see one)…

# setup autoBackdrop in toolbar
import labelAutobackdrop
menuToolbar = nuke.toolbar('Nodes') 
menuToolbar.addCommand('Other/Backdrop', 'labelAutobackdrop.autoBackdrop()', 'Alt+m')

backdrop2There’s a script on the Nukepedia page that Givry suggests putting in to the ‘’ file.  When I tried it I couldn’t get it to work.  Anyone out there have an idea as to why?

Geoffroy Givry’s website.  Click on Python Corner to see his other scripts.

On a side note – here’s a great tutorial from David Windhorst about how to install custom menus and adjust your ‘’ file.
DW// Tutorial 01: Nuke – Install Scripts/Custom Menus

Thank you to Jason Evans for the pointers on this!

Nuke – The Hidden AutoCrop Script

This a great little script that can help to optimise your comp tree by setting the Bounding Box in an image stream.

Selecting the node your want to set the Bounding Box on.  Hit ‘X’ (to start the Script Command window) and change the script language to Python.  Then enter the following…

nukescripts.autocrop(first=None, last=None, inc=None, layer="rgba")

Nuke will run the CurveTools AutoCrop function, copy the autocropdata in to a Crop node and then delete the CurveTool.  Genius!

‘first’ and ‘last’ refer to the frame range you want to analyse.  If NONE is set it will use the Project Settings.  ‘inc’ is the increment.  ‘layer’ is the layer or layers you want to analyse.  It’s good to set it to ‘a’ (alpha) for any premulted CG you receive so you can be sure your getting all the data down stream.

I’ve created an python script to help with running this command.  It can be downloaded from Nukepedia.


Here’s a great video from The Foundry on understanding the Bounding Box…

Bounding Box – NUKE Basic Workflows