godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
87.37k stars 19.63k forks source link

Texture Padding in tileset causing visual glitches #90545

Open luiscesjr opened 3 months ago

luiscesjr commented 3 months ago

Tested versions

System information

Windows 11 - Godot 4.2.1 - Vulkan Mobile renderer (Same happens in forward +)

Issue description

First of all, the Tilemaps I add to my tileset always become transparent. To fix this issue I have to disable "Use Texture Padding" as seen here:

image

And here with the option checked:

image

Now, after this "quick fix", when play testing I have many lines between the tiles on screen, as shown here:

image

What I tried to fix this:

Reimport the texture as lossless and set to generate mipmaps. The problem is, apart from not being ideal for a mobile game, while Texture padding now works, I still have few lines in some tiles like here:

image

Unfortunately I cannot share my tileset since it's a paid asset with licensing, but I'll do my best to add more to this discussion.

Edit:

Now I've noticed that after setting back to Vram compressed I get an error in the editor "Cannot blit_rect in compressed or custom image formats." Which is the culprit of not being able to use a VRAM compressed image and texture padding. Still that brings the line bugs from above.

Steps to reproduce

Import a vram compressed texture in a tileset.

Minimal reproduction project (MRP)

Can't share I'm afraid.

luiscesjr commented 3 months ago

To add here, without having to edit once again my first post:

I fixed the final issues, I had more tilemaps added to the tileset, so the other textures had to be also changed to lossless. Now I have no more lines, but this takes me to another question as to those lines being present in the Vram compressed texture is still considered a bug or is it expected?

Because in my case, this is with the lossless memory usage:

image

And here Vram Compressed with bugs:

image

And this in a tiny scene, with very few tiles. It's necessary to have Vram comrpession in my opnion, even more in my case exporting to android. So I'm hoping it's a bug =D

KoBeWi commented 3 months ago

See #83423 Padding requires image modifications, which is not possible when the image is compressed.

luiscesjr commented 3 months ago

See #83423 Padding requires image modifications, which is not possible when the image is compressed.

Ok, I understand this, thanks for the clarification.

But I don't really need it, the main problem here is that when using compressed textures, the rendering flickers even when setting the filter to nearest. And using uncompressed textures and having a 2D game rocket the video memory usage is not sustainable.

Maybe there is a workaround I'm not familiar with? Maybe I have to modify somehow my textures to work with this?