I started to create my own terrain in a quite common way, just like this: http://www.rastertek.com/tertut18.html . It is infinite and automatically generated (by using coherent noise). The areas are determined by using Voronoi noise (http://www.ctvisualeffects.com/renderman/maya_pattern_animation/cellnoise.jpg .

I am using triangle list with shared vertices. I'd like to create areas textured differently that are connected smoothly with each other. I came up with something like giving every vertex the texture id, e.g.:

0 - grass
1 - snow
2 - sand

enter image description here

I was thinking about sending the texture ids (the 0, 1, 2) to the shader in the TEXCOORD semantic (the z value), however I have no further idea on how to use them there to actually blend the textures smoothly.

Could you give me any hints, please? I'd be really grateful.


I ended up giving each vertex weights of each texture. But this is completely not generic solution and quite heavy as I have to change vertex structure when adding another area which has another texture.

  • 1
    \$\begingroup\$ Won't terrain blend maps work better for you? m4x0r.com/blog/2010/05/blending-terrain-textures . You essentially need your grass, snow, sand textures and another special purpose texture containing the weight/influence of each detail texture for the current pixel. The weights are stored in separate RGBA channels (hence 4 detail textures use one blend map). \$\endgroup\$
    – teodron
    Commented Aug 24, 2013 at 9:36
  • \$\begingroup\$ And yeah, possible duplicate of other questions (e.g. gamedev.stackexchange.com/questions/12767/… ) \$\endgroup\$
    – teodron
    Commented Aug 24, 2013 at 9:39
  • \$\begingroup\$ @teodron Actually I think it would be hard to apply it to my situation. My terrain is unlimited and automatically generated (while moving) using perlin noise. I would need to determine whether it is blending from right to left, left to right, bottom to top and so on (there are a lot of cases unfortunately), since you cannot create one universal alpha map that fits all of the directions. Or maybe I have weak knowledge about it and don't see the correct way of doing this. \$\endgroup\$
    – tobi
    Commented Aug 24, 2013 at 11:13
  • \$\begingroup\$ you should mention this in your question (your terrain is generated on the fly and is infinite). You can still use the same approach while having only one texture mapping (TEXCOORD uv set) for all textures. The blend weights can be given by associating different textures (snow, grass, sand) with different height intervals (something on these lines gamedev.stackexchange.com/questions/13819/… ). Is this cutting it for you? \$\endgroup\$
    – teodron
    Commented Aug 24, 2013 at 12:04
  • \$\begingroup\$ @teodron Ok, I've edited the question. I have seen that topic and I was thinking abou 3D texture, but assuming we have gradient water->sand->grass. How do you blend water and grass? You need another gradient water->grass->sand and so on, and this makes it more complicated. \$\endgroup\$
    – tobi
    Commented Aug 24, 2013 at 12:18


You must log in to answer this question.

Browse other questions tagged .