Skip to content

Instantly share code, notes, and snippets.

@jedypod
Created February 16, 2020 20:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jedypod/45c3d297a6c166dd50189cfd25b90fa6 to your computer and use it in GitHub Desktop.
Save jedypod/45c3d297a6c166dd50189cfd25b90fa6 to your computer and use it in GitHub Desktop.
PWorld to STMap Example
set cut_paste_input [stack 0]
version 12.0 v4
Camera2 {
inputs 0
translate {{curve x1 0.1968241632 s0 x20 1.389938712 s0} {curve x1 0.6442195177 s0 x20 0.4735943973 s0} {curve x1 5.948436737 s0 x20 7.470496655 s0}}
rotate {{curve x1 2.000000954 s0 x20 0.8000015616 s0} {curve x1 7.399996758 s0 x20 6.199992657 s0} {curve x1 2.669668575e-08 s0 x20 -1.334151278e-08 s0}}
name Camera1
selected true
xpos -140
ypos -918
}
set Nb8c7010 [stack 0]
CheckerBoard2 {
inputs 0
boxsize 26
centerlinewidth 0
name CheckerBoard1
selected true
xpos 180
ypos -1138
postage_stamp false
}
Card2 {
image_aspect false
scaling {2.441600323 1 1}
control_points {3 3 3 6
1 {-0.5 -0.5 0} 0 {0.1666666865 0 0} 0 {0 0 0} 0 {0 0.1666666865 0} 0 {0 0 0} 0 {0 0 0}
1 {0 -0.5 0} 0 {0.1666666716 0 0} 0 {-0.1666666716 0 0} 0 {0 0.1666666865 0} 0 {0 0 0} 0 {0.5 0 0}
1 {0.5 -0.5 0} 0 {0 0 0} 0 {-0.1666666865 0 0} 0 {0 0.1666666865 0} 0 {0 0 0} 0 {1 0 0}
1 {-0.5 0 0} 0 {0.1666666865 0 0} 0 {0 0 0} 0 {0 0.1666666716 0} 0 {0 -0.1666666716 0} 0 {0 0.5 0}
1 {0 0 0} 0 {0.1666666716 0 0} 0 {-0.1666666716 0 0} 0 {0 0.1666666716 0} 0 {0 -0.1666666716 0} 0 {0.5 0.5 0}
1 {0.5 0 0} 0 {0 0 0} 0 {-0.1666666865 0 0} 0 {0 0.1666666716 0} 0 {0 -0.1666666716 0} 0 {1 0.5 0}
1 {-0.5 0.5 0} 0 {0.1666666865 0 0} 0 {0 0 0} 0 {0 0 0} 0 {0 -0.1666666865 0} 0 {0 1 0}
1 {0 0.5 0} 0 {0.1666666716 0 0} 0 {-0.1666666716 0 0} 0 {0 0 0} 0 {0 -0.1666666865 0} 0 {0.5 1 0}
1 {0.5 0.5 0} 0 {0 0 0} 0 {-0.1666666865 0 0} 0 {0 0 0} 0 {0 -0.1666666865 0} 0 {1 1 0} }
name Card1
selected true
xpos 180
ypos -1042
}
TransformGeo {
translate {0 0 -0.7440000176}
rotate {-89.84748438 0 0}
scaling {2.128740311 3.130251646 1}
name TransformGeo1
selected true
xpos 180
ypos -1016
}
EditGeo {
keys {{30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80}
}
values {{-1.685821371e-09 -0.01106740534 -0.007104065269 -1.784769132e-08 -0.1008593366 -0.07365062088 -2.621079886e-08 -0.1490582675 -0.1169458926 -2.801844268e-08 -0.1490582675 -0.1169458926 -2.440315683e-08 -0.1490582675 -0.1169458926 -2.440315683e-08 -0.1490582675 -0.1169458926 -1.606292876e-08 -0.01350362599 -0.06680483371 -2.440316571e-08 -0.03926680982 -0.1040405408 -2.440316571e-08 -0.0497677587 -0.1040405408 -6.177496914e-08 -0.08078400791 -0.2472383082 -1.207388891e-07 -0.06042295694 -0.5527973771 -1.525545343e-07 -0.07276406139 -0.6993016601 -1.525545343e-07 -0.123090893 -0.6993016601 -1.328700563e-07 -0.1305913478 -0.6993016601 -1.328700563e-07 -0.1305913478 -0.6993016601 -1.086650059e-07 0.3711647093 -0.3923165202 -1.328700563e-07 0.4348895848 -0.4723611474 -1.328700563e-07 0.4348895848 -0.4723611474 -1.525545343e-07 0.4348895848 -0.4723611474 -1.844537536e-07 0.4844827354 -0.5789090395 -2.160668373e-07 0.5001932979 -0.6918813586 -2.309679985e-07 0.4408688843 -0.6918813586 -2.011656761e-07 0.4284207523 -0.6918813586 -2.011656761e-07 0.4284207523 -0.6918813586 -1.660083768e-07 0.7886533737 -0.2492276132 -2.011656761e-07 0.8963392377 -0.2440403104 -2.011656761e-07 0.8963392377 -0.2440403104 -2.011656761e-07 0.8963392377 -0.2440403104 -2.086162567e-07 0.880851388 -0.2440403104 -2.011656761e-07 0.8478915095 -0.2440403104 -2.011656761e-07 0.8308121562 -0.2440403104 -2.011656761e-07 0.8308120966 -0.2440402508 -2.011656761e-07 0.8308120966 -0.2440402508 -2.011656761e-07 1.23320353 0.2038009763 -2.011656761e-07 1.23320353 0.2038009763 -2.011656761e-07 1.233203769 0.2038009763 -2.011656761e-07 1.233203769 0.2038009763 -2.011656761e-07 1.233203769 0.2038009763 -2.011656761e-07 1.233203769 0.2038009763 -2.011656761e-07 1.233203769 0.2038009763 -2.011656761e-07 1.233203769 0.2038009763 -2.011656761e-07 1.233203769 0.2038009763 -2.011656761e-07 1.635594964 0.6516425014 -2.011656761e-07 1.635594964 0.6516425014 -2.011656761e-07 1.635594964 0.6516425014 -2.011656761e-07 1.635594964 0.6516425014 -1.937150955e-07 1.635594964 0.6516425014 -1.862645149e-07 1.635594964 0.6516425014 -2.011656761e-07 1.635594964 0.6516425014 -2.011656761e-07 1.635594726 0.6516425014 -2.011656761e-07 1.635594726 0.6516425014}
}
translate {-0.6652314663 0.4199999869 -1.587630033}
name EditGeo1
selected true
xpos 180
ypos -970
}
push $cut_paste_input
Reformat {
format "1920 1080 0 0 1920 1080 1 HD_1080"
name Reformat1
selected true
xpos 400
ypos -904
}
add_layer {PWorld PWorld.red PWorld.green PWorld.blue PWorld.alpha}
add_layer {NWorld NWorld.red NWorld.green NWorld.blue NWorld.alpha}
ScanlineRender {
inputs 3
conservative_shader_sampling false
samples 12
shutteroffset centred
motion_vectors_type distance
output_shader_vectors true
P_channel PWorld
N_channel NWorld
name ScanlineRender1
selected true
xpos 180
ypos -898
}
Dot {
name Dot1
label " "
note_font "Helvetica Bold"
note_font_size 24
note_font_color 0xa5a5a501
selected true
xpos 214
ypos -774
}
set Nb6c9ac0 [stack 0]
Shuffle {
in PWorld
name Shuffle1
label "\[value in] -> \[value out]"
selected true
xpos 400
ypos -784
}
StickyNote {
inputs 0
name StickyNote3
tile_color 0x40454aff
label "<pre>\npretend this is a cg render wtih pworld and \nmotion vectors"
selected true
xpos 81
ypos -866
}
StickyNote {
inputs 0
name StickyNote4
tile_color 0x40454aff
label "<pre>\nthe camera that rendered the cg"
selected true
xpos -204
ypos -986
}
StickyNote {
inputs 0
name StickyNote2
tile_color 0x40454aff
label "<pre>\nwarp a still image created on the reference frame\nto track with the camera (think dmp)"
selected true
xpos -422
ypos -626
}
StickyNote {
inputs 0
name StickyNote1
tile_color 0x40454aff
label "<pre>\ngenerate stmap from PWorld, \ngiven a reference frame"
selected true
xpos -201
ypos -722
}
StickyNote {
inputs 0
name StickyNote5
tile_color 0x40454aff
label "<pre>\napply motionblur using a vectorblur from\nthe rendered motionvectors"
selected true
xpos -240
ypos -194
}
push $Nb6c9ac0
Dot {
name Dot2
label " "
note_font "Helvetica Bold"
note_font_size 24
note_font_color 0xa5a5a501
selected true
xpos 214
ypos -390
}
set Nc9a6da0 [stack 0]
Dot {
name Dot3
label " "
note_font "Helvetica Bold"
note_font_size 24
note_font_color 0xa5a5a501
selected true
xpos -6
ypos -390
}
set N31d457a0 [stack 0]
push $N31d457a0
push $Nb8c7010
push $Nb6c9ac0
Group {
inputs 2
name PWorld_to_STMap
selected true
xpos -150
ypos -778
addUserKnob {20 PWToSTMap}
addUserKnob {41 ppos t "point position pass" T ShufflePW.in}
addUserKnob {3 reference_frame l "reference frame"}
reference_frame 5
addUserKnob {22 set_current l Current -STARTLINE T nuke.thisNode().knob('reference_frame').setValue(nuke.frame())}
}
Input {
inputs 0
name InputPW
label "\[value number]"
xpos -40
ypos -760
}
Shuffle {
in PWorld
name ShufflePW
label "\[value in]"
xpos -40
ypos -688
}
Unpremult {
name Unpremult1
xpos -40
ypos -610
}
Expression {
temp_name0 R
temp_expr0 CAM_ORIG.world_matrix.3
temp_name1 G
temp_expr1 CAM_ORIG.world_matrix.7
temp_name2 B
temp_expr2 CAM_ORIG.world_matrix.11
expr0 r-R
expr1 g-G
expr2 b-B
name Expression14
label "translate Pworld to camera"
xpos -40
ypos -520
}
ColorMatrix {
matrix {
{{CAM_ORIG.world_matrix.0(parent.reference_frame)} {CAM_ORIG.world_matrix.1(parent.reference_frame)} {CAM_ORIG.world_matrix.2(parent.reference_frame)}}
{{CAM_ORIG.world_matrix.4(parent.reference_frame)} {CAM_ORIG.world_matrix.5(parent.reference_frame)} {CAM_ORIG.world_matrix.6(parent.reference_frame)}}
{{CAM_ORIG.world_matrix.8(parent.reference_frame)} {CAM_ORIG.world_matrix.9(parent.reference_frame)} {CAM_ORIG.world_matrix.10(parent.reference_frame)}}
}
invert true
name ColorMatrix1
label "Rotate to camera"
xpos -40
ypos -448
}
Multiply {
channels rgb
value {1 1 -1 1}
name Multiply13
label "reverse Z"
xpos -40
ypos -376
}
Expression {
expr2 b<0?0:b
name Expression15
label "clip Z behind cam"
xpos -40
ypos -304
}
Expression {
temp_name0 h_tan
temp_expr0 "(h_apert /2) / focal"
temp_name1 v_tan
temp_expr1 "(v_apert /2) / focal"
expr0 "0.5 + 0.5 * r / h_tan / b"
expr1 "0.5 + 0.5 * g / v_tan / b"
expr2 0
channel3 {none none none -rgba.alpha}
name Expression16
label CameraUVs
xpos -40
ypos -208
addUserKnob {20 "" l User}
addUserKnob {26 "" l "camera settings"}
addUserKnob {7 focal l "focal length" t "Link to projecting camera's focal length" R 0 100}
focal {{parent.CAM_ORIG.focal}}
addUserKnob {7 h_apert l "horiz aperture" t "Link to projecting camera's horizontal aperture" R 0 50}
h_apert {{parent.CAM_ORIG.haperture}}
addUserKnob {7 v_apert l "vert aperture" t "Link to projecting camera's vertical aperture" R 0 50}
v_apert {{parent.CAM_ORIG.vaperture}}
}
Expression {
expr3 "(r<0 || r>1 || g<0 || g>1)?0:a"
name Expression17
label "clamp projection to cam frustum"
xpos -40
ypos -112
}
Output {
name Output1
xpos -40
ypos -10
}
Input {
inputs 0
name InputCamera
label "\[value number]"
xpos -370
ypos -760
number 1
}
Camera2 {
inputs 0
display off
xform_order {{"\[topnode input1].knob.xform_order"}}
rot_order {{"\[topnode input1].knob.rot_order"}}
translate {{"\[exists parent.input1] ? \[topnode this.parent.input1].translate(parent.reference_frame) : 0"} {"\[exists parent.input1] ? \[topnode this.parent.input1].translate(parent.reference_frame) : 0"} {"\[exists parent.input1] ? \[topnode this.parent.input1].translate(parent.reference_frame) : 0"}}
rotate {{"\[exists parent.input1] ? \[topnode this.parent.input1].rotate(parent.reference_frame) : 0"} {"\[exists parent.input1] ? \[topnode this.parent.input1].rotate(parent.reference_frame) : 0"} {"\[exists parent.input1] ? \[topnode this.parent.input1].rotate(parent.reference_frame) : 0"}}
scaling {{"\[exists parent.input1] ? \[topnode this.parent.input1].scaling(parent.reference_frame) : 0"} {"\[exists parent.input1] ? \[topnode this.parent.input1].scaling(parent.reference_frame) : 0"} {"\[exists parent.input1] ? \[topnode this.parent.input1].scaling(parent.reference_frame) : 0"}}
uniform_scale {{"\[exists parent.input1] ? \[topnode this.parent.input1].uniform_scale(parent.reference_frame) : 0"}}
skew {{"\[exists parent.input1] ? \[topnode this.parent.input1].skew(parent.reference_frame) : 0"} {"\[exists parent.input1] ? \[topnode this.parent.input1].skew(parent.reference_frame) : 0"} {"\[exists parent.input1] ? \[topnode this.parent.input1].skew(parent.reference_frame) : 0"}}
pivot {{"\[exists parent.input1] ? \[topnode this.parent.input1].pivot(parent.reference_frame) : 0"} {"\[exists parent.input1] ? \[topnode this.parent.input1].pivot(parent.reference_frame) : 0"} {"\[exists parent.input1] ? \[topnode this.parent.input1].pivot(parent.reference_frame) : 0"}}
projection_mode {{"\[topnode input1].knob.projection_mode"}}
focal {{"\[exists parent.input1] ? \[topnode this.parent.input1].focal(parent.reference_frame) : 0"}}
haperture {{"\[exists parent.input1] ? \[topnode this.parent.input1].haperture(parent.reference_frame) : 0"}}
vaperture {{"\[exists parent.input1] ? \[topnode this.parent.input1].vaperture(parent.reference_frame) : 0"}}
far 900000
name CAM_ORIG
xpos -360
ypos -534
}
end_group
ColorWheel {
inputs 0
centerValue 0
gamma 0.45
name ColorWheel1
selected true
xpos -403
ypos -562
postage_stamp false
}
STMap {
inputs 2
channels rgba
uv rgb
name STMap1
selected true
xpos -150
ypos -562
}
Unpremult {
name Unpremult1
selected true
xpos -150
ypos -440
}
Merge2 {
inputs 2
operation mask
bbox intersection
name Merge2
selected true
xpos -150
ypos -394
}
Copy {
inputs 2
channels forward
name Copy1
selected true
xpos -150
ypos -358
}
Premult {
name Premult1
selected true
xpos -150
ypos -274
}
VectorBlur2 {
channels rgba
uv forward
scale 11.4
motion_falloff 1
name VectorBlur1
selected true
xpos -150
ypos -112
}
push $Nc9a6da0
Merge2 {
inputs 2
bbox B
name Merge1
selected true
xpos 180
ypos -106
}
Dot {
name Dot4
label " "
note_font "Helvetica Bold"
note_font_size 24
note_font_color 0xa5a5a501
selected true
xpos 214
ypos 66
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment