Light Map Maker: Create Realistic Lighting for Games and 3D Scenes

Light Map Maker Tutorial: From UVs to Baked LightingBaked lighting and lightmaps are essential for creating realistic, optimized scenes in real-time engines (Unity, Unreal Engine, Godot) and for reducing runtime cost while preserving visual fidelity. This tutorial walks through the full process using a generic “Light Map Maker” workflow: preparing UVs, setting up materials and lights, baking settings, exporting/importing lightmaps, and troubleshooting common issues. Examples target common engines and tools; adapt specifics to your chosen software.


What is a lightmap and why use baked lighting?

A lightmap is a texture that stores precomputed lighting information (direct light, bounced light, shadows, ambient occlusion) for static geometry. Instead of calculating complex lighting every frame, engines sample the lightmap to apply high-quality static illumination. Benefits include:

  • Greatly reduced runtime lighting cost
  • High-quality soft shadows and global illumination
  • Consistent lighting across varied hardware
  • Ability to add detail (AO, color bleeding) that would be expensive in realtime

Overview of the workflow

  1. Model preparation and UV unwrapping (lightmap UVs)
  2. Scene and material setup
  3. Light placement and bake settings
  4. Baking the lightmaps
  5. Export/import and apply lightmaps in engine
  6. Troubleshooting and optimization

1. Model preparation and UV unwrapping

Good lightmaps start with good UVs. Lightmap UVs are different from texture UVs; they need to map the surface to a second UV channel that’s optimized for texel density and minimal bleeding.

Key principles:

  • Keep UV shells non-overlapping (each texel corresponds to a single surface point).
  • Maintain consistent texel density across objects that should receive similar lighting detail.
  • Add padding between shells to avoid bleeding during filtering.
  • Avoid extreme stretching; preserve proportional areas.
  • Use a separate second UV channel for lightmaps (UV2). Keep your color/albedo UVs in UV1.

Workflow in common tools:

  • Blender: In Edit Mode, create a new UV map (Object Data Properties → UV Maps → +). Unwrap with “Smart UV Project” for quick results or “Lightmap Pack” for consistent islands; manually relax seams for better packing.
  • 3ds Max: Use Unwrap UVW modifier and pack UVs onto Channel 2. Use “Pack UVs” and scale islands for texel density.
  • Maya: Use UV Editor and “Automatic”/“Lightmap” unwrapping or the Transfer Maps workflow.

Texel density guidelines:

  • For detailed interior props, 4–8 texels/cm (or similar) can be used.
  • For large environment pieces, 1–2 texels/cm is often sufficient.
  • Target consistent texel density rather than absolute numbers; scale different objects relative to their visual importance.

Padding rules:

  • At least 2–4 pixels of padding for low-res lightmaps, 8–16+ pixels for higher resolutions.
  • Increase padding when using powerful filtering (blur, dilation) or mipmapping.

2. Scene and material setup

Only static geometry participates in lightmap baking. Decide which objects will be static (architecture, props) and which will remain dynamic (characters, moving props, particle systems).

Materials:

  • Use physically plausible albedo colors; extremely bright textures can cause unrealistic indirect lighting.
  • Separate emissive materials: emissive maps can contribute to baked lighting if supported, or be baked to specific channels.
  • For objects with transparency or alpha-tested materials (e.g., foliage), check your engine’s handling—some engines bake alpha-tested shadowing, others require special setups.

Static vs dynamic:

  • Mark static objects as lightmap static in your engine or exporter.
  • Dynamic objects can still receive baked indirect lighting via light probes or reflection probes.

Light probes and reflection probes:

  • Use light probes to capture baked indirect lighting for dynamic objects.
  • Reflection probes capture environment reflections and should be placed across major rooms or areas.

3. Light placement and bake settings

Types of lights:

  • Directional lights (sun): common for outdoor scenes.
  • Point and spot lights: localized lighting.
  • Area lights: produce soft shadows and realistic falloff (baked).
  • Skylight/ambient: provide global ambient illumination.

Important bake settings:

  • Lightmap resolution (per-object or per-lightmap atlas): determines texel density for baked lighting.
  • Samples/quality: higher sample counts reduce noise.
  • Bounce/indirect intensity and number of bounces: control global illumination richness.
  • Shadow distance/quality and contact shadow settings.
  • Filtering/dilation: how the baked map handles seams and empty pixels.

Examples:

  • Unity (Built-in/URP/HDRP): set Lightmap Parameters, set resolution per-object (in Lightmapping settings), choose Progressive CPU/GPU, set samples and denoising (OptiX/Intel). Use light probes for dynamic objects.
  • Unreal Engine: adjust Lightmass settings, indirect lighting quality, and increase static lighting level scale for more detail. Use Lightmap Resolution per mesh and build with Production or High quality.
  • Godot: configure Bake options in GIProbes or bake using external tools; use appropriate texel density and padding.

Balancing quality vs time:

  • Start with low sample counts and coarse resolutions for quick iterations.
  • Increase resolution and samples for final builds.
  • Use denoisers to reduce noise without enormous sample counts.

4. Baking the lightmaps

Baking pipeline:

  1. Ensure all UV2s are present and non-overlapping.
  2. Mark static objects and set per-object lightmap resolution.
  3. Place and configure lights; designate which lights are baked vs realtime.
  4. Run a progressive bake to preview results; then do a final high-quality bake.

Using a Light Map Maker (dedicated tool):

  • Some tools offer standalone baking (e.g., xNormal, Bakery for Unity, Unreal Lightmass, Blender’s Cycles Bake).
  • Bakery (Unity) and Radeon/Raytracing denoisers are popular for fast GPU baking.
  • Export geometry with second UV set when baking externally; import resulting lightmaps as textures and assign in engine.

