# 5. Reflection Probes and Environment Lighting Part of [[Lighting and Baking]]. Previous: [[4.Light Probes and Adaptive Probe Volumes]]. Next: [[6.Mobile and Meta Quest Considerations]]. Diffuse GI lives in lightmaps and light probes / APV. **Specular** environment response on glossy materials comes from **Reflection Probes** (and the sky cubemap when no probe blends in). Official: [Reflection Probe Inspector](https://docs.unity3d.com/6000.0/Documentation/Manual/class-ReflectionProbe.html) · [boxProjection API](https://docs.unity.com/en-us/engine/6000.0/script-reference/unityengine/reflectionprobe/boxprojection) ## 5.1 Create a Reflection Probe 1. **GameObject > Light > Reflection Probe**. 2. Position at the visual center of a room or zone (not inside a wall). 3. Set **Box Size** / **Box Offset** to enclose the space that should share this reflection. 4. Choose **Type**: Baked, Custom, or Realtime. ## 5.2 Types | Type | Behavior | Use | |---|---|---| | **Baked** | Captures objects whose Reflection Probe Static contribution is enabled (per Manual: does not capture objects with Reflection Probe Static disabled). Baked into cubemap assets. | Interiors, static levels — default for production | | **Custom** | Supply a cubemap, or bake with **Dynamic Objects** forced in | Authored HDRIs per zone; rare dynamic exceptions | | **Realtime** | Re-renders the cubemap at runtime | Moving mirrors, highly dynamic sky transitions — expensive | ### Realtime options (Inspector) - **Refresh Mode:** On Awake / Every Frame / Via Scripting. - **Time Slicing:** All Faces At Once (≈9 frames) / Individual Faces (≈14 frames) / No Time Slicing (one frame) — spreads cost. Prefer **Baked** everywhere you can. If you need occasional refresh, **Via Scripting** + time slicing beats Every Frame. ## 5.3 Runtime Settings that matter | Property | Notes | |---|---| | **Importance** | Higher wins when objects are inside multiple probes; also affects blending | | **Intensity** | Scales probe contribution in the shader | | **Box Projection** | Parallax-correct reflections for interior boxes — **also enable on the URP Asset** (Lighting > Reflection Probes > Box Projection) | | **Box Size / Offset** | Influence volume **and** box-projection bounds — match the room | **Box Projection workflow** 1. URP Asset: enable **Box Projection**. 2. Probe: enable **Box Projection**. 3. Fit Box Size to the floor/walls/ceiling of the room (not a tiny cube at the probe origin). 4. Compare a chrome sphere in the room corners — with box projection, reflections should feel anchored to walls. ## 5.4 Cubemap Capture Settings | Property | Notes | |---|---| | **Resolution** | Power-of-two cubemap face size. 128–256 often enough on mobile; 512+ desktop hero rooms | | **HDR** | Keeps highlight range; storage as OpenEXR vs PNG per docs | | **Shadow Distance** | Overrides Quality shadow distance during capture | | **Clear Flags / Background** | Skybox vs solid color | | **Culling Mask** | Exclude ephemeral FX layers from baked reflections | | **Use Occlusion Culling** | Skip occluded geometry during capture | | **Clipping Planes** | Near/far of the capture camera | Bake probes after the lightmap bake settles (reflections should see final lit materials). Re-bake probes when you change sky, major albedo, or emissive set dressing. ## 5.5 Blending and importance Objects between probes blend based on proximity / importance (pipeline-dependent detail). Overlap probe volumes slightly in corridors; avoid ten probes overlapping a single hallway with conflicting Importance values. Script refresh example *(not compiled)*: ```csharp using UnityEngine; using UnityEngine.Rendering; public class ReflectionProbeBakeOnDemand : MonoBehaviour { public ReflectionProbe probe; public bool timeSlice = true; [ContextMenu("Refresh Probe")] public void Refresh() { if (probe == null) probe = GetComponent<ReflectionProbe>(); if (probe == null) return; // RenderProbe returns an ID; completion can be waited via IsFinishedRendering var id = probe.RenderProbe(); Debug.Log(quot;ReflectionProbe.RenderProbe id={id}, timeSlice={timeSlice}"); } } ``` Exact realtime refresh best-practice (time slice flags, `refreshMode`) should be confirmed against the ReflectionProbe scripting API for your Unity version. ## 5.6 Environment lighting / sky / ambient Open the Lighting window **Environment** (or Environment tab / section depending on version): | Control | Role | |---|---| | **Skybox Material** | Backdrop + environment specular when probes do not override; feeds Environment Samples during bakes | | **Sun Source** | Directional Light used with procedural skies *(if using a procedural sky setup)* | | **Environment Lighting Source** | Skybox / Gradient / Color — ambient diffuse term | | **Environment Reflections** | Source and intensity/compression for default reflection cubemap | | **Fog** *(if not fully deferred to Volume overrides)* | Distance readability — in URP often driven by Volume stack | **Bake interaction** - Bright HDR skies need more **Environment Samples** (part 2). - Importance Sampling (Lightmapping settings) can speed environment convergence but may look noisier in low-frequency environments — documented as disabled by default. **URP Volumes** Exposure, color adjustments, and fog typically live on **Volumes**, not only the Lighting window. Keep environment intensity and Volume Exposure coherent so baked maps are not authored under a different EV than runtime. For custom full-screen looks, see [[URP Shaders and Shader Graph]]. ## 5.7 Particles and reflections Particle lights and emissive VFX can blow out probes if included. Cull FX layers from probe captures, or bake probes before enabling noisy realtime VFX. Layered fire/smoke setup: [[Particle Systems and Layered Effects]]. Next: [[6.Mobile and Meta Quest Considerations]].