Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  4. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

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:
    4,216
    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:
    4,216
    new images attached.
     
  3. virror

    virror

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

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,216