PointLight2D texture is compressed/artefacted?

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

I’m using Godot 4.0 beta 3. This issue doesn’t exist in Godot 3.44.

I need to do some pretty technical things with shaders, and I want to store height data as textures in world space with PointLight2Ds. Everything is working well now, except for one unexpected thing I can’t avoid. The shader I’m using needs accurate values, but the texture I put in the PointLight2D is wrong (not sure if it’s compressed?).

Comparison of texture in Sprite, PointLight2D and shader global uniform sampler2D

The Sprite on the left displays everything fine. In the middle I have a PointLight2D set to ‘mix’ mode with the texture, which should result in something identical. Except it’s not. The rows near the bottom have been flattened and the gradient doesn’t go all the way down. I don’t know if this is compression. It’s not like the darkest few shades are being ignored, as the columns still have the right gradient with the same values.

When the texture resource was imported, I made sure the compression mode was ‘VRAM Uncompressed’. I also tried ‘Lossless’ and all the others. The only thing that got rid of this artefact was setting the compression mode to ‘Basis Universal’ with Mipmaps enabled.

Texture imported with 'Basis Universal'

This still doesn’t work for me though, as the image resolution is changed and there’s blurring, which is unsuitable for 2D pixel art and the light won’t line up with the sprites for computation.

Hi,

Have you managed to fix this?
It might be linked to my issue https://forum.godotengine.org/149148/blurry-texture-image-in-shader but I can’t find a way to fix this… I try setting everything to lossless, Nearest, reimporting the image, nothing works…

bl0ggy | 2023-03-11 23:32