Cropping Contact Sheet

I had the pleasure of in charge of a crowd simulation development for my university third year production “As You Command”. It was a crowd for a huge hockey arena, and we got almost 30 people from the whole class to shoot green screen plate of us cheering.

This left me with about 97 green screen plates from variety of angles, action and 3 or 5 people in it. Each of them have different frame range as well. Which is a pain to process if I key them one by one. But the good news is, the green screen setup, lighting and even the position of each person in the 3 person plate, are quite identical (Thanks to James, the director knowing what we needed). And this became one of the exciting time to use a node I rarely have the pleasure to use. ContactSheet, a node that takes in multiple input and put them together in a grid of desired resolution and rows/columns. Now I’m able to put all the plates together and key them all at once! This left me with another issue however, I needed to crop each and every plate back out so that I can use them as individual particle. This is what this tool is about.

ContactSheetCrop if connected with a ContactSheet as its input, will takes in the input resolution, rows/columns and calculate the information crop node needed to crop out an input. After that user can create the “Create Crop Nodes!” button, which will create as many crop nodes as inputs of the ContactSheet node. Other than that as an additional function, user can also check “Connect to Card node” to add a card node under each crop.


Below is the code of the node. It is a NoOp node with custom knobs with expression and python. Copy paste the code below directly into nuke and the node will show up.

set cut_paste_input [stack 0]
version 10.5 v5
push $cut_paste_input
NoOp {
name Contact_Sheet_Crop
tile_color 0xa0ffff
selected true
xpos -3058
ypos -3986
addUserKnob {20 CropSettings l "Crop Settings"}
addUserKnob {12 resolution l Resolution}
resolution {{"\[knob].width/\[knob].columns"} {"\[knob].height/\[knob].rows"}}
addUserKnob {12 columnRows l Rows/Columns}
columnRows {{"\[knob].rows"} {"\[knob].columns"}}
addUserKnob {6 createCard l "Connect to Card node" t "Attach a card nord under every crop nodes, useful for particle emitter." +STARTLINE}
addUserKnob {22 crop l "Create Crop Nodes!" T "tn = nuke.thisNode()\nrc = tn\['columnRows'].value()\nrez = tn\['resolution'].value()\ncc = tn\['createCard'].value()\nr = 0\nwhile r < rc\[0]:\n c = 0\n while c < rc\[1]:\n x = rez\[0]*c\n y = rez\[1]*r\n w = rez\[0]*(c+1)\n h = rez\[1]*(r+1)\n cCrop = nuke.createNode('Crop')\n for each in nuke.allNodes():\n each.knob(\"selected\").setValue(False)\n cCrop\['box'].setValue((x, y, w, h))\n cCrop\['reformat'].setValue(1)\n if cc == 1:\n cCrop.knob('selected').setValue('True')\n nuke.createNode('Card2')\n c += 1\n r += 1\n" +STARTLINE}


Leave a Reply

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