CompStart

ProLessonsCoursesElementsSoftware

CompStart

Learn visual effects with cutting-edge techniques.

Learning

CoursesLessonsPro FeaturesAssetsSoftware

Tools

Tech CheckDisplay CheckMotion BlurPhysLightNuke Tools

Company

InstructorMissionSitemapPrivacyTerms

Projects

Moray RenderEXR ConverterOCIO.ccNuke ToolsDerekVFX

Follow

YouTubeInstagramTikTokThreadsContact

© 2026 CompStart. All rights reserved.

Sample2 Node

ToolSets / Utility
Utility

2026-09-07

ToolSets/utility/sample2Node.nk

utility
3d
position
sample
card
axis
light
View on GitHub

Sample a 3D position from a chosen channel and create Card, Card3D, Axis, or Light nodes at that translate.

Sample2 Node reads a 3D position from an input channel (default P_lig) and exposes it as a pick value you can use in the comp.

Use it when a position pass or similar XYZ data should drive placement of simple 3D scene nodes. Choose the source channel, then use the Card, Card3D, Axis, or Light controls to create the matching node with translate set from the current pick.

The group shuffles the selected channel into the pick path and passes the stream through so it sits cleanly in a utility chain without changing the image.

Script code

set cut_paste_input [stack 0]
version 12.1 v4
push $cut_paste_input
add_layer {P_lig P_lig.X P_lig.Y P_lig.Z}
Group {
 name sample2Node
 tile_color 0x421010ff
 selected true
 xpos -1148
 ypos 1140
 addUserKnob {20 User l sample2Node}
 addUserKnob {41 in l channel T Shuffle1.in}
 addUserKnob {41 pick l sample T NoOp1.pick}
 addUserKnob {22 Card T "import nuke\n\nvalue = nuke.thisNode().knob('pick').getValue()\n\nnuke.root().begin()\n\nnode = nuke.createNode('Card2')\n\nnode\['translate'].setValue(value)" +STARTLINE}
 addUserKnob {22 Card3D -STARTLINE T "import nuke\n\nvalue = nuke.thisNode().knob('pick').getValue()\n\nnuke.root().begin()\n\nnode = nuke.createNode('Card3D')\n\nnode\['translate'].setValue(value)"}
 addUserKnob {22 Axis -STARTLINE T "import nuke\n\nvalue = nuke.thisNode().knob('pick').getValue()\n\nnuke.root().begin()\n\nnode = nuke.createNode('Axis2')\n\nnode\['translate'].setValue(value)"}
 addUserKnob {22 Light -STARTLINE T "import nuke\n\nvalue = nuke.thisNode().knob('pick').getValue()\n\nnuke.root().begin()\n\nnode = nuke.createNode('Light2')\n\nnode\['translate'].setValue(value)"}
 addUserKnob {26 ""}
 addUserKnob {26 lbl l "" +STARTLINE T "Sample2Node v1.0"}
 addUserKnob {22 btn l DerekVFX.ca T "nuke.tcl('start', 'https://derekvfx.ca')" +STARTLINE}
}
 Input {
  inputs 0
  name Input
  xpos 447
  ypos 61
 }
set Ndce0400 [stack 0]
 Output {
  name Output1
  xpos 447
  ypos 1055
 }
push $Ndce0400
 Shuffle {
  in P_lig
  name Shuffle1
  label "\[value in]"
  xpos 272
  ypos 219
 }
 NoOp {
  name NoOp1
  xpos 272
  ypos 282
  hide_input true
  addUserKnob {20 User}
  addUserKnob {18 pick}
  pick {43.7382431 12.38535595 -108.212326}
  addUserKnob {6 pick_panelDropped l "panel dropped state" -STARTLINE +HIDDEN}
 }
end_group