Search Unity

heightmap based blend shader for terrains – to render e.g. cobblestones

Discussion in 'Made With Unity' started by larsbertram1, Sep 14, 2012.

  1. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    hi there,

    as jc_lvngstn recently has asked for a terrain shader which could handle both soft and hard edges between textures in order to render cobblestones and i have always been interested in such a shader too here it comes!

    it is a hacked terrain shader using 4 detail maps, 4 detail bump maps and a height map for the cobblestones stored in the alpha channel of the cobblestone diffuse texture.

    as we need some texture under the cobblestones we have to add some kind of base texture to those parts of the terrain where there shall be cobblestones and then add the stones themselves on top of this base texture.
    we can either use one of the other terrain textures or bring in an additional one.
    that is a bit annoying as we can’t have cobble stones on bright white sand and cobble stones on dark green grass as the stones will always be sourrounded a by the basetexture…

    image 01 showing cobble stones on rather homogeneous ground. as base texture i have choosen the dark sand texture which is also part of the cobblestone texture (filling the gaps between the single stones) open in a new window to view it in full size!

    $cobblestones.jpg


    image 02 showing cobble stones on rather inhomogeneous ground: you can notice the assigned base texture which fades to the bright sand texture. open in a new window to view it in full size!

    $cobblestones1.jpg


    image 03 same shader but tzis time using a natural rock texture instead of cobblestones. open in a new window to view it in full size!

    $blend_rock.jpg


    image 04 standard blending in order to compare... open in a new window to view it in full size!

    $blendstandard_rock.jpg


    webplayer http://bit.ly/QqUNuM



    lars
     
    Last edited: Sep 15, 2012
  2. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    new images attached.
     
  3. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    He has done it again, great work as always : D
     
  4. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902