Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Resolved Trying To Replicate The Hdrp Lit Shader, I Need Help With The Detail Input Part

Discussion in 'Shader Graph' started by CosmosBear, Apr 12, 2019.

  1. CosmosBear

    CosmosBear

    Joined:
    Aug 2, 2012
    Posts:
    65
    Hi,
    So I'm trying to replicate the HDRP lit shader and I'm quite stuck at the "detail input part". I was easily able to replicate the "surface Inputs" part (base map, Mask map and Normal map) and for some reason I was able to mix the Detail map Normal map (G,A) with the base normal map but I can't seem to get the same result with the Detail Albedo (R) and the Smoothness (B).

    I guess i'm missing something

    helpmeobiwankenobiyouremyonlyhope.jpg
     
  2. alexandral_unity

    alexandral_unity

    Unity Technologies

    Joined:
    Jun 18, 2018
    Posts:
    162
    Without seeing the expected output vs actual output for the albedo map, it's a bit hard to figure out where the issue is.
     
  3. CosmosBear

    CosmosBear

    Joined:
    Aug 2, 2012
    Posts:
    65
    This is what is expected expected.jpg

    This is what I get right now with the same values
    unexpected.jpg

    by cranking the Albedo Str Scale to 4 (thats the vector 1 plugged at the oppacity in at the blend node) I get a closer resul with the white line but the dark place get too much pronounced. Untitled-1.jpg

    I also tried with a hard light blend instead of overlay, it's close but still not it.
     
  4. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    390
  5. CosmosBear

    CosmosBear

    Joined:
    Aug 2, 2012
    Posts:
    65
    This is just beautiful, thank you!
     
  6. Amitloaf

    Amitloaf

    Joined:
    Jan 30, 2012
    Posts:
    93
    This works almost amazing :) Uploaded a small issue If found to Issues on github. But other than that it looks amazing! just like the normal one
     
  7. NatureManufacture

    NatureManufacture

    Joined:
    May 20, 2014
    Posts:
    1,864
    Does it still use overlay in detail albedo? I feel like it's wrong blend type.

    Edit: Solution from screen is totaly wrong in compare how HD RP Lit shader: Mistakes are in : - --- detail albedo blend
    - detail normal blend
    - detail smoothess blend
     
    Last edited: Aug 29, 2019
  8. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    684
    Hi. Do you have can share the corrected version?
     
  9. jp_xsi4life

    jp_xsi4life

    Joined:
    Jan 2, 2020
    Posts:
    6
    @Remy_Unity You wouldn't happen to have a URP version of the Lit shader in Shader Graph would you?
     
  10. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    390
    Nope, don't have that. But URP/Lit shader is wayy simpler, and shouldn't be hard to replicate.
     
  11. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    3,679
    Thanks for linking that Shadergraph, @Remy_Unity . That will really help my understanding.

    One question: Do you know if there is a big performance/efficiency difference between your SG version of the Lit shader, and the normal HDRP Lit shader that comes with HDRP? I'm curious is there are optimizations in the Lit shader that can't be replicated in a Shadergraph. For example, in a normal Lit shader, it recompiles the shader whenever I enable/disable certain features. I assume that the more features enabled, the more "expensive" the shader gets. But with this Shadergraph, does it incur the cost of all of those things, even if no maps are provided to certain inputs?

    For example, does the full Lit shader know not to bother sampling certain maps if there's no map assigned? Do Shadergraphs know to do the same thing?
     
  12. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    684

    Hi, did you find a solution for the blends you mentioned?
     
  13. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    818
    Unfortunately
    https://github.com/RemyUnity/SG-HDRP-Lit
    Don't do pixel/vertex displacement.

    WHY WHY WHY we cannot extend HDRP\Lit shader !!!

    Also everything related to HDRP\Lit is so tightly coupled that you just cannot copy Lit editors and classes from HDRP in library folder. And you cannot add there anything since

    "Asset Packages/com.unity.render-pipelines.high-definition/Editor/Material/Lit/LitCustomGUI.cs has no meta file, but it's in an immutable folder. The asset will be ignored."
     
  14. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    684
unityunity