Skip to content
Tutorials Center
My learning

Topics

Lesson 19 of 39 ยท Lights and Shadows

Lighting Recipes and Practice

Apply Three.js lighting in practice: three-point studio lighting, a day-night cycle with a moving sun, indoor lamps, baked light and a checklist plus practice tasks.

You now know the light types, shadows and environments. This lesson turns that knowledge into recipes you can reuse: how professionals light a product, how to animate a day and night cycle, and how to decide what to bake. It ends with a checklist and practice tasks.

Recipe 1: three-point lighting

Photographers and film crews light a subject with three sources. The same recipe works in Three.js for a product or character viewer.

  • Key light: the main, brightest light, placed about 45 degrees to one side and above. It defines the form and the shadow.
  • Fill light: weaker and from the opposite side, to lift the shadows so they are not black. Often a soft light with no shadows.
  • Rim (back) light: from behind and above the subject, to trace its outline and separate it from the background.
flowchart LR
  K["Key light<br/>bright, 45 degrees"] --> S["Subject"]
  F["Fill light<br/>soft, opposite side"] --> S
  R["Rim light<br/>from behind"] --> S
  S --> C["Camera"]

The three lights surround the subject, with the camera in front.

Toggle each light below to learn what it contributes. Try the key alone: the shadow side is nearly black. Add the fill: shapes become readable. Add the rim: a bright edge appears.

Three-point lighting

Real designs add small variations: warm key and cool fill (as above) separates light and shadow by color, and a dim ambient or an environment map prevents total black.

Recipe 2: day and night

A moving sun is a DirectionalLight whose position follows a circle, plus a hemisphere light and a background whose colors depend on the sun's height. The only math is a sine for the height. The code maps sunHeight from -1 (midnight) to 1 (noon) to colors with lerp.

Day-night cycle

The window's emissive material glows at night: emissive colors are self-lit and need no light source. For a real lamp you would add a PointLight and keep it at intensity 0 until night, instead of toggling visibility, to avoid shader recompiles.

Recipe 3: indoor lamps without paying for many lights

A room with ten lamps would need ten point lights, which is slow. Options:

  1. Use two or three real lights where the player looks, and fake the rest with emissive materials and sprites with additive blending.
  2. Use RectAreaLight for windows and ceiling panels (no shadows, one light each).
  3. Bake: compute the lighting offline in Blender and apply it as a lightMap or aoMap, or bake the final color into the base color texture. The scene then renders with no real lights, and costs almost nothing. The downside is that baked light cannot move.

A good hybrid: bake the static lighting and shadows, and use one dynamic light for characters and moving objects.

Checklist for good lighting

  • Start with an environment (RoomEnvironment or an HDR) and tone mapping; add lights only where you need direction and shadows.
  • Use one shadow-casting directional or spot light as the key.
  • Keep ambient light low; use hemisphere light outdoors.
  • Give lights different colors: warm and cool contrast looks natural.
  • Check from several camera angles and on a small screen.
  • Keep the light count, shadow resolution and shadow box as low as the scene tolerates.
  • Remember sRGB output and tone mapping when you compare with reference pictures.

Practice tasks

  1. Candle: a single PointLight with an orange color and intensity that flickers using Math.sin and noise. Add a small emissive sphere for the flame.
  2. Lighthouse: a rotating SpotLight with a long cone on a tower, in a dark scene with fog. Make it cast a shadow.
  3. Showroom: a car-like object (a rounded box with a physical clearcoat) lit only by a custom environment of panels. Compare to RoomEnvironment.
  4. Day length: extend the cycle above with a moon (a second directional light with a blue tint) and stars (Points) that fade in at night.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What is the job of the rim light in three-point lighting?

    A light from behind and above creates a bright edge that makes the shape stand out.
  2. 2. Why set a light's intensity to 0 instead of removing it at runtime?

    Keep the same number of lights in the scene and vary their intensity.
  3. 3. A night window glows without a light source. Which material property does that?

    Emissive color is added to the surface color regardless of lights.
  4. 4. What is the main drawback of baked lighting?

    Baked light is static, so combine it with a few dynamic lights for moving things.

Summary

  • Three-point lighting (key, fill, rim) is a reliable base for product and character viewers.
  • A day-night cycle moves a directional light and blends sky, fog, sun color and intensities by sun height.
  • Fake extra lights with emissive materials and sprites, use rect area lights for panels, and bake static lighting.
  • Keep lights few, shadow boxes tight, and the light count constant while the scene runs.

Next: Textures and UV Mapping in Three.js