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.

MB_NukeRender_1v1.zip

Happy rendering!

Avid DNX Quick Look Fix for OSX

This is a great tip for all pro users of the Avid DNX codec.

From Mavericks onwards it has not been possible to use Quick Look to preview Avid DNX Quicktimes.  This great tip from janusz though points out that you can transplant the necessary Quick Look files from a Mountain Lion machine and voila… you can preview to your hearts content!  There is also a link in the forum to the Mountain Lion files incase you don’t have access to them.

Recovering Quicklook for DNxHD on OS X 10.9-10.10

Sys – Automatically Mount Server Using AppleScript

I recently discovered you can set your Mac to automatically mount a server when you start up.  Just drag the mounted server from your desktop to your ‘Login Items’ in your ‘User & Groups’ panel in ‘System Preferences’… and voila!

However it also opens a finder window directed at the server even when you click the ‘hide’ check box.  I started thinking of a way to do this with AppleScript, a language that I’m slowly getting more and more comfortable with.

What’s nice is that you can add saved AppleScripts to your ‘Login Items’.  Finder will then run the script at login.

I started by trying the following script which connects to the server and then closes the window.  Server path and server name are found by hitting cmd+i when your server is mounted and selected from your desktop.  My path for example starts with ‘afp://’.

#Connect to server.
tell application "Finder" to open location "server path/server name"
#Wait until the window opens.
delay 10
#Close window.
tell application "Finder" to close Finder window "server name"

This works perfectly but only at work.  When I’m at home and I can’t connect to the server the script will return an error when it can’t find the window (because the server has not been connected). So yesterday on the cycle home I’m thinking… ‘what I need here is an ‘IF’ statement.

An ‘IF’ statement is a way of saying – if a certain set of circumstances are true
then do this command other wise do this command instead. It’s perfect for this script as I want Finder to first check if the window is open. If it is open then close it otherwise do nothing and don’t return an error.

You can download my AppleScript here… MB_ConnectToServer_v01

And here’s my final code…

tell application "Finder" to open location "server path/server name"
#Wait until the window opens.
delay 10
#Close the window if it exists, if it doesn't do nothing.
tell application "Finder"
      if Finder window "server name" exists then
           tell application "Finder" to close Finder window "server name"
      end if
end tell

Focus, Breaks and Memory

In an effort to be more productive at work I’ve been looking at my focus and how I can improve it.

Man-MeditatingOne of the big things that has helped me on this quest is meditating each morning. I use an app called Headspace which leads you through various types of mediation for a variety of things you might want to achieve. The pack on focus really helped me understand now focus works and that getting distracted is unavoidable but that it can be lessened.

Surprisingly the other thing that has helped my focus at work is having more breaks! An app call BreakTime runs on my Mac and tells me when I have been working at my computer for an hour. When it goes off I get up, walk to get a glass of water, make a cup of tea (my favourite kind of break), anything that isn’t sitting at my desk. It not only means that I remember to take a break every hour (which is very good for your back, posture and eyesight) it also means that in that hour at the computer I do nothing but work… no Facebook, no email, no web browsing, no distractions.

I’ve also turned off all the notifications on my iPhone which is hugely liberating.  Rather than being a slave to the thing as it lights up and tells me I have a message I now choose when to respond.

Understanding my focus has had the unforeseen consequence of improving my memory.  By having set times to do certain tasks my brain seems less overwhelmed and is therefore much more willing to remember!

As with any lifestyle change it’s all about repeating it until it becomes habit…  watch this space.

Nuke – Applescript Droplet to Render Nuke Scripts in Terminal

MB_NukeRender

**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.

MB_NukeRender

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.

error

Nuke – Disabling All Motion Blur in Your Script

In Shake you used to be able to disable all motion blur that was being added in your script.  It was super useful as it meant you could turn the motion blur off to do colour work etc and then turn it back on when it came time to render.  Sadly Nuke does not have this function.  However you can run the following piece of code from the Script Editor and it will set all motion blur in your Transform nodes to ‘0’.

Be careful with this however… as when you come to turn the motion blur back on it will set ‘1’ in ALL your Transform nodes that have a motion blur setting… which you possibly didn’t want!

To turn all motion blur off…

x=nuke.allNodes()
for n in x:
     try:
          n['motionblur'].setExpression("0")
     except:
          pass

To turn all motion blur on…

x=nuke.allNodes()
for n in x:
     try:
          n['motionblur'].setExpression("1")
     except:
          pass

**UPDATE**mb

Thinking on this a little further I feel I’ve come up with a better solution and most importantly a much simpler one.

Create a Switch node and then expression link it to the motion blur knob in your Transform nodes (Switch1.which for example). Just change the Switch from ‘0’ to ‘1’ to turn the motion blur on and vice versa to turn it off. That way you can be a lot more selective about which motion blur settings your changing.

**UPDATE 15/01/16**

Today I came up with an even simpler way to achieve this.  Link the motion blur knob to the disable knob in the Switch.  Just disabling the Switch in the gui will turn the motion blur off.  Place the following in the motion blur expression window…

!Switch1.disable

The ‘!’ is needed to invert the result as ‘1’ is returned when the Switch is disabled.