Jump to content

  • Log In with Google      Sign In   
  • Create Account

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


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Veil   Members   -  Reputation: 143

Like
0Likes
Like

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!



Sponsor:

#2 RobMaddison   Members   -  Reputation: 694

Like
0Likes
Like

Posted 30 April 2012 - 08:45 AM

Google 'texture splatting'...

#3 Mihai Moldovan   Members   -  Reputation: 127

Like
0Likes
Like

Posted 30 April 2012 - 07:17 PM

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.

#4 DJTN   Members   -  Reputation: 207

Like
0Likes
Like

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.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS