Bilinear and trilinear filtering
Texture filtering deals with how a texture – a 2D image (and
other data) – is displayed on a 3D model. A pixel on a 3D
model won’t necessarily correspond directly to one pixel on its
texture (called a ‘texel’ for clarity), because you can view the
model at any distance and angle. So, when we want to know
the color of a pixel, we find the
point on the texture it
corresponds to, take a few
samples from nearby texels, and
average them. The simplest
method of texture filtering is
bilinear filtering, and that’s all it
does: when a pixel falls between
texels, it samples the four nearest texelstofinditscolour.
Introduce mipmapping, and you have a new problem. Say
the ground you’re standing on is made of cracked concrete. If
you look straight down, you’re seeing a big, detailed concrete
texture. But when you look way off into the distance, where
this road recedes toward the horizon, it wouldn’t make sense
to sample from a high-resolution texture when we’re only
seeing a few pixels of road. To improve performance (and
prevent aliasing, Austin notes) without losing much or any
quality, the game uses a
lower-resolution texture – called
a mipmap – for distant objects.
When looking down this
concrete road, we don’t want to
see where one mipmap ends
and another begins, because
there would be a clear jump in
quality.Bilinearfiltering doesn’t interpolate between
mipmaps, so the jump is visible. This is solved with trilinear
filtering, which smooths the transition between mipmaps by
taking samples from both.
WEDON’TWANTTOSEE
WHEREONEmIPmAPENDS
ANDANOTHERbEGINS
TEXTuRE
FIlTERINg