CompStart

ProLessonsCoursesElementsSoftware

CompStart

Master visual effects with cutting-edge techniques.

Learning

CoursesLessonsPro FeaturesAssetsSoftware

Tools

Tech CheckDisplay CheckMotion BlurCIE 1931PhysLightNuke Tools

Company

InstructorMissionImpressumPrivacyTerms

Projects

Moray RenderEXR ConverterOCIO.ccNuke ToolsDerekVFX

Follow

YouTubeInstagramTikTokThreadsContact

© 2026 CompStart. All rights reserved.

Normal World To Camera

ToolSets / Draw
Draw

2026-09-07

ToolSets/draw/normalWorldToCamera.nk

normals
camera
transform
utility
draw
world space
camera space
View on GitHub

Transforms world-space normals into camera space using a connected camera’s world matrix, with optional 0–1 packed output.

Normal World To Camera converts a world-space normal map into camera space. Pipe normals into the first input and a Camera into the second. The gizmo reads the camera’s world matrix, applies the inverse rotation to the normals, and renormalizes the result.

Use it when a pass or lookdev step expects camera-space normals—relighting, shading tricks, or any setup that should stay locked to the view rather than the scene.

Choose the Normal Map channels on the Shuffle. Enable Output Packed Format to remap vectors from −1…1 into the 0–1 range; leave it off to keep signed values. RGB is written back onto the incoming image.

Script code

set cut_paste_input [stack 0]
version 15.1 v3
push 0
push $cut_paste_input
Group {
 inputs 2
 name WorldToCameraNormals4
 tile_color 0x421010ff
 selected true
 xpos -2643
 ypos 36
 addUserKnob {20 User l worldToCameraNormals}
 addUserKnob {26 info l "" +STARTLINE T "World to Camera Space Normal Transform"}
 addUserKnob {41 in_1 l "Normal Map" T Shuffle1.in}
 addUserKnob {6 outputPacked l "Output Packed Format (0-1 Range)" +STARTLINE}
 outputPacked true
 addUserKnob {26 "" +STARTLINE}
 addUserKnob {32 btn l DerekVFX.ca T "nuke.tcl('start', 'https://derekvfx.ca')" +STARTLINE}
}
 Input {
  inputs 0
  name normals
  label "\[value number]"
  xpos -150
  ypos -57
 }
 Shuffle {
  name Shuffle1
  xpos -150
  ypos 33
 }
set Nbd7a9800 [stack 0]
 Expression {
  temp_name0 length
  temp_expr0 "sqrt(r*r + g*g + b*b)"
  expr0 r/length
  expr1 g/length
  expr2 b/length
  name Normalize
  xpos -150
  ypos 81
 }
 ColorMatrix {
  matrix {
      {{"\[value input1.world_matrix.0]"} {"\[value input1.world_matrix.1]"} {"\[value input1.world_matrix.2]"}}
      {{"\[value input1.world_matrix.4]"} {"\[value input1.world_matrix.5]"} {"\[value input1.world_matrix.6]"}}
      {{"\[value input1.world_matrix.8]"} {"\[value input1.world_matrix.9]"} {"\[value input1.world_matrix.10]"}}
    }
  invert true
  name CameraTransform
  xpos -150
  ypos 129
 }
 Expression {
  temp_name0 length
  temp_expr0 "sqrt(r*r + g*g + b*b)"
  expr0 r/length
  expr1 g/length
  expr2 b/length
  name Normalize2
  xpos -150
  ypos 177
 }
 Expression {
  expr0 "outputPacked ? r * 0.5 + 0.5 : r"
  expr1 "outputPacked ? g * 0.5 + 0.5 : g"
  expr2 "outputPacked ? b * 0.5 + 0.5 : b"
  name PackNormals
  xpos -150
  ypos 201
 }
push $Nbd7a9800
 Copy {
  inputs 2
  from0 rgba.red
  to0 rgba.red
  from1 rgba.green
  to1 rgba.green
  from2 rgba.blue
  to2 rgba.blue
  name Copy1
  xpos -150
  ypos 225
 }
 Output {
  name Output1
  xpos -150
  ypos 321
 }
 Input {
  inputs 0
  name camera
  label "\[value number]"
  xpos -40
  ypos -57
  number 1
 }
end_group