Found a weird glitch and need help

Godot Version

Godot -4

Question

For some odd reason, the game crunches up this PNG as if it was some JPG. As you can see, the top is what it look likes in game, and the same file looks perfectly ok when viewed somewhere else like Aseprite or the image viewer for some reason.

What I don’t want

What I want

Make sure that your texture filters are set correctly.

Go to Project Settings → Rendering → Textures → Default Texture Filter
and set that to be “Nearest”

I suspect that’s actually texture compression; when Godot loads a texture, by default it loads it to a compressed format, and the compressed formats are kind of bad for images like this. The banding in the gradients definitely looks like an artifact of that.

In the texture import settings, tell it to use uncompressed textures, and I bet this goes away.

1 Like

Thx, I will check that out!

I would not recommend that as it requires them to do this with every single texture they import individually. It’s much easier / better, if it’s a pixel game, to set the Default texture filter in the project settings instead. Otherwise there might be issues later on with project size as well.

It’s not a texture filter problem. Look at the banding in the gradients on the big crystals, for example. That’s your classic 4x4 block compression scheme screwing up in the standard way.

Edit: The way a lot of these schemes work is to divide the texture up into fixed blocks, often 4x4 pixels. For each block, they define a gradient as two endpoint colors, and every pixel is mapped to a two bit position (0.0, 0.33, 0.67, 1.0) on the gradient. That can work surprisingly well for a lot of textures, but for things with smoothly blended gradients like this texture you can get quite visible artifacts.

That’s also probably why the little highlights on the green/blue “rocks” have developed rectangular off-colored sections around them; it’ll be taking the border color and the highlight color and trying to map everything in that block to a 2 bit gradient between them, which screws up the background color.

If you’re using art like this, particularly pixel graphic art where the size of the compression block is fairly large relative to the feature scale, texture compression is likely not your friend.

Wait, where can I set how the engine imports the file?
Also, great explanation BTW.

There is an “Import” tab next to your “FileSystem” tab.

I don’t use Asperite but does your exported (!) png look like you want it to? Because Asperite might also “crunch” your gradients upon export to fit the pixel size?


Thank you everyone so much!
Hope you all a good day!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.