[Problem] After building my game for WebGL, lighting does not work properly

Hi there,

As the title states, my lighting does not work properly in a WebGL build I created.

So the game looks like this in the editor:

After building the game and then running the file in the browser, there is almost no lighting:

I tried manually generating the lights and then rebuilding, but the issue persists.

Does anyone know how I can solve this issue?



What type of light source do you use?

Maybe it is a good idea to simply bake the static lights as they are nothing but decoration and do not affect anything anyway. Baked lights will also improve the performance of your game.


I tried baking them, but the time required for baking was too much, so I don’t know if the solution above works or not.


Is there any way to reduce the baking time?

Also, my main light source is a directional light source and some levels have multiple point lights that intersect each other.

Here is an example of one level:

For each light source, the computer has to calculate how it affects the environment. The more lights you have, the slower everything will be. Since you reuse the tiles in the background and on the floor, you could create the meshes in Blender, bake a texture there and import the wall tile with the texture. Then you can duplicate the wall tile to achieve the same result.

You could reduce the resolution of the lightmap.

And you could try to decrease the graphical quality of your game:


Directional lights do not work in WebGL.

I tried what you stated, except the Blender option since I do not know Blender, but the baking times remained too large. I also found another link that told of methods to reduce baking times, but that didn’t work. :confused:

I might be asking to much of you and I know you’re busy, but would you be willing to check my project yourself for the problem, as in I send you the project files?

If you are not willing too, it is totally fine and I understand.

I appreciate your time and help.

Unfortunately, that’s not possible. With more than 250,000 students to support, we cannot provide individual support.

You are trying to achieve something for which you actually need a powerful computer. You could try to increase the Pixel Light Count in the Quality Settings. Maybe that makes the realtime non-directional lighting visible.

See also:

I understand that. I just thought to myself “There’s no harm in asking”.

I also tried increasing Pixel Light Count and that didn’t also work.

Well, as you said my computer is to blame then and I can agree with that. It is an old model (a late 2012 iMac to be specific). I’ll just leave my game as it is then or just create a PC/Mac/Linux standalone.

Thanks for your time and help though for providing me with solutions Ms. Morawietz. I appreciate that. :slight_smile:

At some point, it’s advisable to learn baking or creating one’s models in Blender (or Maya, or whatever you prefer) because this is where the “real” game development starts. Creating pretty art is just a part of the visual part of a game. The rest is about optimising, optimising, optimising so the game will work on a weak device, too.

I don’t know if I mentioned it but your design looks really beautiful. I hope it’ll work at least in a standalone build. If it does not, please let me know.

Also please feel free to ask our helpful community of students for advice in our official Discord chat.

I see, will definitely start learning a computer graphics software later down the road.

:blush: Thanks. That means a lot. Gives me motivation. Standalone worked as well.

I’ve been using discord regularly. It is a great resource.

This topic was automatically closed after 14 days. New replies are no longer allowed.

Privacy & Terms