# 2. GPU Lightmapper Workflow Part of [[Lighting and Baking]]. Previous: [[1.Realtime Mixed and Baked Lights]]. Next: [[3.Lightmap UVs and Texel Density]]. Unity's **Progressive GPU Lightmapper** path-traces lightmaps on the GPU. In most configurations it is much faster than the Progressive CPU Lightmapper; quality parity often needs higher indirect sample counts because the GPU path does not use the CPU lightmapper's branched path tracing. Official: [Optimize baking (Progressive GPU)](https://docs.unity3d.com/6000.0/Documentation/Manual/GPUProgressiveLightmapper.html) · [Lightmapping settings reference](https://docs.unity3d.com/6000.0/Documentation/Manual/Lightmaps-reference.html) ## 2.1 Open the Lighting window 1. **Window > Rendering > Lighting**. 2. Ensure a **Lighting Settings** asset is assigned (Scene tab). Create one if the scene has none — settings live on the asset, not "in the scene" as ephemeral state. 3. Enable **Baked Global Illumination** under Mixed Lighting / Lightmapping as required for your bake. 4. Set **Lightmapper** to **Progressive GPU**. > [!note] Default Lightmapper > Unity's settings reference lists the default Lightmapper as **Progressive CPU**. Switch explicitly to Progressive GPU when your baking GPU has enough VRAM. ## 2.2 Core Progressive settings | Property | What it does | Practical start | |---|---|---| | **Direct Samples** | Paths per texel for direct lighting (powers of 2) | 32–256; raise if direct is noisy | | **Indirect Samples** | Paths per texel for indirect; outdoor often OK at 128; interiors with emissives need more | 128–2048 | | **Environment Samples** | Rays toward the skybox (powers of 2, max 2048 in the documented slider) | 256 default; raise for HDR skies / bright sun singularities | | **Light Probe Sample Multiplier** | Multiplies the above for probes (requires legacy probe sample counts disabled in Editor project settings) | Default 4 | | **Bounces / Max Bounces** | Indirect bounce count; indoor often needs more than outdoor | Start at 2; indoor 2–4; docs warn that very high values explode bake time | | **Filtering** | None / Auto / Advanced post-process (denoiser + Gaussian or A-Trous per Direct/Indirect/AO target) | Auto while iterating; Advanced when chasing detail | | **Lightmap Resolution** | Texels per unit — doubling resolution **quadruples** texel count | See part 3 | | **Lightmap Padding** | Texel gap between charts (default 2) | Raise if chart bleed | | **Max Lightmap Size** | Atlas edge in pixels (default 1024) | 512–1024 mobile/Quest; 2048+ desktop if needed | | **Lightmap compression** | None / Low / Normal / High Quality | Normal for desktop; consider Low/Normal on device memory budgets | | **Ambient Occlusion** | Baked AO with Max Distance, Indirect Contribution, Direct Contribution | Enable for contact shadowing in interiors | | **Indirect Intensity** | Scales baked/realtime indirect in lightmaps (0–5, default 1) | Artistic; keep near 1 for physical-ish | | **Albedo Boost** | Pulls albedo toward white for bounce (1–10, default 1 is physically accurate) | Leave at 1 unless art-directing | | **Lightmap Parameters** | Per-object / default asset for AA samples, backface tolerance, etc. | Default-Medium; specialize per hero props | ### Denoisers (Advanced Filtering) Documented options include: - **Optix** — NVIDIA AI denoiser; Windows; Maxwell+ NVIDIA GPU; driver requirements apply (see Manual). - **OpenImageDenoise** — Intel OIDN; common Auto fallback. - **None** — no denoiser. Prefer **fewer samples + denoiser** while blocking; raise samples for final hero bakes. ## 2.3 GPU Baking Device, profiles, and tiling In the Lighting window after you engage baking controls: - **GPU Baking Device** — if you have multiple GPUs, pick one GPU for baking and keep another for the Editor viewport when VRAM is tight. - **Baking Profile** — drives how aggressively Unity tiles the bake to stay within VRAM. - **Lightmapper tiling** — Progressive GPU can bake in tiles using CPU temporary memory when the full atlas does not fit in VRAM. Docs note that when tiling is active and atlas resolution is **512px or larger**, bakes are often *slower* than an untiled bake of the same scene. **Optimization checklist from Unity's GPU lightmapper page:** 1. Close other GPU-heavy apps (DCC, browsers with GPU tabs). 2. Disable **Contribute Global Illumination** on tiny debris; light it with probes instead. 3. Split render GPU vs bake GPU when possible. 4. Lower Anti-aliasing samples in Lightmap Parameters (default 8; high AA + 4096 lightmaps eats VRAM). 5. Reduce Direct/Indirect/Environment samples and rely on denoising. 6. Lower Lightmap Resolution. Unity also publishes a Progressive GPU Lightmapper **memory spreadsheet** (linked from the Optimize baking page) — use it when planning atlas sizes. ## 2.4 Contribute GI on lights and meshes **Lights** 1. Select each Light that should bake. 2. Set **Mode** to **Mixed** or **Baked**. 3. For Mixed: confirm scene **Lighting Mode** (part 1). **Meshes** 1. Mesh Renderer > Lighting > enable **Contribute Global Illumination**. 2. **Receive Global Illumination**: **Lightmaps** for static receivers; **Light Probes** for dynamic / non-atlased. 3. **Scale in Lightmap** (default 1): multiply this object's texel density relative to scene resolution (part 3). Emissive materials contribute when the renderer contributes GI and the material emission is set up for baking *(exact "Global Illumination" emission flag naming can differ by shader — verify on URP Lit / Shader Graph targets)*. ## 2.5 Lightmap Parameters assets Create via the Lighting Settings **Lightmap Parameters** field (**Create New**) or **Assets > Create > Lightmap Parameters** *(menu path *(unverified — confirm in your Editor)*)*. Typical reasons to customize: | Parameter (conceptual) | Why care | |---|---| | Anti-aliasing Samples | Edge quality vs VRAM | | Backface Tolerance | Reject samples that see backfaces (leaks / black splotches) | | Pushoff | Ray origin offset to reduce self-intersection acne | | Baked Tag / clustering hints | Atlas packing control | Assign **per Mesh Renderer** when a hero prop needs higher quality than the room shell. Official: [Lightmap Parameters Asset](https://docs.unity.com/en-us/engine/6000.6/manual/lighting-overview/lighting-reference/class-lightmap-parameters) (6000.6 docs host at time of writing). ## 2.6 Generate Lighting 1. Fix UVs first (part 3) — baking bad UVs wastes hours. 2. Place probes / APV (part 4) if dynamics need indirect. 3. Click **Generate Lighting** (or the dropdown for partial bakes such as **Bake Probe Volumes** when using APV). 4. Watch **Occupied texels**, **Converged / Not Converged**, **Bake Performance** (rays/sec), and ETA in the Lighting window statistics. Auto Generate (if present in your version) is useful for tiny test scenes and harmful for production — prefer manual Generate on a dedicated Lighting Settings asset. ## 2.7 Editor helper: force Contribute GI on selection > [!warning] Not compiled > The following Editor script was not compiled in Unity. Paths and `GameObjectUtility` / `StaticEditorFlags` usage should be verified in your Editor version. ```csharp #if UNITY_EDITOR using UnityEditor; using UnityEngine; public static class LightingContributeGiTools { [MenuItem("Tools/Lighting/Enable Contribute GI On Selection")] static void EnableContributeGi() { foreach (var go in Selection.gameObjects) { var flags = GameObjectUtility.GetStaticEditorFlags(go); flags |= StaticEditorFlags.ContributeGI; GameObjectUtility.SetStaticEditorFlags(go, flags); foreach (var r in go.GetComponentsInChildren<MeshRenderer>(true)) { // Receive GI mode is a serialized property; prefer Inspector for Receive mode. Undo.RecordObject(r, "Contribute GI"); var so = new SerializedObject(r); var contribute = so.FindProperty("m_ScaleInLightmap"); // smoke-check serialization so.ApplyModifiedProperties(); EditorUtility.SetDirty(r); } } } } #endif ``` Prefer flipping **Contribute Global Illumination** in the Mesh Renderer Inspector for clarity; use menu tools only for bulk static-flag passes. A safer bulk approach is selecting many objects and using the Inspector's multi-edit on the Lighting section. Next: [[3.Lightmap UVs and Texel Density]].