Unexpected behaviour when using Light2D with GLES3/GLES2

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By mrabrams

Hey!

I’m quite new to Godot, and am running into issues with Light2D. Since I’m unsure if I’m doing something wrong, I’m posting this question here before submitting a bug report.

A bit of background on the project:
Godot version: v3.2.1
Game type: 2D
Render engine: GLES3
Targeted platforms: Mac, HTML5
Development platform: Mac

In the project I’m working on, I have a KinematicBody2D with an attached Light2D. The light 2D has a PNG texture, a color and the mode is set to Add.

One of my target platforms is HTML5 (itch.io), so to get it running on Mac, I had to change the render engine to GLES2. Upon changing, I saw that the behavior for the light is completely different, so I’m unsure if this is intended behavior, something I’m doing wrong, or an issue to report.

Here’s a quick screencap of the difference. These are both running directly from Godot (within the editor the issue appears worse, but it’s a preview so unsure it’s really an issue):
screenshot

Thanks!

:bust_in_silhouette: Reply From: Ertain

Maybe it has something to do with how GLES2 handles lights? There’s also differences in blending, as found in this article. For textures with an alpha channel, reimport them in ”Uncompressed, Lossy or Lossless compression mode". It also says that blend shapes are unsupported in GLES2.

That’s an interesting point! After a lot of testing, I realized that the light size and texture scale were causing most of the issues.

Eventually I sorted the issue by using this setup (should it be useful to someone later on):

  1. Use a larger Light2D to illuminate the background and work with other light occluders
  2. Add a Texture node to simulate the tint the light was causing on the Sprite
  3. Change the light mask on the sprite so the light doesn’t affect it.

Thanks again for the suggestion!

mrabrams | 2020-05-27 08:44