Jump to content
  • Advertisement
Sign in to follow this  
Dragun

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.

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

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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 this post


Link to post
Share on other sites
Quote:
Original post by Dragun
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...


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

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!