Command Palette

Search for a command to run...

Hectal
Back to the lesson: Topic 5.4 — Lights and Their Cost
3D Web · Example 1 of 2

Distance, decay and cut-off of a point light

The camera looks straight down. The picture is the pool of light of the light at 2 m. The 3 m cut-off column is the fourth in the table.

three.js has six kinds of light, each with its own unit and cost. You learn what they are for, how a point light fades with distance (the decay), and why twenty point lights is a mistake: each light adds work to every pixel.

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

Choose lights for the showroom: one that makes a shadow, one that keeps shadows from going black. Write the two lines.

02

The pool of light must stop 3 m from a lamp, with the default fading. Which property do you set?

Explain it without notes

01

A point light of 10 cd hangs 4 m above a floor. By what factor does the light on the floor change if it moves to 2 m, and what does decay 0 change?

02

Why do 20 point lights cost more than one, even if only one mesh is in the scene?

Distance, decay and cut-off of a point light
Press Run to see the page.
idle

Console

Nothing logged yet.

Expected console output

point light, intensity 10 (candela): floor pixel straight below
height    decay 2 (default)   decay 1   decay 0   decay 2, distance 3
1 m        255       255       255       255
2 m        228       255       255       187
3 m        158       255       255         0
4 m        122       228       255         0
power of a 10 cd point light: 125.7 lm