A stone corridor's torches are baked into lightmaps, but designers now want torches that flicker and can be put out while characters walk past; what do you bake and what stays dynamic?
answer
- what a bake assumes stays still
- light adds linearly
- one layer per switchable light
- movers never read the lightmap
- do not count a light twice
basics
~20 sKeep static geometry's bounced light baked, and either bake each torch into its own scalable lightmap layer, since light adds linearly, or light the torches dynamically. Characters need dynamic direct light and shadows; lightmaps only cover static geometry.
solid answer
~50 sA **lightmap** stores precomputed light for static geometry in a texture laid out over a unique second UV set, multiplied by the albedo: one fetch buys soft shadows and bounced light. The bake assumes the lights and the geometry never change. Flicker and extinguishing change only a torch's intensity, and light is additive, so each switchable torch's contribution, direct and bounced, can go in its own layer that the shader scales every frame; that works for a few overlapping torches per texel. The alternative is to bake only the bounced light and evaluate each torch's direct light at run time, which keeps normal-map and specular response and lets characters cast shadows onto the walls. Characters never sample lightmaps: they take direct light dynamically and indirect light from a separate system. Whatever you choose, a torch's direct light must not be both baked and dynamic on the same wall, or it counts twice.
go deeper
Know that a lightmap stores precomputed light for static geometry, sampled with its own UV set and multiplied by the albedo.
Explain why lightmaps need unique UVs and HDR storage, why they cover static geometry only, and how they replace a constant ambient term.
Split each light's contribution between baked and dynamic paths for a stated requirement, using linearity for switchable lights and avoiding double counting.
Weigh bake time, memory and designer iteration against runtime lighting cost when setting which lights a project may bake and which must stay dynamic.
## What a lightmap stores A **lightmap** is a texture holding precomputed lighting for **static geometry**. An offline bake traces or renders the light arriving at each texel, usually the direct light from static lights plus several bounces of **indirect** light, and the runtime shader multiplies the result by the surface's albedo texture. The essentials: - **A unique UV set.** Every point of every static surface needs its own texel, so lightmaps use a second set of UVs whose charts never overlap. Albedo UVs often tile or mirror, which would make two walls share one texel of light. Charts are padded so that filtering does not bleed light from one chart into the next. - **Light, not lit colour.** Storing light separately from albedo lets a low-resolution lightmap modulate a high-resolution, tiling albedo texture. - **Range above 1.** Light near a torch can be brighter than white, so lightmaps usually need a high-dynamic-range encoding. A single 1024 x 1024 lightmap at 8 bytes per texel (four 16-bit channels) is 8 MiB before compression. - **Diffuse only by default.** A plain lightmap has no direction, so normal maps and specular highlights do not respond to baked light unless a directional variant stores a dominant direction or a low-order basis per texel. Before lightmaps, the classic model used a constant **ambient** term for indirect light. A lightmap replaces that constant on static geometry with stored, position-dependent light, including soft shadows. ## What baking assumes A bake is correct only while its inputs do not change: the static lights' positions, colours and intensities, and the static geometry. The corridor's new requirements break the bake in three different ways: 1. **Flicker** changes a torch's intensity many times a second. 2. **Putting a torch out** sets its intensity to zero, including its bounced light. 3. **Characters walking past** need light on themselves, and their shadows on the walls; neither exists in a lightmap. ## The options | Approach | Flicker and on/off | Characters' shadows on walls | Runtime cost | Limits | |---|---|---|---|---| | Fully baked, one combined lightmap | no, needs a rebake | no | one fetch | static everything | | Per-light layers, scaled at run time | yes | no, unless added dynamically | one fetch per layer | a few switchable lights per texel | | Bake indirect only, direct light dynamic | yes, direct light; bounce stays fixed unless also layered | yes | full lighting per torch | more shading and shadow work | | Fully dynamic | yes | yes | highest | no baked bounce at all | **Per-light layers** rely on **linearity**: light from several sources simply adds, and scaling a source's intensity scales everything it contributes, bounces included. Baking each switchable torch into its own channel or layer and multiplying by that torch's current intensity reproduces flicker and switching exactly, provided the torch never moves. The cost is memory and a cap on how many switchable lights may overlap at one texel. **Baked indirect with dynamic direct light** keeps the bounced light cheap while the direct light, the part that carries crisp shading, specular highlights and shadows from moving objects, is computed live. A torch the player carries cannot use either baked path: it must be fully dynamic, because moving a light invalidates everything a bake stored for it, its bounced light included. ## Characters and other moving objects - Moving objects never read lightmaps; there is no texel for a character. They receive **direct light** from the dynamic lights and **indirect light** from a separate system such as probes, which is its own subject. - Shadows *of* characters on baked walls require the torch's direct light to be dynamic at least for those casters. One common split keeps a baked occlusion mask for static shadowing and adds dynamic shadows only from moving casters. - **Double counting** is the classic bug: if a torch's direct light is in the lightmap and the same torch is also applied dynamically to the walls, the walls get it twice. Each light's direct contribution to each surface must come from exactly one path. ## Costs to weigh - **Bake time and iteration**: every lighting change waits for a rebake, which slows designers down. - **Memory**: lightmap texels scale with surface area and texel density, and every switchable layer adds more. - **Runtime shading**: each dynamic torch adds per-pixel lighting and, if it casts shadows, a shadow pass. - **Consistency**: baked and dynamic light must match in colour, falloff and intensity, or surfaces visibly change when a light switches path. ## A plan for this corridor 1. Bake the corridor's bounced light into lightmaps, with one layer per torch so the bounce follows flicker and extinguishing. 2. Evaluate each torch's direct light dynamically, with a finite range, so walls show specular and normal-map response and characters cast shadows. 3. Light characters with the same dynamic torches plus probe-based indirect light. 4. Remove the torches' direct light from the bake so nothing is counted twice, and check the baked and dynamic falloffs match.
- Why can a flickering torch be baked when a moving torch cannot?Flicker changes only intensity, and lighting is linear in each light's intensity: halve the torch and every texel it lit, directly or through bounces, halves too. A layer baked at unit intensity and scaled per frame is therefore exact. Moving a torch changes the directions, distances and occlusion of everything it lit, so the stored values no longer correspond to any scale of the new lighting.
- Why do lightmaps need a UV set of their own?Each point on a static surface receives its own light, so it needs its own texel. Albedo UVs often tile a brick texture many times or mirror a symmetrical prop, which would make different surfaces share one texel. A lightmap UV set packs non-overlapping charts with padding between them, so filtering does not bleed light across chart borders.
- A character walks between a baked torch and the wall; what goes wrong, and what are the fixes?The wall shows no shadow, because the baked light knows nothing about the character. Either evaluate that torch's direct light dynamically with shadows from moving casters, or keep a baked occlusion mask for static geometry and add dynamic shadows only from movers. Whichever you pick, remove that torch's direct light from the lightmap so the wall is not lit twice.
- Lightmaps light characters too, as long as they stand on a baked floor.
- Any change to a baked light, even only its brightness, always forces a rebake.
- Leaving a torch's direct light baked while also lighting the same wall dynamically is harmless.
- Lightmaps can reuse the albedo texture's tiling UVs.
- A constant ambient term is an adequate substitute for baked bounce light in an enclosed corridor.