I’m using a PointLight2D in a top-down pixel game, and the light gradient looks very poor when placed over dark checker backgrounds (visible banding/artifacts).
Things I’ve tried so far:
Different GradientTexture2D sizes (from 64x64 up to 2048×2048).
Custom gradient textures from Photoshop.
The gradient texture provided in the Godot documentation.
Changing filters on the background sprites.
Enabling HDR 2D in Project Settings and applying HDR settings directly to the Light2D.
Fake Sprite lights (doesn’t cast shadows though)
None of these fixed the issue. On solid colors (like blue), the gradient looks okay, but on darker checkered patterns it looks awful.
Why does PointLight2D look so bad on darker backgrounds, and what’s the correct way to get a smooth gradient? I am using shadows as well, as it is a must in my game for aesthetic reasons.
You are running into color banding. Which rendering method are you using? Mobile has lower color precision than Forward+ or Compatibility, so I suggest using those if possible.
That said, Mobile will probably use the same color precision as Forward+ when HDR 2D is enabled in a future release:
It should also be possible to apply Viewport debanding in 2D if you set the background mode to Canvas in the environment, but I haven’t tested recently. However, debanding in Mobile won’t be effective until the above pull request is merged, so you’d need to use Forward+ instead.