Hello! I would like to know is it normal that anisitropic fitering affects on mip selection by tex2Dlod?
If I turn off AF lod selection is linear, but if AF enabled mips changed not linear.
I use tex2Dlod for glossy reflections and AF does banding artifacts;
Generally it’s expected that using tex2Dlod disables anisotropic filtering entirely as derivatives aren’t guaranteed to be valid, so a direction for the anisotropic filtering to use won’t be available.
However, anisotropic filtering also enables trilinear filtering as it is an extension of the later. It’s possible that when you disable anisotropic filtering your cubemap is using bilinear filtering?
Anisotropic filtering on cubemaps is also a special case that functions a little differently. Almost every GPU architecture acts a little differently on how they’re handled, even among the same manufacturer. So it’s also possible there’s just a straight up bug here on the drivers or GPU itself.
Hello! This is not a cube map this is a simple 2d texture. We generate ktx texture external. And trilinear filtering is always on.
I just curions is it Unity bag or normal behavior in 3d grahpics.
Aslo on android (gles 3) behavior is the same.
P.S. I realize this is happen only with external textures!
My experience with tex2Dlod and anisotropic filtering has always been that there wasn’t any difference between Trilinear and Anisotropic, but I also didn’t look that closely. Only enough to see that anisotropic filtering was no longer working at glancing angles where it is supposed to help.
I might suggest using RenderDoc to see what the difference between the Unity texture and the external texture is.
I tested this and can confirm what you’re seeing that a texture with anisotropic filtering does look different than trilinear filtering when using tex2Dlod. I would say it’s probably “working as intended” in that anisotropic filtering on GPUs don’t use the technique as described by the original specification for anisotropic filtering, but one of several published and/or proprietary approximations. Thus it’s not too surprising that using tex2Dlod will not necessarily produce identical results between trilinear and anisotropic filtering, even though the “spec” implementation of anisotropic filtering should.
In short, don’t enable anisotropic filtering on textures you intended to sample via tex2Dlod if you don’t like the way it looks. If you’re not aiming for Android or old iOS devices, maybe look at using explicit inline sampler states if you need the texture to have anisotropic filtering most of the time, but need to disable it.
Now I realize, an external texture has a hidden aniso attribute always 1, so the aniso settings influenced on mips. If set aniso to 0 then the interpolation will always be linear.