Search Unity

Question URP Lit Shader in Shader Graph

Discussion in 'Shader Graph' started by jp_xsi4life, Sep 2, 2020.

  1. jp_xsi4life

    jp_xsi4life

    Joined:
    Jan 2, 2020
    Posts:
    7
    Is there a way of starting with the URP LIT shader and extending it with Shader Graph? Or do I need to rebuild the entire LIT shader graph and add my extra features to it?
     
    chuckyluv869 likes this.
  2. jp_xsi4life

    jp_xsi4life

    Joined:
    Jan 2, 2020
    Posts:
    7
    Found a version of the HDRP Lit Shader Graph if anyone finds that useful:
    https://github.com/RemyUnity/SG-HDRP-Lit

    It would be great if there was a standard example graph included in URP and HDRP for the main coded shaders.
     
    chuckyluv869 likes this.
  3. Armegalo

    Armegalo

    Joined:
    May 14, 2018
    Posts:
    30
    I too am looking for a shader graph version of the URP Lit shader. I'm relatively new to shaders so wanted to start there as an example for learning. My own efforts are sadly lacking :(
     
  4. JordanRy

    JordanRy

    Joined:
    Jun 3, 2020
    Posts:
    1
    Did any of you have success?
     
  5. Sinterklaas

    Sinterklaas

    Joined:
    Jun 6, 2018
    Posts:
    93
    Old post, but since it's been bumped recently:

    Unity actually wrote a blogpost that tells you how to do lighting in URP:
    https://blog.unity.com/technology/custom-lighting-in-shader-graph-expanding-your-graphs-in-2019

    The shader graph interface in their pictures is a little bit different from current Unity versions, since the post is from 2019, but it still works. However, make sure that your shader is set to either Unlit or SpriteUnlit, or else you'll get lighting twice.

    If you also want your objects to cast shadows, make sure to instead set your shader to Lit, and to pipe your lit color into the Emission port of the output node so that you don't get lighting twice. I don't know if custom shadow receiving works in Unlit/SpriteUnlit shaders, but it definitely works with the Lit method. But only if your shader's surface is set to "Opaque" or you have "Transparent Receive Shadows" enabled in your Forward Renderer Data asset.

    Also, I got some errors with the #ifdef KEYWORD directives in their code, but replacing them with #if defined(KEYWORD) directives solved that issue for me. Might be a problem with my Unity version, but that's how you fix that problem in case it does occur.

    Lastly, the guide doesn't cover ambient light, emission or normal mapping. The first can be done yourself by using an Ambient Light node, the second is a simple add operation between your lit color and your emission color, and the third can be done with the graph below. You just use the output of that graph instead of the Normal Vector node used in the blogpost, and there you go you've got normal mapping.

    I think that about covers it.
     

    Attached Files:

  6. SweetBro

    SweetBro

    Joined:
    Jan 14, 2013
    Posts:
    69
    Performing necromancy on this thread to see if anyone's managed to find a solution to this.
     
    MagiJedi, matheus_inmotionvr and lrb like this.
  7. syjgin

    syjgin

    Joined:
    Feb 13, 2015
    Posts:
    136
    upload_2022-8-29_12-3-47.png
    Now needed node is seems to be working in last 2021 LTS
     
  8. Bersaelor

    Bersaelor

    Joined:
    Oct 8, 2016
    Posts:
    111
    Your image is showing a node from a VFX graph. not the shader graph.

    That said, I'd still like to know what people use as a good URP/Lit shader replacement as a starting point for adding additional features.
     
    ben_hip likes this.
  9. corgan13353

    corgan13353

    Joined:
    Feb 21, 2022
    Posts:
    1
    Anybody find a replacement for the URP/Lit in shadergraph?
     
  10. Zai-shen

    Zai-shen

    Joined:
    Sep 8, 2020
    Posts:
    2
    2023 and developers still would want an answer instead of building everything from the ground up.
     
    StrangeWays777 likes this.
  11. mlddigits_phellmann

    mlddigits_phellmann

    Joined:
    Apr 17, 2015
    Posts:
    2
    any news 3 years later? I am still searching the Unity URP StandardSurface shader as a base to build upon it in shader graph to change couple of features, like AO map with UV2 channel.
     
  12. Elliott-Mitchell

    Elliott-Mitchell

    Joined:
    Oct 8, 2015
    Posts:
    88
    Cough Cough. Anything?
     
    StrangeWays777 and Kondziu2504 like this.
  13. unity_483C4357D3269025FA3B

    unity_483C4357D3269025FA3B

    Joined:
    Jul 2, 2022
    Posts:
    20
  14. Adegmood

    Adegmood

    Joined:
    Aug 8, 2018
    Posts:
    1
    I have also dealt with this problem, is my solution - https://assetstore.unity.com/packages/slug/249542
     
  15. ashwinFEC

    ashwinFEC

    Joined:
    May 19, 2013
    Posts:
    48
    tonyomendoza likes this.
  16. hellobard

    hellobard

    Joined:
    Sep 26, 2012
    Posts:
    140
    GAHHH.

    (sorry, too many years of frustration came out there in one word.)
    (what went wrong, unity?)
     
  17. victornor

    victornor

    Joined:
    Jan 17, 2014
    Posts:
    87
    Everything went wrong, as usual.
    Years of people requesting something super basic with no response from unity.
    Something we've come to expect from unity...
     
    chloelcdev likes this.
  18. angeldevelopment

    angeldevelopment

    Joined:
    Sep 28, 2022
    Posts:
    247
    2024 and still need this, why isnt this included in the URP samples??
     
  19. FredMoreau

    FredMoreau

    Unity Technologies

    Joined:
    May 27, 2019
    Posts:
    168
    Hi,

    I appreciate this is frustrating. We have the feature request here. Please vote and we'll do our best to provide something as a Sample.
     
  20. adri3105

    adri3105

    Joined:
    Nov 23, 2021
    Posts:
    2
    After searching a lot of information, I was not able to find any shader graph already assembled, so I have created it by myself using some examples. I hope it will help you.
    https://github.com/adri3105/URP_ShaderGraph
     
  21. angeldevelopment

    angeldevelopment

    Joined:
    Sep 28, 2022
    Posts:
    247
    Wow you're a life saver, how did you go about creating this?
     
  22. angeldevelopment

    angeldevelopment

    Joined:
    Sep 28, 2022
    Posts:
    247
    Not trying to be rude, but why is it that some random dev can create this in a day or two, but a company with thousands of employees can't. Is the management/bureaucracy just preventing you devs from doing any work?

    Im becoming very frustrated with Unity, especially once I found out that Unity China has Nanite/Lumen adjacent technologies.
     
  23. FredMoreau

    FredMoreau

    Unity Technologies

    Joined:
    May 27, 2019
    Posts:
    168
    I'm tempted to say that it is actually because a user can create it that we haven't.
    To your point though, it might not be possible for just a "random" dev, and still, it takes time and knowledge.
    That's why it's on the roadmap.

    There is indeed a difference between what a user can share with the community, and what a public company can officially release. It comes down to liability, quality, testing, documentation and maintenance.

    For example, @Remy_Unity has made a Shader Graph that replicates the HDRP Lit Shader, it's available here.
    Also, @BenCloward is constantly working on delivering great samples. Look out for the upcoming Production Ready Assets. It shall contain a lot of what you expect.

    Thanks for your feedback.