Using Paths and Masks

In the New 3D system, Path and Mask knobs are available for nodes that create or import geometry, and allow you to specify where imported objects live in Nuke's Scene Graph based hierarchy. This guide explains how to set paths and masks, and works through some more advanced workflows involving CEL, which may help with organizing your 3D scene.

Path Knobs

Path knobs allow you to specify which parts of your Scene Graph you want to affect. When inserting a 3D node to modify geometry such as GeoCard, the Path knob defaults to {nodename}. This expression is created by Nuke, to make sure that unique ID is always created and you don't have to worry about populating this yourself if you don't want to.

Tip:  Using the default {nodename} can help speed up geometry creation.

Custom Paths

If you would like to customize where your geometry lives in your Scene Graph, you can do this by typing to edit the Path field.

For example, here we have added a couple of higher levels in the hierarchy above the Card which has been named Card001.

This hierarchy is automatically updated in the Scene Graph and any missing parents are automatically created.

If you then create a second object like a Cube, and edit the Path to be under the same hierarchy, you’ll be able to connect it directly under the GeoCard node without the need for a Merge node, similar to how Nuke's 2D nodes function.

Mask Knobs

You can find the Mask knob in modifier nodes such as GeoTransform. The Mask knob is a dropdown, allowing you to select the prims you want to affect. You can choose the most appropriate mask from a range of common options or choose your own Custom mask.

You may not necessarily need to change this as the Default option selects the default prim(s) for the node - this will be the injected mask prim paths if there is an upstream node with Inject Mask enabled, otherwise the default mask for this node type is evaluated.

All roots option is a convenient way to have this node just affect the top most level Xforms in your Scene Graph.

For example, if you have both a Card and a Cube, this expression is telling the GeoTransform node to select all objects in Scene001:

All Meshes, All Lights and All Cameras works in the same way, but with added specificity on the prim type for those nodes related to certain types of prims.

Tip:  The All roots and All Meshes options can help to avoid issues with ordering in the node graph as it selects all objects in the hierarchy.

Underneath the Mask dropdown, the mask field automatically updates based on your selection in the dropdown, helping to show how the mask is being created with expression language, and allowing for easier manual editing if needed.

In this case, the field underneath displays /* as this is the equivalent expression for All roots. This expression essentially says to select everything from the root of the scene graph down and therefore we are able to modify all nodes in the chain.

Note:  We could also manually add objects to the Mask path by dragging and dropping them from the Scene Graph, picking from the Scene Graph or Viewer, or copying your current selection. For more about this, see Using Masks and Paths in the Scene Graph.

To help with setting up masks, there are several Select Path Mask buttons to the right of the mask field.

Copy prim paths from the prims you currently have selected
Select prims in the Viewer using the eyedropper tool
Using the Scene Graph picker, which opens a pop up scene graph
Select all the prims of your mask in the Scene Graph and in the Viewer, helping you to understand what your mask is acting on

Using Masks Downstream

You may wish to reuse the same masks further down the node graph. You can enable the Inject Mask checkbox to push the mask in the current node is to the geo nodes below it that have the Default mask set.

In this example we have two prims in our scene, a Cube and a Cylinder. We have set the GeoTransform Mask to act on the Cylinder only and want to reuse this Mask for a GeoDuplicate node downstream:

GeoMask node is an alternative way to set a mask downstream. For GeoMask, the Mask should be set manually. When connected to other nodes downstream, the Mask is pushed onwards to all nodes below it.

Tip:  The prim your Mask is directed towards will show on the GeoMask node label for easy identification.

Note:   You can then clear this at any point by using a GeoClearMask node.

Advanced Path and Mask Workflows

You can create more complex selections with these knobs using expressions and tokens. The knob expression language is based on a simplified version of the Cell Expression Language (CEL) which is what we use in our sister product Katana.

For example, GeoTransform is a geo modifier node, so the Mask knob defaults to the option All roots. With the expression /*, all we're doing is using / to say go to the root of the scene graph hierarchy and then * to indicate we want to select everything underneath the root.

We can expand on this selection by using * to indicate select everything with a given text string.

For example, taking a simple scene with various types of meshes:

We could edit the mask field in a variety of ways:

Expression

What it does

/scene/objects/cube1

Selects the single object “cube1”

/scene/objects/cube* Selects all the cubes in the “objects” folder
//cube* Selects any Leaf node starting with “cube”
/scene//cube1 Select anything called “cube1” inside of “scene”

Note:  These edits will set the Mask to Custom.

You are also able to add and subtract and add expressions or paths to one another.

For example:

Expression

What it does

//cube* - /scene/objects/cube1

Selects all the cubes except for “cube1”

//cube* + //sphere* Selects all the cubes and all the spheres
//*telescope* Selects all Leaf prims with telescope in the name
//*telescope*// Selects all prims with telescope in the name plus their descendants
/scene/$lights Selects all prims in the collection called “lights” on the object “scene”

For example, filling in this expression means “selects all the cubes except for “cube1”. Clicking the Select Mask Path button would only select cube2 in the Scene Graph.