The five switches and a too-small shadow camera
The picture is the working setup: a ball, its shadow and a floor. The table is a table of pixel readings, not of what you see.
A shadow is a second picture, drawn from the light's point of view, that stores how far the nearest surface is. Then every pixel asks: am I farther than that? You learn the five switches that must all be on, and fix the three classic faults: no shadow, a cut-off shadow and acne.
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 shadow looks blocky. Name two fixes and the cost of each.
Write the lines for a directional key light at (2, 4, 3) that shadows a scene about 3 m across.
Explain it without notes
A mesh casts no shadow. Give the five checks in the order you would do them.
Why does a point light cost six times the memory of a directional light at the same mapSize?
Console
Nothing logged yet.Expected console output
lit floor, far from the ball: 219
all five on pixel in the shadow's centre: 101 shadow
renderer.shadowMap.enabled = false pixel in the shadow's centre: 219 NO SHADOW
light.castShadow = false pixel in the shadow's centre: 219 NO SHADOW
ball.castShadow = false pixel in the shadow's centre: 219 NO SHADOW
floor.receiveShadow = false pixel in the shadow's centre: 219 NO SHADOW
shadow camera too small (±0.05) pixel in the shadow's centre: 219 NO SHADOW