#### Archived

This topic is now archived and is closed to further replies.

# Texture coordinates and Lightmaps

This topic is 6650 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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?

##### Share on other sites
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

Thank you

1. 1
Rutin
41
2. 2
3. 3
4. 4
5. 5

• 10
• 27
• 20
• 9
• 20
• ### Forum Statistics

• Total Topics
633403
• Total Posts
3011673
• ### Who's Online (See full list)

There are no registered users currently online

×