Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Terrain Shader for HDRP

Discussion in 'World Building' started by americanbean, Feb 15, 2019.

  1. americanbean

    americanbean

    Joined:
    Jun 24, 2016
    Posts:
    3
    Before the newer Terrain build I was able to use a work around in HDRP and apply a ‘custom shader’ to the terrain and select a the HDRP LayerdLit with tessellation. I have this working on an existing height-map (created in Gaea) and a set of masks for wear, erosion, deposit, etc. I was able to use Megascan materials and apply them. I was able to apply tessellation, control subsurface scatering and get height blending between materials.
    The results were impressive.

    However, this no longer works. When I apply anything but the ‘Terrain Lit’ shader under HDRP I get a glitchy mess in the camera. Terrain lit has no support for layer masks which is crucial for realistic terrain texturing since masks correspond to the topology.

    I hope future builds will support the LayeredLit tessellation paradigm. Especially when artists to use terrain generating apps like World Machine/Terragen/Gaea to get real-world terrain results.

    Questions:
    +Can I still use the Layered HDRP Lit Shader for terrain in newer builds of Unity.
    + Are you working toward a shader for Terrain as robust as the LayeredLitTessalation
     
    Last edited: Feb 16, 2019
    arturmandas and CKDGuly like this.
  2. americanbean

    americanbean

    Joined:
    Jun 24, 2016
    Posts:
    3
    Here's an example of the workaround in Unity 2018.3...However, I cant do this work-around any longer when I create a new Terrain...Any ideas of what i may be doing wrong?
    terrain1.jpg

    terrain2.jpg
     
  3. americanbean

    americanbean

    Joined:
    Jun 24, 2016
    Posts:
    3
    FIXED!!

    I had to disable "Draw Instanced" under Terrain /Basic Terrain

    Thanks americanbean!
     
  4. HD-MI

    HD-MI

    Joined:
    Mar 9, 2017
    Posts:
    13
    Good find! I've been looking for this. Thanks a bunch!
     
  5. SGFX

    SGFX

    Joined:
    Mar 25, 2014
    Posts:
    24
    Are you using the default shader or a custom Shader Graph shader?
    Does anyone know how to make a shader graph work for Terrain?
     
  6. Boopbideebop

    Boopbideebop

    Joined:
    Oct 31, 2017
    Posts:
    5
    I really want to achieve the same effect (using tessellation for megascans with the unity terrain in HDRP). can you please tell me how you did it :D. Thanks!
     
  7. Boopbideebop

    Boopbideebop

    Joined:
    Oct 31, 2017
    Posts:
    5
    Ok I found out how to do it but it is EXTREMELY performance heavy...

    If you want an example, the asset "the book of the dead" uses it in its terrain (look at the reviews on instructions on how to fix errors).

    You pretty much replace the custom material under the terrain settings with LayeredLitTesselation and then at the bottom of the LayeredLitTesselation material you create there should be a check box for terrain usage.

    Still not sure how he managed to make it run at 70 fps when I was barely hitting 30 fps with 0 other objects in the scene.
     
  8. arturmandas

    arturmandas

    Joined:
    Sep 29, 2012
    Posts:
    240
    @Boopbideebop How heavy? I am considering this technique for U 2020.1 and Gaea. @americanbean your technique was simple layering of materials, where tiled textures where masked by Gaea Data maps like Soil, Snow etc.?