Home · Lab · CG Multipass & Relighting

CG4 Relighting with the normal pass

Let the sparks light the robot with N·L, albedo and plus

CG Multipass & Relighting · ~8 min · Free

1 The idea

A normal pass stores which way the surface faces at each pixel. Dot it with a light direction L and drop the negatives, max(0, N·L), and you have the simplest diffuse light (Lambert); multiply it by the albedo and the light colour, then plus it over the beauty.

The sparks are in front and to the right of the robot, about 1.7 m from its chest and a little lower. Set the light’s azimuth and elevation that way, set the intensity, and switch “multiply by albedo” to “on”. Watch how far you are off Blender’s render, and switch the view between “added light” and “Blender (ref)” to see whether the light lands on the right side.

added = albedo · max(0, N̂·L) · colour · intensity

2 Hands-on

Task: make the sparks light the robot. Aim the comp light from the sparks and bring the error against Blender’s render below the goal in the panel (the goal sits halfway between the starting error and the best a single directional light can do, which is about 32%).

The light starts on the wrong side. Azimuth −90° points at the camera, 0° to the right. Compare “added light” with “Blender (ref)” to see which side of the robot should be lit, then ask whether the light on every part of the robot should really be the same colour.

SkyVFX Lab · CG4interactive · 1001

3 Deep dive

What the normal pass stores

The normal pass stores the direction the surface faces at each pixel as a unit vector, with x, y and z in r, g and b. Each channel runs from −1 to 1, so it is data, not colour; the colours you see in the figure are only a display.

Before any relight, find out which space the normals are in, world or camera, and the axis handedness. Blender’s Cycles Normal pass is world space with Z pointing up. Get the space wrong and the light comes from the wrong side even when you aimed it correctly.

Quick space check: sample ground that faces the sky. In a Z-up world space nearly all of the value sits in blue. Or test against a sphere whose directions you know.

N·L: where the light lands and how strongly

N·L = Nx·Lx + Ny·Ly + Nz·Lz. It is 1 where the surface faces the light head-on, 0 where it is side-on, and negative where it faces away. This is the Lambert term of diffuse light.

Clamp the negatives at 0, or the plus turns into a subtraction and back faces darken into dark rims. In Nuke, do the dot with an Expression, or a ColorMatrix with one row set to L, then use that channel.

  1. 1Shuffle N into rgb
  2. 2Dot with L
  3. 3Clamp low at 0
  4. 4× albedo × light colour
  5. 5Plus over beauty

Albedo, light colour and plus

max(0, N·L) on its own is a black-and-white mask; plussed straight in, every material gets the same grey light. Real surfaces reflect light in their own colour, so multiply by the diffuse colour pass (albedo), then by the light’s colour and strength.

The result is added light, so plus it over the beauty. Not over, and not a lift: a lift raises the blacks everywhere, while a relight should only add light where the light lands.

TermWhat it decides
max(0, N·L)Where the light lands and how much, by surface angle
AlbedoWhat colour the surface reflects
Light colour and intensityThe sparks’ orange and how bright the light is
Merge plusAdds the light to the beauty without touching unlit areas

What a comp relight can’t do

A normal relight has no shadows and no bounce: nothing blocks the light, so parts that should be shaded still get lit. That makes it best for small extra lights such as sparks, a muzzle flash or a screen, where missing shadows are hard to spot. A close light also changes direction across the subject: one direction is only an average, and aiming it per pixel needs a position (P) pass as well. Shadows in comp need the light rendered on geometry in 3D.

In this figure the reference is a point light with shadows and bounce, while our light is directional and Lambert only, so the error can’t reach 0. The best this model reaches is about 32%, and the goal sits halfway between the start and that. The direction from the robot’s chest to the sparks is about −41° azimuth and −6° elevation, but a point light’s direction changes across the robot, so one direction is only an average.

Treat a comp relight as a small extra light. If the shot needs that light’s shadow, render the light on geometry in 3D, or ask for the light from the CG side.

4 In real work

In Nuke

  1. Shuffle2: bring the N layer into rgb and read it as raw data, no grading first.
  2. Expression (r*Lx + g*Ly + b*Lz), or a ColorMatrix with one row set to L, to get N·L.
  3. Clamp: clamp the low side at 0 so faces turned away don’t go negative.
  4. Merge2 (multiply) with the diffuse colour pass, then a Multiply for the light’s orange colour and intensity.
  5. Merge2 (plus) over the beauty.
  6. Alternative: the ReLight node reads the normal and position layers (its normal vectors and point positions knobs) and lights them with 3D lights; check what it outputs before you merge it.

Common mistakes → the fix

  • ✗ Relighting without the albedo, so every material gets the same grey light✓ Multiply N·L by the diffuse colour pass before the plus.
  • ✗ Not clamping N·L at 0, so back faces get negative light and dark rims✓ Always clamp the low side at 0.
  • ✗ Normals in a different space than assumed (camera vs world), so the light comes from the wrong side✓ Check the space and axes before relighting, using the ground or a sphere with known directions.
  • ✗ Expecting shadows from a normal relight✓ It has none; for shadows, render the light on geometry in 3D or get it from CG.
  • ✗ Adding the light with a lift or an over✓ Use Merge plus so light is added only where it lands and the other blacks stay put.

Before you send the shot

  • The lit side of the robot faces the sparks.
  • No dark rims from negative values on faces turned away.
  • The light takes each part’s surface colour, not one flat grey.
  • Blacks where the light doesn’t reach are not lifted.
  • The normal space was checked, not guessed.
  • Any shadow this light should cast is handled another way.

5 Check yourself

One question to check yourself

After the relight, every part of the robot gets the same grey light, whatever its paint colour. Which step is missing?

What you learned

🔒 Answer the question above and this card opens

More questions

1. You have the relight result. How do you combine it with the beauty?

2. The robot’s arm should block the sparks’ light from its body. What does a normal relight give you there?

Where the numbers come from: Every picture is a Blender 5.2 Cycles render of our own desert and robot (tools/assets/passes_cg.py), computed in your browser. The robot’s Normal pass (world space) and Diffuse Color pass come from the same render. The reference is a separate Cycles render of an orange point light at the sparks’ position (with shadows and bounce). Our comp light is one directional Lambert light (a teaching model), so it can’t reach zero error: the best is estimated by searching a 10° grid of directions (with the best-fit intensity for each), and the goal sits halfway between the start and that best.