Search Unity

HDRP Shadergraph Custom Terrain Shader layers

Discussion in 'High Definition Render Pipeline' started by morpheus101, Oct 16, 2021.

  1. morpheus101

    morpheus101

    Joined:
    Jan 9, 2020
    Posts:
    4
    Hi All,

    I am trying to create a custom terrain shader in the shadergraph (12.0.0) for the Unity standard terrain using various resources I found online but have hit a bit of a brick wall. I can get the first four textures of the Unity Terrain by using Reference "_Control0" in a sample texture 2d and split the output but am struggling trying to get the 5th, 6th, 7th and 8th texture.
    After looking in the "TerrainLit_Splatmap.hlsl", I thought it would simply be using the Reference "_Control1" with my logic being that as stated in the above:

    Code (CSharp):
    1. #ifdef _TERRAIN_8_LAYERS
    2.     DECLARE_TERRAIN_LAYER_TEXS(4);
    3.     DECLARE_TERRAIN_LAYER_TEXS(5);
    4.     DECLARE_TERRAIN_LAYER_TEXS(6);
    5.     DECLARE_TERRAIN_LAYER_TEXS(7);
    6.     TEXTURE2D(_Control1);
    7. #endif
    I have tried adding _TERRAIN_8_LAYERS to the scripting define symbols but this made no difference.

    Any pointers gladly received and thanks in advance.
     
  2. Marou1

    Marou1

    Joined:
    Dec 13, 2021
    Posts:
    161
    I have the same issue. I cannot access the 4 last layers. Did you find out how to do it?
     
  3. adamgryu

    adamgryu

    Joined:
    Mar 1, 2014
    Posts:
    188
    Cross-posting from another thread:

    For those wondering, I couldn't access _Control1 until the tag "SplatCount = 8" was added to my shader (inside Shader > SubShader > Tags). If you want to add that to your shader graph shader, you'll need to modify the generated source.​