top of page

Procedural ST Map

Here is a really quick and easy tool to make ST maps procedurally based on the input resolution.


We can easily create a procedural ST map using the width and height expressions.



First I Create two ramps, one for the X axis, and one for the Y axis. The X being red and the Y being green.


In the point 1 X position we add an expression for the width.

Next I do the same for the Y axis.


In the point 1 Y axis add an expression for the height.


We could now plus these together and we would get an ST map! but what happens if we need space outside of the ST map to be manipulated which is common for lens distortion.

In this case we can multiply the values of both the X and the Y values by 2 so we have a range from 0 to 2 on out ramp.

Next we can subtract the value by 0.5 (in this case we use the add node with a value of 0.5 to achieve this)


this means our range is now -0.5 to 1.5 giving us a padding of 0.5.

Next we can add the Red channel from the X axis and the Green channel from the Y Axis to give us out ST Map with the padding.

I then shuffle white into the alpha so we have a solid alpha so we don't get any odd opacity issues when plugging in the plate.

And finally we can scale the ST map by 2 to remove the padding from the image but maintain it in the bounding box. Make sure to set the center for X to width/2 and for Y height/2


And now you have a fully procedural ST map generator. you can go ahead and plug any plate into this and it will automatically create an ST map.


Here is the tool, just copy this text and paste it into your nuke:




set cut_paste_input [stack 0]
version 13.1 v2
push $cut_paste_input
Group {
 name STMap
 selected true
 xpos 994
 ypos -140
}
 Input {
  inputs 0
  name Input1
  xpos 4273
  ypos -50
 }
 Dot {
  name in
  label in
  xpos 4307
  ypos 54
 }
set Ne591000 [stack 0]
 Ramp {
  output {rgba.red -rgba.green -rgba.blue rgba.alpha}
  cliptype none
  replace true
  p0 {0 0}
  p1 {{width} 0}
  name x
  xpos 4159
  ypos 58
 }
 Multiply {
  value 2
  name Multiply1
  xpos 4159
  ypos 103
 }
 Add {
  value -0.5
  name Add1
  xpos 4159
  ypos 139
 }
push $Ne591000
 Ramp {
  output {-rgba.red rgba.green -rgba.blue rgba.alpha}
  replace true
  p0 {0 0}
  p1 {0 {height}}
  name y
  xpos 4383
  ypos 57
 }
 Multiply {
  value 2
  name Multiply2
  xpos 4383
  ypos 93
 }
 Add {
  value -0.5
  name Add2
  xpos 4383
  ypos 129
 }
 Merge2 {
  inputs 2
  operation plus
  Achannels {rgba.red -rgba.green -rgba.blue rgba.alpha}
  Bchannels {-rgba.red rgba.green -rgba.blue rgba.alpha}
  output {rgba.red rgba.green -rgba.blue rgba.alpha}
  name Plus
  xpos 4268
  ypos 211
 }
 Shuffle2 {
  fromInput1 {{0} B}
  fromInput2 {{0} B}
  mappings "4 rgba.red 0 0 rgba.red 0 0 rgba.green 0 1 rgba.green 0 1 rgba.blue 0 2 rgba.blue 0 2 white -1 -1 rgba.alpha 0 3"
  name shuffle_alpha
  xpos 4268
  ypos 247
 }
 Transform {
  scale 2
  center {{width/2} {height/2}}
  black_outside false
  name Transform1
  xpos 4268
  ypos 279
 }
set N7d9eb400 [stack 0]
 Dot {
  name out
  label out
  xpos 4302
  ypos 345
 }
 Output {
  name Output1
  xpos 4268
  ypos 478
 }
push $N7d9eb400
 Viewer {
  frame_range 1-100
  name Viewer1
  xpos 3904
  ypos 82
 }
end_group





bottom of page