Jump to content
  • Advertisement
Sign in to follow this  
mallouk

Texture coordinates - the right approach

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello! I was wondering what would be the best approach to deal with a situation where n sets of texture coordinates have to be specified for a given vertex. In other words, I have meshes that sometimes have two or more triangles sharing a particular vertex that has different texture coordinates for each face. I was wondering which would be better: - specifying a vertex format with multiple texture coordinate sets; - use a vertex format with only one texture coordinate set and duplicate vertices when needed. Any other ideas? William

Share this post


Link to post
Share on other sites
Advertisement
Here are some numbers from sample meshes:

Mesh 1:
Vertices: 1804
Vertices with multiple texture coordinates: 403
Total vertices if replicated: 2263
Maximum texture coordinates per vertex: 4

Mesh 2:
Vertices: 412
Vertices with multiple texture coordinates: 24
Total vertices if replicated: 436
Maximum texture coordinates per vertex: 2

Mesh 3:
Vertices: 98
Vertices with multiple texture coordinates: 0
Total vertices if replicated: 98
Maximum texture coordinates per vertex: 1

Mesh 4:
Vertices: 289
Vertices with multiple texture coordinates: 114
Total vertices if replicated: 417
Maximum texture coordinates per vertex: 4

I think that this is a very common situation, so I wonder if some of you guys have seen it before... Is it worth it creating a vertex format with the additional texture coordinates? What if the number of texture coordinates exceeds what the new vertex format can hold?

Share this post


Link to post
Share on other sites
Quote:
Original post by mallouk
Hello!

I was wondering what would be the best approach to deal with a situation where n sets of texture coordinates have to be specified for a given vertex.

In other words, I have meshes that sometimes have two or more triangles sharing a particular vertex that has different texture coordinates for each face.

I was wondering which would be better:

- specifying a vertex format with multiple texture coordinate sets;
- use a vertex format with only one texture coordinate set and duplicate vertices when needed.

Any other ideas?

William

This is usually handled by duplicating the vertices. Use multiple texture coordinates when you have more than one texture to apply to a mesh and the texture require you to have different texture coordinates.

In most real-world meshes, the number of duplicated vertices isn't all that much. If you try something like a cube, then you'll end up having to duplicate a bunch of vertices, but this situation isn't common in real meshes.

neneboricua

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!