How to get rid of texture artifacts?

Hello guys,

is it possible to eliminate the texture artifacts which appear when using detailed textures? I encounter this problem with many materials but I don’t know how to fix that. The artifacts look like shadow acne - there I can tweak the bias. But in this case there is no shadow - just IBL. I tried to adapt the camera.minZ but this didn’t help.

Do you have any idea?

some postprocess can save you

2 Likes

@avin

Wow! That’s impressive.

Can you explain how to use it in babylon? That would help me a lot.

Best

try to play with anisotropicFilteringLevel param of texture

1 Like

I can’t see any difference after increasing it. I tried several values: https://playground.babylonjs.com/#G3EH42#1

I remember I had similar question - Strange artefacts on cloth texture
And the problem was with how the texture was applied in DCC, after correction everything was fine. (As far as I remember there was wrong or flipped UV).

2 Likes

Your problems come from the sampling mode: it is “linear/nearest & linear mip” whereas it should be “linear & linear mip” == tri linear sampling mode (for all 3 textures albedo, metallic & normal).

image

You can change these values afterwards, but it would be better to set the right value in the glb file, at export time:

https://playground.babylonjs.com/#G3EH42#3

2 Likes

Thank you! Changing the sampling mode to tri linear definitely improved it.

Which sampling mode is necessary to have an effect of increasing the anisotropicFilteringLevel? If I understood it correctly there is bi linear, tri linear and anisotropy texture filtering. So I have to set the sampling mode to the anisotropy one to make use of it or am I wrong?

Do you have any clue how to change the texture filtering in blender? At my image texture node I can choose between linear, closest, cubic and smart but every option besides linear looks terrible.

Anisotropic filtering level is an additional setting in addition to the sampling mode. However, to enable it you must choose a sampling mode of either:

  • Constants.TEXTURE_LINEAR_LINEAR_MIPNEAREST
  • Constants.TEXTURE_LINEAR_LINEAR_MIPLINEAR (== Constants.TEXTURE_TRILINEAR_SAMPLINGMODE)
  • Constants.TEXTURE_LINEAR_LINEAR

However, you don’t want to use the last one because it does not enable mipmapping, and so you will get bad results even with anisotropy. First two produce the same result it seems, so choose the one you prefer.

Note that the maximum value for anisotropy is engine.getCaps().maxAnisotropy (often 16).

I think you can’t set the sampling mode of textures in Blender when exporting to gltf. There is a thread about that in this forum but I can’t find it again…

2 Likes

Thank you for this information. Very helpful!