Light baking is the process of precomputing lighting offline and storing the result in textures, vertex data or probe volumes, so that a renderer can display expensive effects such as global illumination, soft shadows and ambient occlusion without calculating them every frame. In Real-time 3D, it is the classic way to make games, architectural walkthroughs and web scenes look physically plausible on hardware that could never trace that light interactively.
The stored texture is usually called a lightmap, and the procedure is often named lightmap baking. The core idea is a trade: the engine spends minutes or hours of build time once, then pays only a texture lookup per pixel at runtime. The price is rigidity, because baked light describes one fixed arrangement of geometry and light sources.
How light baking computes and stores illumination
A baker simulates light transport through the static parts of a scene and writes the arriving energy into storage that the runtime shader can sample. Most modern bakers use path tracing or photon mapping on the CPU or GPU, firing rays from each lightmap texel into the scene and accumulating direct and indirect bounces until the estimate converges.
Before any rays are cast, every static mesh needs a second, non-overlapping UV set, often called UV2 or the lightmap UV channel. Unlike the texture UVs used for materials, these coordinates must give each surface a unique area of the atlas, because two surfaces sharing texels would receive the same lighting. The baker then packs all charts into one or more lightmap atlases and adds padding to prevent bleeding between neighboring charts.
The process runs in a predictable sequence. The following table summarizes the main stages and what each one controls.
| Stage | What happens | Main quality lever |
|---|---|---|
| UV unwrapping | Unique lightmap UVs are generated per mesh | Chart padding and distortion |
| Atlas packing | Charts are arranged into shared textures | Texel density and atlas size |
| Light transport | Rays gather direct and bounced light | Sample count and bounce count |
| Denoising | A filter removes Monte Carlo noise | Denoiser type and strength |
| Dilation and compression | Edges are extended, data is encoded | Texture format and bit depth |
At runtime, the fragment shader multiplies the material albedo by the sampled lightmap value and adds any remaining real-time contributions, such as specular highlights or dynamic lights. That single sample replaces what would otherwise be thousands of ray evaluations per pixel.
What baked data can contain
Baked data ranges from a single grayscale channel to directional encodings that preserve some sense of where light comes from. Choosing the representation is a balance between memory footprint, visual fidelity and compatibility with normal maps.
| Representation | Stores | Typical use |
|---|---|---|
| Ambient occlusion map | Shadowing from nearby geometry | Contact darkening on props |
| Irradiance lightmap | Incoming diffuse light as RGB color | Static walls, floors, terrain |
| Directional lightmap | Dominant light direction plus color | Normal-mapped static surfaces |
| Spherical harmonics probes | Low-frequency light at points in space | Lighting moving characters |
| Reflection probes | Prefiltered environment cubemaps | Glossy specular reflections |
| Vertex lighting | Light values per mesh vertex | Low-end devices, dense meshes |
Lightmaps are normally stored in high dynamic range, using formats such as RGBM, BC6H or half-float textures, because bounced light in a sunny room easily spans several orders of magnitude. Storing them in plain 8-bit sRGB causes visible banding and clipped highlights.
Light baking compared with real-time lighting
Baked and real-time lighting are complementary rather than competing, and most shipping projects use a mixed lighting model. Baking handles static indirect light, while real-time techniques such as shadow mapping, screen space ambient occlusion and screen space reflections cover moving objects and view-dependent effects.
| Aspect | Light baking | Fully dynamic lighting |
|---|---|---|
| Runtime cost | Very low, one texture sample | High, scales with lights and bounces |
| Indirect light quality | High, many bounces possible | Approximate unless ray traced |
| Moving lights or geometry | Not supported for baked parts | Fully supported |
| Iteration speed | Slow, requires rebake | Immediate feedback |
| Memory use | Grows with texel density | Mostly shadow maps and buffers |
| Hardware target | Mobile, web, VR, consoles | Mid to high-end GPUs |
Real-time global illumination systems now close part of the gap, but they still cost several milliseconds per frame on capable hardware. On a mobile headset with a budget of about 11 to 14 milliseconds per frame, baking often remains the only way to show convincing bounced light.
Configuring a bake for quality and memory
The most influential setting is texel density, the number of lightmap texels per world unit. Doubling linear density quadruples memory and bake time, so experienced artists assign higher density to surfaces near the camera and much lower density to distant or hidden ones.
The decision table below lists frequent situations and sensible starting strategies.
| Situation | Recommended approach | Reason |
|---|---|---|
| Static interior with fixed sun | Full bake with directional lightmaps | Best indirect quality at minimal cost |
| Day-night cycle | Bake indirect only or use probes | Direct light must move |
| WebGL product viewer | Bake AO and lighting into textures | Keeps shaders simple and fast |
| Characters in baked levels | Light probes or probe volumes | Moving objects cannot use lightmaps |
| Large open terrain | Low density plus real-time shadows | Lightmap memory would explode |
Libraries such as Three.js and Babylon.js read baked lightmaps through a second UV channel, which makes offline baking in a DCC tool a common workflow for browser scenes. Engine-integrated bakers add light probe placement, mixed-mode shadows and incremental rebakes that reprocess only changed areas.
Limitations and common baking errors
The fundamental limitation is that baked light is frozen in time: opening a door, destroying a wall or moving a lamp leaves the old lighting in place. Teams work around this with multiple lightmap sets, blended probe data or a hybrid real-time layer, all of which add memory and complexity.
- Light leaking appears when thin walls or overlapping geometry let rays pass where they should not; thicker walls or closed meshes usually fix it.
- Seams show at chart boundaries when padding is too small or UVs are split along visible edges.
- Blotchy noise results from too few samples or an aggressive denoiser that smears detail.
- Shadow acne and stair-stepping come from insufficient texel density on large surfaces.
- Mismatched specular occurs when baked diffuse light and real-time reflections disagree in intensity.
A further misconception is that baking makes scenes cheap in every respect. Large atlases increase download size and GPU memory, and streaming them demands careful mipmapping and texture streaming plans.
The short version
Calculating how light bounces around a room is slow. Light baking does that work once, ahead of time, and saves the answer as an image painted onto the walls, floors and furniture.
When the scene runs, the computer simply reads those stored shadows and glows instead of working them out again. It is like painting the lighting onto a theater set before the show: it looks rich and costs nothing during the performance, but nothing can move without the paint looking wrong.
Where it makes a difference
A small studio builds a virtual reality tour of a museum hall for a standalone headset that must hold 72 frames per second. Rendering sunlight through tall windows, bouncing off a marble floor and filling the side galleries in real time would exceed the GPU budget several times over.
The team marks the architecture as static, generates lightmap UVs, sets a texel density of 20 texels per meter near walkways and 4 in the ceiling vaults, and bakes three bounces overnight. Visitors and a rotating sculpture receive light from a grid of spherical harmonics probes. The final scene uses about 90 MB of compressed lightmaps, runs at a steady frame rate with headroom, and shows soft bounced light that a purely dynamic setup could not deliver on that device.