Spot lights in WebGL

Edit: Sorry, I’m talking about point lights, not spot lights.

My Unity 2021.1.24f1 app is exported for WebGL and “PC, Mac & Linux Standalone”, so it has to work for both but I’m having problems with my point lights when the project’s set to/exported as “WebGL”:

The room I’m currently working on is pretty long and uses 3 point lights for lighting. On one end there’s a portal (used to enter/leave the room) that’s a simple plane with a “flowing lava”-type shader.
In the editor the point lights look fine but in the exported WebGL version (tested with the latest Firefox) the lights keep flickering and sometimes go out completely, depending on the player position and the direction it (=the camera) is facing.

The point lights were all set to “realtime” but I noticed that “realtime indirect bounce shadowing is not supported for Spot and Point lights”, so I set the “indirect Multiplier” to 0, generated new baked lightmaps, then tested it again:
It’s still the same: The first (-20,9,0 - as a non-static child of the static room object) and third light (20,9,0) are only visible if the player is pretty close to it and only if the camera is looking specific directions. The light in the middle (0,9,0 but also x,9,0 in world coordinates) is always there and never flickers (as far as I’ve seen).

Is this a bug or a setting based problem?

I can’t set the lights to “baked” because the portal and the player would then be dark. I haven’t exported the app with “mixed” yet because the baked light textures on the walls have square artifacts and there’s a weird shadow line in the edge where the wall meets the floor that makes it almost look cel-shaded - so not sure if that setting would fix the flickering problem.

What settings do I have to change to fix the bad baked lightmaps, without turning the images into 100+mb files (3files, currently 20mb in total)?

Point light and lightmap settings:
7903939--1007197--1-PointLightSettings.PNG

I suspect that you might be hitting Pixel Light Limit, and some of those lights are reverting to back to vertex lights. You can increase the Pixel Light Limit in the project settings.

1 Like

@kristijonas_unity
I already set the “Pixel Light Count” to “4” (3 point lights in that room, 1 in another) a while ago but checked again and it looks like I actually only set it for the “Ultra” quality, which is used for the “Windows, Mac, Linux” platform. WebGL uses “High” (clicking on that difficulty actually changes it in the scene tab) and I noticed the same flickering there while moving around. Increasing the count for that quality too fixed it. Thanks!

Do you also happen to have a tip for the actual point light setting to get rid of the “Realtime indirect bounce shadowing is only supported for Directional lights” warning in Realtime mode? Should I just set the “Indirect Multiplier” to “0” (instead of the default “1”) or use “Mixed” instead (how do I then get rid of the square artifacts?)?