Search Unity

Feature Request Documentation about how Shader Graph generated code works (and shaders in general in SRP)

Discussion in 'Shader Graph' started by carcasanchez, Feb 26, 2020.

  1. carcasanchez

    carcasanchez

    Joined:
    Jul 15, 2018
    Posts:
    177
    Tl;dr: documentation/tutorial request about how Shader Graph generated code (and shader coding in general in SRP) works

    I have been worked with ShaderGraph and HDRP from a pair of months, and I am pleased with most of what I have seen.
    However, due to some limitations (specifically, lack of in-editor Compute Buffers and Instanced Properties), I have to move the shader to code.

    The generated code is a monster. There is a lot of passes, subshaders and conditional defines that makes modifiyng it a non-trivial task.

    I have managed to remove some passes and implement some functionality and, little by little, unravel how the code structures and calls its functions.

    However, besides slowing me down a lot (something I can carry with), there are still a lot of interrogants about the workflow of shader code in SRP. Some CG keywords are usable, some not; some function's purpose are not clear; there is a lot of hlsl includes; there is a lot of redundant/trivial code that I would like to remove, but don't know how it ties to the rest of the shader, etc.

    I understand that SRP is still in flux, and it takes time to document properly.

    But, well, it is, theoretically, ready for production, and I will like a little bit of info about how the new shader workflow functions under the hood.
     
  2. alexandral_unity

    alexandral_unity

    Unity Technologies

    Joined:
    Jun 18, 2018
    Posts:
    163
    That's not really a Shader Graph question -- each render pipeline (Universal vs HDRP) has their own expected structures and necessary passes, functions, keywords, etc. I would try asking in the render pipeline's forum space for more information about how each pipeline specifically works.