Making sense of Anisotropic settings

Is it me, or does everything related to anisotropic in Unity make very little sense? It’s a simple thing, and yet there are many things of how it’s implemented in Unity that I do not quite understand.

The manual is annoyingly vague on the matter. I believe in the latest updates it has become even more so (This page : Unity - Manual: Texture Import Settings redirects you to this page Unity - Manual: Importing Textures which has the exact same info, great!)

So in an attempt to clarify some things, here are some questions I have. Hopefully this thread will also contain answers in the future and we will all know how anisotropic works with Unity:

→ 1a. Why are the settings on the TextureImporter? Isn’t this a sampler thing? What does it have to do with the texture? Shouldn’t the filtering settings be coupled with the material? (my “road material” would need specific filtering settings, regardless of texture, right?). What if I use the texture in many different scenes, but I really want great Anisotropic only in one case?

Is there a technical reason I’m misunderstanding, or is this a weird Unity design decision that doesn’t really make sense but we’ve all accepted because that’s the way it’s been?

→ 1b. and while we’re on the subject, why does changing a texture’s aniso level and hitting “apply” trigger a recompression of the texture? What does the aniso level have to do with compression? Am I missing something and Aniso somehow factors into compression?

→ 2. This page : Unity - Scripting API: Texture.anisoLevel says anisoLevel goes from 1 to 9 where 9 is “full” filtering applied. What does “full” mean? Why does this one go up to 9 instead of up to 16? Is it some sort of magic “1-8 is number of samples and 9 is 16 (or max possible)?”, if so please say so in the docs. And while on that subject what is the range of acceptable values for Texture.SetGlobalAnisotropicFilteringLimits? Is it 1 to 9? 0 to 16?

→ 3. While we’re on the subject: Is there such a thing as anisotropic of x1? What does setting anisotropic to 1 do? How is it different than 0?

→ 4. Also on the TextureImporter, : aren’t Bilinear/Trilinear/Aniso mutually exclusive? Why can I set Aniso of 8 and then also choose between Bilinear and Trilinear? What does Bilinear + Aniso do?

On Windows it does absolutely nothing. On a Mac, it does change things (Aniso + Bilinear has harsher mip changes, higher aniso levels push changes further back but they are still harsh), so I guess that’s why the setting’s there, but how does that work exactly? (and where can I find more info?)

→ 5. For that matter, what do all the non power of 2 values do? Does there exist a GPU that accepts non power of two aniso samples? (or is the number not setting samples and it’s something else? Again the manual says nothing other than “higher value → sharper”… Thanks manual)

On Windows it seems absolutely nothing changes between values 4 to 7. But again on a Mac they do. Do Macs support non power of two aniso sampling? Or is something else happening? Is the Mac implementation of Anisotropic super weird and Unity’s Mac heritage is showing here? (which would somewhat explain why lightmaps default to an aniso level of 3)

When Unity was originally created, the texture and sampler state were a combined thing. Them being separate things for GPUs didn’t happen until ~2007 with DirectX 10, which Unity never supported. OpenGL didn’t support it until 2010 with OpenGL 4.0 & 3.3, and Unity didn’t support OpenGL 3.3, 4.0, or D3D11 until ~2013. Most OpenGLES implementations out there still don’t support it.

So, basically, because some of the platforms Unity supports don’t support separate textures and sampler states, it needs to to be set on the texture asset directly.

Nothing. It’s just Unity always recompresses an image when the settings file for a texture changes. If you go into Play mode and modify the filter settings they update immediately… but apply still recompresses.

The documentation is wrong. Or more specifically out of date. AFAIK the way it worked changed between Unity 4 and Unity 5, but the documentation wasn’t updated. It’s a value between 0 (off) and 16 (max for all modern GPUs) now.

0 and 1 are the same for global limits and disables anisotropic filtering. On a texture it controls if the Anisotropic Force On option in the quality settings applies to that texture or not. Otherwise an anisotropic level of 0 or 1 is the same as no anisotropic filtering.

I’ll answer all of these questions with: it depends on the hardware & drivers.

There’s no such thing as “Bilinear” and “Trilinear” filtering. At least not in terms of graphics APIs having those as fixed settings. Rather you set how to handle the filtering of texels (point vs linear), and how to handle mip transitions (point vs linear). Bilinear is linear texel filtering and point mip transitions. Trilinear is both linear. Point filtering is both using point. You can do point texel filtering with linear mip transitions, but no one really does it.

Anisotropic filtering is a separate setting. How the GPU uses that setting is up to the GPU. Some GPUs once you set the aniso level above 1 it forces linear mip transitions, others don’t. Some GPUs only support even numbered aniso levels, others only power of 2 levels, others any value. Unity just sets the value, and the GPU and drivers do with that value what it will.

4 Likes