Search Unity

Question Shader Graph for unity's terrain.

Discussion in 'Shader Graph' started by Lesnikus5, Feb 14, 2021.

  1. Lesnikus5

    Lesnikus5

    Joined:
    May 20, 2016
    Posts:
    131
    Is it possible to create a custom shader using Shader Graph that works with Unity's terrain system? Strange, but I could not find information on this.

    I want to make a custom simplified splatmap system in my shader, so I don't need to take splatmaps data from terrainData. I also need triplanar mapping and anti-tiling.

    Need to use only Unity terrain system, not meshes or other.

    Thanks in advance.
     
    Last edited: Feb 14, 2021
  2. j-swan

    j-swan

    Joined:
    Oct 21, 2013
    Posts:
    19
    This is a good question. The terrain shader is very complex and not setup to easily customize. However, its sorely needed for adding extra effects to the terrain.
     
  3. JJRivers

    JJRivers

    Joined:
    Oct 16, 2018
    Posts:
    137
    Not That complex, just a mess that hasnt gotten the attention such a prominent system deserves. Finally some of the key sticking points that make it horrible have appeared on the Product Roadmaps and even Shader Graph support is under consideration, i hope more people comment on it: https://portal.productboard.com/dzcznunfgebtky7ipmhrc22z
    Found at the bottom there.
     
  4. backwheelbates

    backwheelbates

    Joined:
    Jan 14, 2014
    Posts:
    232
    @JJRivers it looks like the feature has already been released. Although I can’t seem to find any docs on it. Anyone have a link?
     
  5. JJRivers

    JJRivers

    Joined:
    Oct 16, 2018
    Posts:
    137
    It might have been released in the newer releases i haven't checked, we however are shipping in under a month and i needed a solution then and there (releasing with tech branch.. uh no) so i ended up reversing the material property setting portion of the terrain system and made our own terrain shader with shader graph with the custom features we needed (global shading effects and vastly superior height blending).

    One thing i didn't get working properly with it was instancing, but our project particulars (not a huge open world) allowed me to get away with it by drastically reducing details on terrains not too far away and using smaller terrain chunks of only 100m on a side, also on the bonus side i get to use functional tangents (they do exist on the terrain mesh despite the warning, but the traditional shader on it can't use em) and could use all the regular tricks in shaders without limitations, the performance hit was only around 10%.
     
    Last edited: Mar 25, 2022