Sign in to follow this  

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

This topic is 2051 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,][size=3]
[size=3][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:[url="http://classic.battle.net/war3/images/neutral/heroes/ss02.jpg"]http://classic.battle.net/war3/images/neutral/heroes/ss02.jpg[/url] -you can see that there are grass tiles and some dirt tiles on the side and some gravel to the left.[/background][/size][size=3][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][/size][size=3][background=transparent]
Thanks in advance for anyone who helps![/background][/size]
[/size][/font][/color]

Share this post


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

This topic is 2051 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this