eli5: What is Antisotropic Filtering and what does increasing or decreasing the stat do?


Its a stat I’ve seen in all video games in the graphics section, along with another filtering one I can’t recall. What does it do?

In: 0

It is a post processing step on texture rendering.

Textures are two-dimensional images that give color and a sense of realism to objects. For example, if you have a brick wall in-game, a texture over it might be a two-dimensional photo of an actual brick wall. This gives it color and accentuates when the bricks meet at mortar lines.

Because they are two dimensional, they are most realistically rendered when orthogonal to the camera – ie the brick wall looks best when looking straight at it, perpendicularly (same angle as the photo was taken). It becomes worse when the surface is at a higher angle – ie if looking at the wall on a long hallway. This is because of a differential in resolution and detail required that the texture doesn’t necessarily have, and that your screen can’t necessarily render (there’s a limit to pixel size).

So without filtering of the texture, you’d be able to make out the 2D nature of the texture as well as notice a differential in detail the farther you look. This is also sometimes presented as blurry textures at a distance, with sometimes noticeable cutoff lines.

Anisotropic filtering is a type of processing that takes the textures and massages it at the location/angle it’s meant to be rendered at such that the geometry remains sharp and there’s a smooth transition between textures. In other words this makes your objects look sharper and smoother at all distances and angles.

It is a texture filtering process that allows to resize a texture by a factor that differs in the horizontal and vertical dimensions. Filtering is required to reduce aliasing when the texture is larger than can be shown on screen. Aliasing would be apparent and chaotic or ordered shimmering on distant objects, for example if you had a brick wall and stood far enough that each brick would approach the size of a few pixels or less.

Textures in games contain precalculated smaller versions of themselves in memory. The program can simply select the two closest image sizes that match the dimensions of the object on screen and take an average between the two. This reduces the work required so that it doesn’t need to do averaging between many pixels every time. But the selection is limited to square sizes. Anisotropic filtering saves more intermediate results that have a rectangular shape at the cost of some memory.

Objects typically seen at an angle that differ greatly in their dimensions include floors especially when close to the camera if the character is crouching or the body of a car in chase camera.

Okay, let’s start at the basics. Texture mapping is a way to distort a texture (a picture) so it fits onto 3 different shape. So for a wall in a game, we have a square distorted into a trapezium shape.

Now, if you go right down to the pixel level, we need to choose which pixel on the texture to map each screen pixel to. We do some calculations and find the middle of a pixel maps onto a certain point on the texture.

We call the pixels that make up a texture “texels”. We can pick the nearest texel. This was what the early graphics hardware did. It gives that coarse blocky look you see in 90s games.

An improvement is linear filtering. You pick the 4 nearest texels, and blend depending on distance. It looks a little better.

Ideally what we want to do is pick all the texels that map to a pixel.

We can approximate with “mipmapping”. Here we have lots of copies of the texture at different sizes (“Mip levels”). We choose the one with texels that best map to cover one pixel and do the linear filtering on that texture.

This actually looks pretty good. But textures are often at an angle. A pixel doesn’t map to a square. A rectangle is a much better approximation. So we choose a “Mip level” that’s a good size, and take several samples in a rectangular shape in the texture.

It looks a little nicer. It’s quite a bit slower though. Personally I think mipmapping gives the best performance/quality trade off. If you have the power, the slightly better image quality is nice.