# A Texture Mapping Algorithm

406 views

### Daniel Piponi

Jul 19, 1994, 8:43:06 AM7/19/94
to
I don't have easy access to computer graphics journals so I'm wondering
if anyone else has tried, or might find useful, my approach to perspective
texture mapping.

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

### Bernie Roehl

Jul 19, 1994, 11:21:03 PM7/19/94
to
In article <Pine.3.89.9407191300.A25462-0100000@uk6x25>,

Daniel Piponi <dpdp...@ggr.co.uk> wrote:
>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.
>Any interest? Is it novel?

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.
--
Bernie Roehl
University of Waterloo Dept of Electrical and Computer Engineering
Mail: bro...@UWaterloo.ca
Voice: (519) 888-4567 x 2607 [work]