Search Unity

Any way to force terrain shaders to be added to build in HDRP?

Discussion in 'High Definition Render Pipeline' started by martinofigueroa, Apr 23, 2020.

  1. martinofigueroa

    martinofigueroa

    Joined:
    Feb 8, 2017
    Posts:
    11
    Hello,

    I'm creating a procedural terrain in the HDRP. This is created in a script and no terrain object exist in the scene itself. Everything works fine in the editor, but when doing a build, the terrain seems to use a fallback shader and render incorrectly (see attached image).

    In the builtin render pipeline you can force the terrain shaders into a build in the graphics settings by adding the "Nature/Terrain/Standard" shader to the "Always included shaders" in the graphics settings, but the "HDRP/TerrainLit" shader can not be added to the list in the same way, as it's nowhere to be found.

    I can work around the issue by adding adding a dummy terrain in the the hierarchy, adding some terrain layers to it and then killing it in code when the game launches, but surely there is a better way of doing this?

    Thanks!
     

    Attached Files:

  2. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,266
    It looks like the shader is included in the build, but your sand material layers (which covers the peaks) isn't.
     
  3. martinofigueroa

    martinofigueroa

    Joined:
    Feb 8, 2017
    Posts:
    11
    I think this is really the shader, that seems to be a legacy diffuse shader with 1 pass that can only render 4 splats.
    If you look closely to in areas covered by one of the first 4 textures, you can observe that bumps are not rendered properly, see attached image.
     

    Attached Files:

  4. WeltenbauerRenn

    WeltenbauerRenn

    Joined:
    Jun 20, 2017
    Posts:
    40
    I'm not sure what you mean with can't add. You can select a shader from packages by "unhide" them from the menu. upload_2020-4-27_10-31-35.png