Most posts on the subject seem to refer to using quadratic interpolation
to handle the perspective mapping. I have an essentially linear approach.
Suppose we wish to texture map a triangle in 3-space onto the screen
using the map pi:(x,y,z) -> (x/z,y/z). Let L be the line segment that is the
intersection of this triangle with the plane z=k. Then pi restricted to L
is an affine map. If we then rule the triangle with lines parallel to L
we can use an affine map to render each line to the screen. Instead of
using horizontal scan lines, say, we have to use non-horizontal lines.
But this is at virtually no extra cost because all of these lines are
parallel and we can precompute the coordinates of one of these lines
right at the beginning of the texture map. We have to do a division or
two at the beginning of each line to compute the texture coordinates of
the endpoints but then it's simple additions all the way.
The net result is persepctive texture mapping needing approximately two
divisions at the end of each line and about 4 additions per pixel. It is
fast and accurate - probably good enough for games.
I haven't thought about anti-aliasing yet.
Any interest? Is it novel?
Dan Piponi / dpdp...@ggr.co.uk / d...@tanelorn.demon.co.uk
`We speak of birds singing. When I was a boy I was often bothered in
listening to birds because it obviously isn't *singing*. Finally someone
said to me, "All right, don't call it singing, call it something
else". And soon I could listen to birds and enjoy it.' -- L Wittgenstein
The PC-GPE (found on x2ftp.oulu.fi) has an article on "Free-Direction Texture
Mapping" that is a more detailed description of the algorithm you describe.
It's a good idea.
University of Waterloo Dept of Electrical and Computer Engineering
Voice: (519) 888-4567 x 2607 [work]