Search Unity

UDRP built-in shader functions - manual

Discussion in 'Universal Render Pipeline' started by Euri, Feb 3, 2021.

  1. Euri

    Euri

    Joined:
    Sep 30, 2014
    Posts:
    11
    Hello,

    I am not sure if I am missing something or I am not looking in the right places, but I can't find anywhere in the Unity documentation anything about the existence of the "GetAdditionalLight", "GetMainLight" and others. I would really appreciate if someone could give me the links to where those functions are located. (I know they were mentioned in a couple of unity videos, but I would really like to see them in writing, because there may be some function I don't know anything about that could be very useful).
     
    Last edited: Feb 3, 2021
    TJHeuvel-net likes this.
  2. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,263
    You can find all of these on GitHub here, if anything you can search the repository for specific functions. In Rider you can CTRL+Click a function and it'll navigate to where it's declared.
     
    Euri likes this.
  3. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    838
    But its a very valid question, why are only C# methods documented and not HLSL?
     
    goncalo-vasconcelos and Euri like this.
  4. Euri

    Euri

    Joined:
    Sep 30, 2014
    Posts:
    11
    Thanks a lot for the answer. (You have created a lot of great shaders and assets!!)

    I feared that would be the answer. I can easily read the code, but some functions could be uncommented or have some things that I cant understand. The documentation would force them to consider those possibilities, and the URP already has a specific documentation section, so they would just need to write something for those functions.
     
  5. MagdielM

    MagdielM

    Joined:
    May 27, 2020
    Posts:
    32
    Oh both of the render pipelines actually have a whole shader library that's completely undocumented outside of source comments. I've complained about this a couple of times here on the forums, but seems efforts are focused elsewhere if the repo is anything to go by (and it should be). Unfortunate.
     
    Euri likes this.
  6. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,263
    Updated documentation hasn't exactly been a strong point when it comes to SRP these last two years. But for the built-in RP much of the same holds true regarding shader libraries. There's a few subsections in the documentation here, but most of the inner workings have to be looked up in the related cginc files.

    Unlike C#, there's not a lot of options (if any) for documentation generators for HLSL code. I suppose that's one of the reasons why not every function has a summary/description. But that said, there are definitely plenty of comments for internal use that provide insight.
     
  7. Euri

    Euri

    Joined:
    Sep 30, 2014
    Posts:
    11
    Thanks for the link!

    Yep, some of the comments do help when understanding the inner working of somethings and the code, from what I have read so far, is understandable. The only problem is that some functions don't have comments and I had to sort of guess what the function really did by seeing how it was used in another function. And yeah I guess part of the problem is that they don't have an automated way of generating the docs.