Are you geek enough?

Here’s a question for a REAL guru:

I have a software renderer that uses standard texture mapping, 1/z z-buffering, and scan-line converting. I would like to know how to do bilinear filtering with my engine. Currently, I’m drawing to an offscreen buffer (a short[] array) like this:

buffer[pixelPosition] = color;

I can get any color from a texture like this:

short textureColor = texture.getColor(x, y);

And I have the texture x and y coordinates. How do I interpolate between two (or maybe even four) texture colors? I have no clue.

http://www.flipcode.com/cgi-bin/msg.cgi?showThread=10July2000-TexturingAsInUnreal&forum=askmid&id=-1 good enough for you? Not a ‘proper’ bilinear filtering but good for a software renderer.

I don’t get the question … the algorithm itself isn’t particularly complicated. Take neighbour texels, weight them and pull’em together to the final color.

The difficult thing is to make it FAST!

(I remember doing it with MMX the old days, where I’ve been in luck that no perspective corrections was in play. Phew … that has been really tough code… Most time went into (de)compositing of 16bit colors into their RGB)

Thanks a whole lot. I’m kinda new to all this stuff.