Search Unity

  1. The 2022.1 beta is now available for testing. To find out what's new, have a look at our 2022.1 beta blog post.
    Dismiss Notice

Help Wanted How do I make a shader graph with all the same exposed properties as a pre-included shader?

Discussion in 'Shader Graph' started by FPG1, Sep 8, 2021.

  1. FPG1

    FPG1

    Joined:
    Sep 8, 2021
    Posts:
    2
    Are there any defaults you can use for quickly recreating (for example) the decal shader with all the same exposed properties already wired up?

    I am having a tough time recreating the exact settings form a decal shader and my custom one seems to be behaving oddly compared with the built in one. As a quick example, I am having a hard time figuring out how to "limit" the smoothness override so it doesn't apply to the entire decal, and only applies to the area specified in the mask.
     
  2. JJRivers

    JJRivers

    Joined:
    Oct 16, 2018
    Posts:
    89
    You should be able to find the Unity shader in the Package Cache like so: ProjectName\Library\PackageCache\com.unity.render-pipelines "your srp @ version#" \Runtime\Material\Decal\ ..decalshader source files here.

    And see how they calculate things to recreate the behavior, this is how i've managed to recreate nearly all Unity shaders in a reasonable amount of time.
    Word of advice, try to keep the number of shaders/variants you use low if you can, unless you've manually disabled it you will be using SRP Batcher which is Per Shader GPU setups not per material like it has been done traditionally. ( Take note every feature enabled/disabled by a keyword in Unity shaders is a different shader variant causing careless setups to be costly, done right it is an amazing system )

    edit: for easy transition from Unity decal shaders to your new decal shader, ensure all the properties have the exact same names and any materials you change the shader to your new one will keep its properties set to what they were previously.
     
  3. FPG1

    FPG1

    Joined:
    Sep 8, 2021
    Posts:
    2
    Thanks! i'll give that a try
     
    JJRivers likes this.
unityunity