In this lesson, you will learn how to deploy Light Probe Groups to capture static lighting data and apply it to moving characters and objects within your scene.
The Challenge of Dynamic Lighting
When you bake static lightmaps using the Progressive CPU Lightmapper, your static geometry receives beautiful, complex lighting. However, dynamic objects like characters or moving platforms ignore these maps. Without extra help, a player character will look "flat" or disconnected from the environment because they cannot receive the indirect light (bounced light) calculated during the bake.
Deploying Light Probes
Light Probes act as "probes" in space that record the light intensity and color reaching that specific point during the bake process. To implement this, you add a Light Probe Group component to an empty GameObject in your scene.
- Placement: Position the probes to define a volume around areas where your dynamic objects will move. You should place them densely in areas with high lighting contrast (like doorways or near colored walls) and sparser in open, uniformly lit areas.
- Tetrahedral Interpolation: When a dynamic object enters the volume defined by the probes, Unity calculates the lighting at the object's position by interpolating the data from the surrounding probes in a tetrahedral grid.
- Automatic Application: As long as your object’s
MeshRendererhas Light Probes set toBlend Probes(the default), Unity automatically applies this interpolated spherical harmonic lighting data to the object’s material.
Implementation Example
You do not need to write code to apply the lighting; the system is handled by the engine. However, you can ensure your character is properly picking up the light by verifying the Light Probe Usage setting in the MeshRenderer:
// Ensure the renderer is set to receive baked light probe data
void Start() {
MeshRenderer renderer = GetComponent<MeshRenderer>();
renderer.lightProbeUsage = UnityEngine.Rendering.LightProbeUsage.BlendProbes;
}
By placing probes strategically throughout your environment, you bridge the gap between static baked lighting and dynamic movement, ensuring your characters feel grounded in the world’s atmosphere.
Key Takeaway: Light Probes bridge the visual gap between static lightmaps and dynamic objects by sampling baked lighting data from pre-defined volumes in space.