Light probes inconsistent

Hi

I have been testing adding light probes to a scene. In general it works but there is a mesh that doesn’t seem to work. The screen photos are below. No matter how I move the door it’s inconsistent and does not match or come close to the lighting. I added a cube to the scene where the door is so you can see how a object is affected.

The door looks single tone like it’s not being lighted by the light probe properly. Any thoughts? The door is set as non-static as the objects are statics. The cube is non-static.

Vivienne




My lightmap settings and probes in that area. I am also trying to use this script after I reload a new light map.

// Regene

// Regenerate
    void RegenerateLightProbes ()
    {
        Color m_Ambient = Color.black;

        // Get Spherical harmons
        SphericalHarmonicsL2[] bakedProbes = LightmapSettings.lightProbes.bakedProbes;
        Vector3[] probePositions = LightmapSettings.lightProbes.positions;

        // Get Light Probe count
        int probeCount = LightmapSettings.lightProbes.count;

        // Get all Light types
        Light[] m_Lights = GameObject.FindObjectsOfTypeAll (typeof(Light)) as Light[];

        // Clear all probes
        for (int i = 0; i < probeCount; i++)
            bakedProbes [i].Clear ();

        // Add ambient light to all probes
        for (int i = 0; i < probeCount; i++)
            bakedProbes [i].AddAmbientLight (m_Ambient);
       
        // Add directional and point lights' contribution to all probes
        foreach (Light l in m_Lights) {
            if (l.type == LightType.Directional) {
                for (int i = 0; i < probeCount; i++)
                    bakedProbes [i].AddDirectionalLight (-l.transform.forward, l.color, l.intensity);
            } else if (l.type == LightType.Point) {
                for (int i = 0; i < probeCount; i++)
                    SHAddPointLight (probePositions [i], l.transform.position, l.range, l.color, l.intensity, ref bakedProbes [i]);
            }
        }
        LightmapSettings.lightProbes.bakedProbes = bakedProbes;
    }

    // AddPointLight
    void SHAddPointLight (Vector3 probePosition, Vector3 position, float range, Color color, float intensity, ref SphericalHarmonicsL2 sh)
    {
        Vector3 probeToLight = position - probePosition;
        intensity = intensity / 2;

        float attenuation = 1.0F / (1.0F + 25.0F * probeToLight.sqrMagnitude / (range * range));
        sh.AddDirectionalLight (probeToLight.normalized, color, intensity * attenuation);
    }


Light probes are only passing a “single tone” to each object. That’s how they work. More specifically light probes are a sphere of light affecting a single point in space with no knowledge of light distances or positions, only direction to that point. Your door is being lit like it’s a tiny point at the center. If you move the box you’re testing with to the center of the door they’ll both have the same approximate lighting across the entire surface.

For what you’re doing if you want the small lights on the floor to affect the door locally you’ll either need to use real time lights or light probe proxy volumes.
https://docs.unity3d.com/Manual/class-LightProbeProxyVolume.html

Each object only gets 1 interpolated probe value. Probes use spherical harmonics so they are bad at any direct light unless you use a high density probe proxy like bgolus said.

You can place the door on a seperate layer and use realtime lights to only light that door specifically. That might do it without killing too much performance.

There are only two to three doors that move so I put some proximity volumes then changed the closer lights to them to realtime. So it helped without doing extra layers.

I went with a different solution. I’m going post a video on my youtube channels as I am open to recommendations.

This video of my solution then latter shows the emergency lightmap and the end the power lightmap.