# Texture coordinates - the right approach

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

## 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 on other sites
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 on other sites
Quote:
 Original post by malloukHello!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 on other sites
Thanks for the info.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 13
• 9
• 9
• 15
• 14
• ### Forum Statistics

• Total Topics
634067
• Total Posts
3015326
×