General texture mapping resources... Some good math explanations.

Since John is busy with his Game Programming Math course, I figure I'll go out and look up some cool resources for him.  The problem he gets to solve right now is mapping a 2 dimensional texture onto an arbitrary 2 dimensional n-gon.  Basically, he gets to explain how binomials would help in this situation in order to interpolate texture coordinates across scans of the polygon.  What I'm basically thinking right now is that an arbitrary n-gon is going to break down into at most n-1 horizontally aligned blocks that can be bounded by functions of the vertices.  Each block is going to have a pair of functions for the left side and right side texture coordinates, and a third pair of functions to interpolate the texture coordinates across the scan-line.

The easiest primitive to solve for this is the right triangle with a horizontal base.  This primitive features a single horizontal band meaning the number of functions required to interpolate the texture onto the surface would come in at 6.  This really becomes a single function for each texture coordinate, because you'll be using the other 4 to create the bounds for the later 2.

I have to say this is a real pain in the rectum.  Thank god they've found better ways to do this.  If I can toss together a .NET application that textures an n-gon later this week I'll throw it out.  I realize the implementation in John's class isn't as important as getting the math down, but the math doesn't show results on my computer screen either.  Here are some additional resources on texture mapping that you might find useful.

Resources:
[1]
Texture Mapping as a Fundamental Drawing Primitive
[2] Texture Mapping (on Geocities)
[3] GameDev .NET - Texture Mapping
[4] Texture Mapping - Part 1 (at Stanford University)

Published Monday, April 12, 2004 11:42 PM by Justin Rogers
Filed under: ,

Comments

Tuesday, April 13, 2004 6:55 AM by kvr

# re: General texture mapping resources... Some good math explanations.

Don't forget this one (from Chris Hecker
of Game Developer Managazine)

http://www.d6.com/users/checker/misctech.htm
Tuesday, April 13, 2004 5:40 PM by Justin Rogers

# re: General texture mapping resources... Some good math explanations.

Yeah, that is a set of ancient articles. Good job pulling that link out of the swirling mass that is the web.

Leave a Comment

(required) 
(required) 
(optional)
(required)