Light overlap draw mode is useless ?

From the docs of GI visualization:
If an area of the level is lit by more than four static lights, the exceeding lights will fallback to fully baked and be displayed in red

Please explain how these red zones can be useful if the restrictions are completely different?

From docs of Mixed Lighting:
If more than four Lights intersect, the excess Lights fall back to Baked Lights

In other words – ‘area of the level’ can be lit 50 mixed lights, but while they don’t intersect between each other with groups larger than 4 lights – you’ll have no problems! Everybody can prove it by yourself.

Hi

I don’t think I really understand your question. The light overlap is a debug mode that a lot user has found helpful, and it pinpoints a problem that has to do with certain restrictions. You can always work around it.

But here’s an example that I saw in a users project a while back. They had a corridor with a lot of lights in it, and for some reason a few of them just turned out baked. I showed them this debug mode, and they saw that the lights that were red were in fact the ones not being mixed anymore. They were not able to move the light further apart (mostly due to that it wouldn’t look nice), so they could instead figure out other solutions, or maybe just mark some of them as baked manually to have more control.

Cheers :slight_smile:

/ Lighting Team

I’ll show you. Here is the building with approx 40 mixed lights.
If you look at the Light Overlap image - the situation is very bad.

But in reality, there is not a single overlap of more than 4 mixed light sources in space.
After the baking – none of mixed turned to baked.

A simple script to check overlaps:

  [MenuItem("NE/Check Lights Overlap", false, 0)]  
    static void                        check_lights_overlap                    ( ){
        GameObject    obj             = Selection.activeGameObject;
        if( obj==null )                return;
        Light[]        lights             = obj.transform.root.GetComponentsInChildren<Light>(true);
        int         total             = 0;
        foreach( Light l in lights ){
            if( l.lightmapBakeType!=LightmapBakeType.Mixed )        continue;
            int     num             = 1;
            string     str             = l.name;
            foreach( Light l2 in lights ){
                if( l==l2 || l2.lightmapBakeType!=LightmapBakeType.Mixed )    continue;
                float    range         = Vector3.Distance ( l.transform.position, l2.transform.position );
                if( range>(l.range+l2.range) )    continue;
                num        ++;
                str                 += ", "+l2.name;
            }
            if( num<5 )                continue;
            total     ++;
            Debug.LogWarning        ( num+" lights overlaps: "+str );
        }
        if( total>0 ) EditorUtility.DisplayDialog ( "NE", total+" overlaps errors found.\nCheck console for \"lights overlaps\" warnings", "Close" );
                 else EditorUtility.DisplayDialog ( "NE", "No overlaps found", "Close" );
    }

Hey! If you are using Baked Indirect or Subtractive lighting modes, then you are not limited by the 4 overlapping lights limitation imposed by the Shadowmask mode. Even if you have overlaps in your scene, (which you do, as evident from the screenshot - your script most likely fails to catch them), all your mixed lights will still remain mixed - none of them will be converted to baked lights in the end.

Please check your lighting settings and try switching between different lighting modes. You should see the difference right away, when inspecting your scene in the baked lightmap view.

If you have a directional mixed light in your scene, it counts towards the limits, as its range is infinite.
Also, the baking process will not change the value shown in the inspector to baked in case of a fallback. You can check the baked lightmap view - if direct lighting from the marked light sources is in there, they’re baked.

I’m using Shadowmask of course

Yes, there are directional mixed light in the scene. Is that the cause of the red overlaps?
In other words – in case of directional mixed – overlap limit for point lights is 3 ??
But again – after baking lighting – none of mixed point lights was turned to baked.
Checked it a lot of times.

The shadowmask texture has 4 channels available, so that’s where the limit comes from. A shadow casting mixed directional light is global, so one of those already permanently reserves one of the channels, which leaves you an additional 3 channels for your point lights. Do all lights in your scene cast shadows?

Confirmed, yes.
Okay, in the my scene I have a lot of indoor locations, not exposed to the Sun. For them I set Layer ‘Indoor’ and respectively – for the Sun I set culling mask ‘all except Indoor’. So I can expect lighting of the indoor surfaces with 4 mixed light sources, but It’s still 4-1. Why ?

1 Like

The lightmapper does not carry any information about culling masks, so partitioning the scene in the way that you do it unfortunately won’t yield your desired result.

Looks like a big opportunity to improve Unity.

We’ll add it to our backlog.

2 Likes