Search Unity

Question Shader Graph template used to generate the shader

Discussion in 'Shader Graph' started by Desoxi, Jun 2, 2021.

  1. Desoxi

    Desoxi

    Joined:
    Apr 12, 2015
    Posts:
    195
    Hey everyone,

    I'm currently trying to find out how the shader of Shader Graph is generated. I remember a few years ago there was a file that was used as template and checking the final OpenGL shader tells me that the lit Shader Graph is indeed using the lit URP shader.

    Is there a way how I can create a custom shader that Shader Graph then uses to generate its shaders depending on new nodes?

    The reason I am asking is, that I want to enable my shader to use unity_InstanceID but this has to be enabled in the vertex shader via UNITY_SETUP_INSTANCE_ID.

    I was able to add these into the generated shader (though it would have been easier to write it completely by hand because the property names are a nightmare), but would like to create a template that does that by default, and then I could use unity_InstanceID in a custom node in Shader Graph.