Command Palette

Search for a command to run...

Hectal
Back to the lesson: Topic 5.5 — Shadows
3D Web · Example 2 of 3

Acne: bias and normalBias on a skimming light

A double-sided floor that casts and receives shadow, a low light and a small shadow map: stripes on the first run, then the numbers fall. The measured block is 100 × 40 pixels of a 300 × 150 frame.

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.

01

A shadow looks blocky. Name two fixes and the cost of each.

02

Write the lines for a directional key light at (2, 4, 3) that shadows a scene about 3 m across.

Explain it without notes

01

A mesh casts no shadow. Give the five checks in the order you would do them.

02

Why does a point light cost six times the memory of a directional light at the same mapSize?

Acne: bias and normalBias on a skimming light
Press Run to see the page.
idle

Console

Nothing logged yet.

Expected console output

wrongly dark pixels, out of 4000:
bias 0, normalBias 0 (the default)  3918
bias -0.005                         2148
bias -0.02                             0
normalBias 0.05                       45
bias -0.0005 and normalBias 0.05       9