Jump to content
  • Advertisement
Sign in to follow this  
??????? ?????

How to texture a tiled 3D terrain in DirectX9 C++?

This topic is 2271 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

[color=#000000][font=Arial,]


[background=transparent]
I have no problem with manipulating the mesh itself,but each tile(which is basically a square of 4 vertices and the whole terrain mesh is made of a grid of tiles)has to be able to be given a different texture of my choosing.So far I can only give the mesh 1 texture and make it repeat itself by changing the UV values of the CUSTOMVERTEX-es in the vertex buffer.I can't however make different tile textures like here:http://classic.battle.net/war3/images/neutral/heroes/ss02.jpg -you can see that there are grass tiles and some dirt tiles on the side and some gravel to the left.[/background]

[background=transparent]
I had the stupid idea of making each tile a seperate mesh,but that was just..heavier and the textures didnt clamp well.I'm sure there has to be some function to let me texture seperate squares of the terrainmesh :([/background]

[background=transparent]
Thanks in advance for anyone who helps![/background]
[/font]

Share this post


Link to post
Share on other sites
Advertisement
You want to add an additional component to your vertex format declaration so that you can store per-vertex weights of each splat-texture. This even allows you to slowly blend between multiple textures to get smooth overlaps.

Share this post


Link to post
Share on other sites
I use the height of each vertex in my mesh to determine the blend factor (blending between 3 textures i.e. grass, rock, and snow for dynamic terrain) and then add that to my vertex format struc but you can also use a blend map that determines which texture sampler to pull the color from in the pixel shader.

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!