Skip to main content
GameDev.net gamedev.net
🔒 Locked

Texture coordinates and Lightmaps

Started by Dennis Aug 31, 2000 at 4:58 AM 1 replies 500+ views
Original Post
Dennis
Dennis
I know how to calculate texture coordinates and lightmaps for quads (using the 2 edge vectors). But know I need to calculate them for n-sided polygons. All I need to know is the two vectors describing the smallest rectangle that contains the poly. Any suggestions?
MK42
MK42
Hi!

People tend to use axis aligned bounding boxes for this. First you take your polygon and determine the major axis. This is done by looking at the x, y, z components and determining the maximum absolute(!!) value, so for the polygon normal <1, 2, -3>, the major axis would be Z. That means the polygon is facing mostly towards the Z axis. Then you create a bounding box with the values of the other dimensions. Using the bounding box and the plane equation of the polygon, you can solve for the axis vectors ... Oh, the math is kinda hard to describe in this context, so I just redirect you to this site

http://home.bip.net/tobias.johansson1/tut_lightmap.htm

the tutorial is pretty neat and covers the basics. He also addresses your problems, calculating the axis vectors (right below the picture with the green quad). Sorry, I had to redirect you, but I didn''t feel like rewriting all this information.

- MK42
Dennis
Dennis
Thank you

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.