Lesson 101 +10 XP

Static and Dynamic Lighting Modes

Static and Dynamic Lighting Modes

Unity offers multiple lighting modes that balance visual quality against runtime performance. Understanding when to use each is essential for optimizing your game.

Three Core Lighting Modes

Realtime Lighting

Lights are calculated every frame. Fully dynamic: lights and objects can move and the scene updates accordingly.

  • Cost: High CPU/GPU per frame.
  • Use case: Player flashlights, muzzle flashes, dynamic sun movement.

Baked Lighting

Light information is pre-computed and stored in lightmaps at editor time. At runtime, no light calculation happens for these lights.

  • Cost: Zero runtime cost. Larger disk/memory for lightmap textures.
  • Limitation: Baked lights cannot illuminate moving objects (they use Light Probes for that).
  • Use case: Sun, sky, indoor ambient lighting for static scenes.

Mixed Lighting

A hybrid mode. Static objects receive baked indirect light (lightmaps) but dynamic objects receive realtime direct light from the same light source.

  • Shadowmask mode: Baked shadows from static objects, realtime shadows from dynamic objects.
  • Subtractive mode (Built-in RP only): One combined lightmap for static geometry.
  • Use case: Scenes with a mix of static architecture and dynamic characters.

Configuring Light Mode

Select any Light component and set its Mode property to:

  • Realtime
  • Mixed
  • Baked

Light Probes for Dynamic Objects

Baked lightmaps only affect static geometry. Dynamic GameObjects (characters, vehicles) sample light from Light Probes instead:

  1. Place Light Probe Group components throughout the scene.
  2. Position individual probes in areas characters will move through.
  3. Bake lighting. Probes capture indirect light at their positions.
  4. At runtime, dynamic renderers interpolate between nearby probes.
// Force a renderer to use specific light probes
Renderer rend = GetComponent<Renderer>();
rend.lightProbeUsage = UnityEngine.Rendering.LightProbeUsage.BlendProbes;

The Lighting Window

Window > Rendering > Lighting is the central hub for:

  • Setting the Environment Lighting source (skybox, gradient, color).
  • Configuring Lightmapper settings (Progressive CPU or GPU).
  • Clicking Generate Lighting to bake the scene.

TL;DR

  • Realtime: Dynamic, expensive. Use for moving lights.
  • Baked: Free at runtime, static only. Use for fixed environment lights.
  • Mixed: Hybrid. Baked indirect + realtime direct for a balance.
  • Dynamic objects use Light Probes to receive baked indirect light.