Sprite3D Texture "Smearing" across transparent edge with Linear Texture Filters

Godot Version

4.1.1.

Question

I noticed that the textures on my Sprite3Ds are “smearing” across transparent areas next to where non-transparent colours sit on the edge of the texture. It looks like this (see the black-to-white line right of the top):

texture smearing

In some other cases there’s a white line overlaid where the opaque black pixels butt up against the edge of the texture:

texture smearing 2

It seems this happens when I use any of the three Linear texture filters, and doesn’t happen when I use any of the Nearest filters. I want to use the linear ones for the smoother look, however, so are there any good ways of stopping this from happening? I figure I could include a buffer zone of one completely transparent pixel on all sides of the sprite, but I’m hoping there’s some more systemic way of removing these artifacts that doesn’t require an extra step in the art pipeline.

Thanks!

To avoid this kind of artifact regardless of whether the material is repeating, you need to ensure there’s a 1-pixel line of fully transparent pixels on the edges of your texture.

This artifact can also be avoided by disabling repeat on the material, but Sprite3D currently doesn’t expose this (unlike BaseMaterial3D). See Fix texture artifacts around Sprite3D with linear filtering by Mickeon · Pull Request #86875 · godotengine/godot · GitHub. In the meantime, use a MeshInstance3D + QuadMesh setup and disable Repeat in the Sampling section of the BaseMaterial3D attached to the mesh.

4 Likes

Thanks! For now I don’t have a lot of sprites so I’ve just added a 1-pixel border, and I could potentially automate that in the future. If that workflow becomes too onerous I may look into switching away from Sprite3D for the time being.

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