Now before I start I need to explain a bit about texturing. As you know,
all games use texture mapped polygons. Now texture mapping is nothing more
than sticking a 2D picture to the 3D surface of an object. The math involved
with this process is irrelevant for this discussion, but the basic idea
is this: somehow you can trace a link between an on-screen pixel and a position
in a texture map. So for every pixel that is being filled by a texture mapped
polygon you can do a trace (through math and projections) that gives you
a location in the 2D texture map image that you use. Now this traced position
is not located exactly at one texel (pixel in the 2D texture map, a color
if you want) position. It's probably located somewhere in-between. You can
see it like this:
Imagine a 16x16 texture. Now every center of a pixel is equal to a whole
value, so coordinates (1,1) would be the center of the pixel bottom left.
Now the trace (screen to texture space) doesn't gives us a whole value it
gives us, for example, something like (2.37,5.89). A floating point position.
This means that we are off center. Now with bilinear filtering we will use
4 texels from the map, we actually take the 4 texels surrounding the traced
location. So in the case of our example we would take texels at positions
(2,5), (3,5), (2,6) and (3,6). And based on those texels, we take a weighted
average to find the final bilinear filtered color, now the weights are based
on the traced location. The position clearly indicates that we are pretty
close to the texels at position Y=6, at least closer than we are to the
pixels located at position Y=5 (remember that Yreal = 5.89). So we adapt
the weights so that this is reflected. The same can be done for the X-axis
where we are closer to the X=2 than to the X=3 texels (remember that Xreal=2.37).
This difference in weights is done linearly, so for the X-axis we are close
to location 2. So we use the weight 1 - 0.37. 0.37 is the fractional part
of the trace for the texels around axis X=2. Now similar approaches can
be taken for the other weights, all you need to know is that the general
idea is that a texel closer to the trace position will get a larger weight
and thus more influence on the final color.
Now why did I explain this? Well you saw above that we require 4 texels
that are located close together (actually a quad of texels that are all
neighbors). Now if the traces for different screen pixels are close enough
together in the texture space then we can re-use some of the old texels.
Imagine that the next trace gives us (3.20,5.80). In this case the position
moved in the X-direction and remained largely constant in the Y-direction.
Now the texels we need for this calculation are close to the previous ones
we needed. Actually, the two right texels can be re-used! Now this re-use
is essential since that is what our 3D chip cache is used for. We store
the texels we have already used since we might use them again.
Now the standard approach to texturing a triangle is scan line wise. With
a scan line I mean a horizontal line on your screen. So a triangle is filled
up with color from left to right and from top to bottom. Now by moving to
the right, pixel-per-pixel, we also move in the texture domain (note that
this direction remains linear but is not necessarily horizontal or vertical
at all... it depends on the orientation of the triangle in 3D space). Now
as I pointed out, we want to re-use texels and since we move linearly we
can usually re-use some of the old texels.