Predict the GPU: N · L against real pixels
Open the scene tree to see the six plates. The prediction needs no GPU; the measured column is read back from the canvas.
The GPU finds a pixel's brightness with one multiplication: how directly the surface faces the light (a dot product), times the light's strength. You build the number by hand, compare it with what the GPU drew, and add the shiny spot on top.
Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.
Ready for more? This phase has 5 hands-on exercises with automatic checks.
Practice questions
Write the code in the editor, run it, then open the model answer to compare.
A plate faces +z and the light is at (3, 0, 4). Find N · L and the linear brightness under intensity π.
Write the code that finds the brightness of a surface at any angle deg from a light along +z, as a number between 0 and 1.
Explain it without notes
Compute the diffuse term for a surface turned 60° from the light, and say what the screen shows for a white plate under a π-intensity directional light.
Why is a plate turned 120° the background colour and not black?
Console
Nothing logged yet.Expected console output
angle N.L predicted measured
0° 1.000 255 255
30° 0.866 239 239
60° 0.500 188 188
80° 0.174 116 116
90° 0.000 0 11
120° 0.000 0 11