Cycle-based baking in Blender:

  • Use Cycles as the baking engine.
  • Create an image texture in the UV/Image Editor for each object or atlas.
  • Select object, set bake type to Combined (or Diffuse + Indirect if separating), and click Bake.
  • Save the baked images and apply them to the objects’ second UV channel.

Tips:

  • Bake different lighting components separately if needed: direct, indirect, AO, albedo. This allows compositing and adjustment later.
  • For large scenes, bake in multiple atlases or per-room to keep resolutions manageable.
  • Use automated packing tools or tile atlases per level.

5. Export/import and applying lightmaps

Exporting:

  • Export models with both UV channels, and ensure material indices are preserved.
  • Export baked lightmaps as PNG/TGA/EXR depending on desired precision (EXR for HDR and linear data).

Importing into engines:

  • Unity: Import lightmap texture, set it as Lightmap (and disable sRGB for linear data if required). Assign to the Lighting window or let Unity generate lightmap atlases automatically if you baked inside Unity. For external bakes, assign the lightmap index/offset in Mesh Renderer settings or use the Lightmap Parameters.
  • Unreal: Import lightmaps as textures and set them in the Static Mesh Editor (LightMap Coordinate Index set to UV channel 1 or 2 depending on export). Adjust the lightmap resolution and re-build lighting if needed.
  • Godot: Assign baked textures to the appropriate baked light property or use GI Probes for dynamic lighting.

Applying atlases:

  • If you used atlases, set UV2 coordinate scale/offset per mesh so the mesh samples the correct atlas tile.
  • Engines typically expect UV2 in a 0–1 space; per-object tiling uses UV scale/offset values.

6. Troubleshooting common issues

Light leaking (bleeding through seams):

  • Cause: overlapping UVs, insufficient padding, low bake resolution, or wrong lightmap UVs.
  • Fixes: increase padding, ensure non-overlapping UVs, raise lightmap resolution, adjust dilation/filter settings.

Seams and discontinuities:

  • Cause: inconsistent UV shell packing, wrong interpolation across islands, or differing texel density.
  • Fixes: re-pack UVs with consistent texel density, increase padding, bake at higher resolution.

Blotchy or noisy bakes:

  • Cause: low sample count or insufficient indirect bounces.
  • Fixes: increase samples/quality, enable denoising, increase indirect bounces, smooth normals if appropriate.

Dark spots / missing indirect light:

  • Cause: objects not marked static, wrong light layers, or light probes absent for dynamic objects.
  • Fixes: ensure static flags set, check light culling masks, add light probes.

Incorrect color/tonemapping:

  • Cause: mismatched color space or sRGB vs linear settings.
  • Fixes: ensure textures saved with proper color space (lightmaps often use linear), match engine import settings.

Very large lightmap textures causing memory spikes:

  • Strategy: split into smaller atlases per room, use lower resolutions for distant objects, use streaming or atlas tiling.

7. Optimization strategies

  • Bake only what’s necessary: small props can share lightmaps or use lower resolution.
  • Use light probes for dynamic objects and reflection probes for reflections instead of baking everything.
  • Atlas management: group objects by room or by texel-density needs.
  • Compress lightmaps with appropriate formats (BC6H for HDR, BC7 for sRGB-like HDR; ASTC for mobile).
  • Use denoisers to lower sampling requirements.
  • Adjust number of indirect bounces to find a visually pleasing balance.

Comparison of techniques (quick):

Technique Quality Runtime Cost Use Case
Full baked lightmaps High Low Static scenes, consoles/PC
Mixed (baked + realtime) High Medium Scenes with dynamic objects
Light probes only Medium Low Many dynamic objects
Real-time GI Variable High High-end hardware or small scenes

8. Advanced topics

Layered baking and compositing:

  • Bake AO and indirect lighting separately to composite in engine or shader for more control.

Lightmap atlasing strategies:

  • Tile atlases per level for streaming.
  • Use per-room atlases to reduce wasted space.

GPU vs CPU baking:

  • GPU bakers (Bakery, Cycles GPU) are much faster but require compatible hardware and can be VRAM-bound.
  • CPU bakers (Lightmass, CPU Cycles) may produce different noise characteristics and can be more stable.

Subsurface scattering and translucency:

  • Harder to bake; often approximated or left for realtime solutions.

Dynamic day-night cycles:

  • Bake multiple lightmaps per major time-of-day or use mixed realtime lighting for sun direction and static baked indirect lighting.

9. Example: Quick Unity bakery-style pipeline

  1. Prepare meshes with UV2 in Blender and export FBX with both UV channels.
  2. Import into Unity, mark static, and assign lightmap static.
  3. Install Bakery (or use Unity Progressive Lightmapper).
  4. Set per-object Lightmap Scale (e.g., 0.5 for small props, 2 for hero assets).
  5. Place lights and set them to Baked.
  6. Run a low-sample bake to preview; adjust settings.
  7. Run final bake with denoiser enabled; inspect and fix seams.
  8. Compress lightmaps and test performance on target hardware.

10. Final checklist before release

  • All static objects have UV2 and no overlaps.
  • Lightmaps have adequate padding and Texel Density is consistent.
  • Dynamic objects sample indirect lighting via probes.
  • Denoising applied and artifacts checked.
  • Lightmap sizes and compression balanced for memory constraints.
  • Visual QA across different areas and lighting conditions.

Baking lightmaps is part art, part technical pipeline work. Iteration is key: start coarse, fix UVs and seams, then increase quality for final builds. With good UVs, appropriate bake settings, and careful atlas management, baked lighting can deliver rich, performant visuals across platforms.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *