$gui, and how to use it?

Categories Back To Basics, Nuke, Workflow

$gui is a simple TCL expression that tells Nuke to process a value differently in the Viewer (or “gui”) vs. when rendering on the render farm.

To use it, simply right-click on any knob in Nuke, choose “Add expression”, and enter $gui in the expression field.

You will see this returns a value of 1, meaning Nuke has detected we’re currently looking at this node in the Viewer. When you send this job to the farm, this value will be switched to 0.

As you might have already figured out, you can use this expression to increase the working speed of a heavy Nuke script! By having your heavy nodes render only on the farm, and viewing a simplified, fast-processing proxy in the viewer, you can use the $gui expression in a Switch node to automagically toggle between the two! See the image below for a visual example.

Let’s take this one step further. What happens when the value of the knob needs to be something other than 0 or 1? A lot of the time, I’ll use a $gui expression to increase motionblur samples in the ScanlineRender node to keep things speedy whilst I’m working, but smooth and nice when it’s rendered. As in the image below, you can see the expression has a little extra spice added to the end. $gui?1:12 simply reads as if viewing in the gui, use the first number. Although if rendering on the farm, use the second number. This will process 1 motionblur sample when I’m working in Nuke, but 12 samples once it’s rendered!

As with any new knowledge, you should ask yourself, “when would this be more detrimental than helpful, or when should I not use this?” The answer is, if you have to share a nuke script, a $gui expression can be quite painful for another artist to find. The best way to deal with this is to always label a node with a $gui expression, and be diligent about removing $gui expressions when you no longer need to use them. This node, put together by Jedediah Smith, is incredibly useful when handling these situations.

How else could you use this simple expression to improve your workflow?

3 thoughts on “$gui, and how to use it?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.