How to texture a tiled 3D terrain in DirectX9 C++?
3 replies to this topic
Members - Reputation: 143
Posted 29 April 2012 - 05:41 AM
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.
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
Thanks in advance for anyone who helps!
Members - Reputation: 207
Posted 03 May 2012 - 02:52 PM
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.