Node Graph Tidiness
I expect your scripts to be clear and readable. This pages describes ways in which this may be achieved.
Contents
Mask and Merge Direction
Take the node arrangement on the left below: a Multiply node is being masked out by an image. This is visually similar to the merge pair on the left, in which the same image is supplying the 'A' layer in a Merge operation.
Despite their visual similarity, these two node sets do completely different things. In the first, the image is being used as a mask, in the second it is being used as a layer. The visual difference between them is the color of the node at which the two streams join (node types are color coded). But color is not as perceptually significant as shape, so it is in our interest to establish a shape-based node layout convention. The convention in OART1035 is that Masks feed in from the right, and Merges feed in from the left.
Nuke's Tidy Nodes
Nuke has a couple of nodes devoted entirely to script housekeeping.
Backdrop
A Backdrop is a flat colored sheet that can be placed behind a bunch of nodes. This is useful for making a complex script easier to read. I use backdrops in many of my. The other useful thing about a backdrop, is that its entire contents can be moved about by simply dragging on its header bar.
Backdrops can be color coded. The color coding convention this course employs is:
Color | Function |
---|---|
Grey | Mattes |
Blue | CG |
Green | Live action footage |
Yellow | Made in Nuke |
Pink | Other |
These colors are shown in the code snippet below:
Press 'Expand' and select and copy everything below this line, then paste into the Nuke node graph.
set cut_paste_input [stack 0] version 9.0 v7 BackdropNode { inputs 0 name CG tile_color 0x5f7a8701 gl_color 0x5f7a8701 label CG note_font "Arial Black" note_font_size 20 selected true xpos 6170 ypos -567 bdwidth 200 bdheight 174 } BackdropNode { inputs 0 name "Live Action" tile_color 0x51714d01 gl_color 0x51714d01 label "Live Action" note_font "Arial Black" note_font_size 20 selected true xpos 6390 ypos -567 bdwidth 200 bdheight 174 } BackdropNode { inputs 0 name Matte tile_color 0x77777701 gl_color 0x77777701 label Matte note_font "Arial Black" note_font_size 20 selected true xpos 5950 ypos -567 bdwidth 200 bdheight 174 } BackdropNode { inputs 0 name Nuke tile_color 0x87854701 gl_color 0x87854701 label Nuke note_font "Arial Black" note_font_size 20 selected true xpos 6610 ypos -567 bdwidth 200 bdheight 174 } BackdropNode { inputs 0 name Other tile_color 0xae787801 gl_color 0xae787801 label Other note_font "Arial Black" note_font_size 20 selected true xpos 6830 ypos -567 bdwidth 200 bdheight 174 }
StickNote
The StickNote note pretty much describes itself. Unlike the Backdrop, which always lays underneath nodes, the StickyNote always floats above everything. It also expands naturally to accommodate any text written into it. Cutely, it accepts simple html. An example is pasted in the snippet below:
Press 'Expand' and select and copy everything below this line, then paste into the Nuke node graph.
set cut_paste_input [stack 0] version 9.0 v7 StickyNote { inputs 0 name StickyNote5 label "This is a default stickynote\n\nNo text formating is possible. Text is always centre aligned. \nAlso, the longest line is always slightly clipped. " selected true xpos 63 ypos -994 } StickyNote { inputs 0 name StickyNote4 label "\n<b><u>This is a formated stickynote.</b></u>\n\n<b>This line is bold</b>\n\n<i>This line is italic.</i>\n\n<u>This line is underline</u>\n\n<s>Strikeout!</s>\n\n<tt>Fixed width text</tt>\n\n<font color=\"#860742\"><b>Colored text!!!!</font></b>\n\nOpen this note to see the simple markup that has been used. " selected true xpos 68 ypos -857 } StickyNote { inputs 0 name StickyNote7 label "<bongo>\nThis is Nuke's odd interpretation of HTML bahaviour.\nAny word placed within two arrow marks forces the text to align in a \nmore appealing style. " selected true xpos 62 ypos -928 }
Dot
A Dot can be added to any arrow that runs between nodes. This can be used to maintain tidiness. One general rule of node graph tidiness is that arrows should run vertically or horizontally, not diagonally. Using dots, labels can also be added to a node graph. To add a dot, hold down the 'command' key and click the yellow dot that appears. The snippet below shows some dots in use:
Press 'Expand' and select and copy everything below this line, then paste into the Nuke node graph.
set cut_paste_input [stack 0] version 9.0 v7 Constant { inputs 0 channels rgb name Constant1 selected true xpos -4245 ypos 164 } Dot { name Dot31 label "This dot is being used to hold text.\nThe dots beneath are being used to fork a feed. " note_font_size 20 note_font_color 0x6aff55ff selected true xpos -4211 ypos 283 } Dot { name Dot29 selected true xpos -4213 ypos 344 } set N11ddc8d0 [stack 0] Dot { name Dot30 selected true xpos -4433 ypos 344 } Multiply { name Multiply1 selected true xpos -4467 ypos 433 } push $N11ddc8d0 Add { name Add1 selected true xpos -4247 ypos 433 } push $N11ddc8d0 Dot { name Dot32 selected true xpos -3993 ypos 344 } Gamma { name Gamma1 selected true xpos -4027 ypos 433 } push $cut_paste_input Dot { name Dot2 label "<td style width = \"20%\">\nThis dot is being used to hold floating text. Using a simple HTML tag, It is configured to not require manual paragraph breaks! A real time-saver. \n\n\"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?\"\n" note_font_size 20 note_font_color 0x6aff55ff selected true xpos -4374 ypos 706 }
Group
Many nodes can be grouped together by first selecting them, then 'command 'G'. The nodes will be replaced by a simple group node. Its contents are accessible by opening its properties and pressing the 'S' in the top bar. An example of a Group is shown here.
OART1035 Node Graph Conventions
Scripts should be readable: laid out in a rational and consistent manner. This is to enable their easy reading by you and anyone else who might review your script (e.g. me). I propose the following general style guidelines for the Node graph:
- Masks feed in from the right, Merges feed in from the left.
- Favour vertical and horizontal connections over diagonal ones. Dots can be used to make this happen.
- Backdrops should be color coded according to their content (e.g. CG generated elements, live action footage, Trackers etc).
- Label everything (using Dots, StickyNotes, BackDrops etc)
- Follow the backdrop coloring conventions.
- Do not rename the function element of a node. e.g. do not rename Multiply1 to 'shadow_make'. This can make a script difficult to read.