Texture mapping with vertex\index buffers

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

Recommended Posts

Is it possible to properly texture map using vertices in a vertex buffer while the terrain is laid out in an index buffer? I'm trying to texture map my terrain: I've read that it can't be done because the texture coords would be jacked while some tutorials hinted that there's a way around this. Can anybody shed some light? Thanks. [Edited by - Dragun on May 22, 2005 5:43:54 PM]

Share on other sites
If you use a single texture over the entire terrain, it is possible. If you will be using multiple textures within the terrain, you can't easily do it unless you have multiple vertices for each point, i.e. each hexagon has its own 6 vertices. However, you still save bandwidth by using indices in this way, because you don't have to load up a vertex structure which is always bigger than a single index. You can adjust the indicies alone. This method would help for level of detail algorithms later as well.

EDIT: I guess a little better explanation is in order. Texture coordinates on a shared vertex can only be for one texture. If 2 hexagons share 1 vertex (i.e. using index buffer to make this efficient), then that 1 vertex may have texture coordinate 1,1 for the bottom right of texture A, but it's also the top right vertex for the hexagon beneath it. Therefore, the top right vertex should be 0,0, but it's 1,1. You can get around this by using values greater than 1. I'm not sure all video cards accept these values greater than 1 and I'm also not sure they will go very high. I believe you can check the CAPS structure for that information. Also, you might be able to change wrap settings for the texture. Make the textures mirrored. Perhaps that will work. I don't recall.

Chris

Share on other sites
Hmmm...then what's the point of index buffers if texture mapping is N/A? This sucks.... Let me see what happens if I stetch a texture over this whole thing...

Share on other sites
Quote:
 Original post by DragunHmmm...then what's the point of index buffers if texture mapping is N/A? This sucks.... Let me see what happens if I stetch a texture over this whole thing...

Well the thing is, terrain is one of the few places this problem comes up. You can still have textures, it's just using multiple texture coordinates screws things up. With traditional 3D models, the index buffers are a huge help, since you don't have the same texture requirements.

Although I've never done it, I think what you may be looking for is something like Texture Splatting.

Matt Hughson

1. 1
2. 2
Rutin
21
3. 3
4. 4
A4L
15
5. 5
khawk
14

• 13
• 26
• 10
• 11
• 44
• Forum Statistics

• Total Topics
633742
• Total Posts
3013636
×