Artifacts with alpha texture?


#1

OK guys, anybody messed with alpha textures. When I hit play I get white artifacts. They don’t show up in GIMP or if I switched to render mode in blender. Any idea how to solve this? I know in blender game engine there is alpha clip, which clips any kind of artifacts.

Armory, artifacts

OK, solved it with this thread Transparency Tests


#2

The solution in that thread involves discarding, which gives sharp edges. But you should still be able to use alpha blending to get soft edges.

Those white fringe artifacts are usually related to the premultiply-alpha option. See if changing it in Blender makes a difference:
https://docs.blender.org/manual/en/dev/editors/uv_image/image/image_settings.html


#3

@RNavega I’ll check that out and see if it helps.

Edit:
Yeah, made no difference on either setting, unless Armory just wasn’t refreshing the changes. The only way I can get rid of that is the Discard option in Armory settings.


#4

Okay, after some more research.
In your particular case (mesh with texture), this is happening because of GPU filtering.

When your textures are interpolated (and they usually are, to get them looking smooth), not only the alphas of the pixels are interpolated but their colours as well.
So you might be getting a soft edge from your semitransparent textures because the pixel alphas are being interpolated, like for that foliage texture. But the colours of the edge pixels will also be interpolated with any adjacent pixels, including the fully transparent ones. Those transparent pixels might have some crazy colour like pure white, black, grey etc. giving that fringe.

To solve this problem you need to bleed all the edge pixels of your semitransparent textures. You can do this in several ways, the most easy being to open the texture in an image editor, duplicate the layer several times, put those copies below it and blur those copies, then merge everything back together (remember to keep one layer copy untouched so you can use it as a selection mask to restore the transparency to what it should be).

This is in Eevee, with alpha-blend mode and clip shadows: