Search Unity

Is there a shader graph "HDRP Lit" version available anywhere?

Discussion in 'High Definition Render Pipeline' started by BigRookGames, Dec 8, 2019.

  1. BigRookGames

    BigRookGames

    Joined:
    Nov 24, 2014
    Posts:
    330
    Does anyone know if there is a shader graph version of the "HDRP Lit" shader ? i tried to recreate it but it isn't exactly the same.
     
  2. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    You can't make "übershaders" with shader graphs, mainly because some of the toggles are on the master node and you can't expose them to materials.

    That being said, what you get with right click->Create->Shader->HDRP->Lit Graph is supposed to be equivalent in functionality to HDRP Lit shader. What exactly are you missing from it?
     
  3. BigRookGames

    BigRookGames

    Joined:
    Nov 24, 2014
    Posts:
    330
    It's not so much that I am missing inputs from it, but that my implementation of it differs from the HDRP Lit shader. I know the other has the Mask Map comprising of some of the inputs of the Lit Master, but I must be implementing them incorrectly because the output is a lot different when only using a few of the maps.

    When using a PBR setup I use the following for each node:

    I know there is a lot more in the HDPR Lit, but just considering albedo, normal, specular, smoothness, AO, and emission, does anything look off in the setup?
     
    As_day, AntonioModer and brainwipe like this.
  4. cubrman

    cubrman

    Joined:
    Jun 18, 2016
    Posts:
    412
    Same problem here, its a damn shame they didn't just release a full shadergraph version of the HDRP/Lit shader. And not being able to expose EVERY option is F***en pathetic. Seems like this whole sharade is still half baked even in the middle of 2020.

    Update: found the GIT repository of the Shader Graph version of the Lit shader:

    https://github.com/Unity-Technologies/FontainebleauDemo/issues/12

    It has last been updated 2 years ago with all the ensuing issues: specular reflection glitch and micro shadows don't work at all. Also, you can't change any of the transparency parameters of the material in the editor.

    Such a shame, really. Oh well, I hope they will add the ability to customize it fully in the future. So far the graph looks almost worthless.
     
    Last edited: Jun 27, 2020
  5. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    I just had look on your shadergraph, so you don't bothering using the mask map setup at all?
    Because normally metallic, roughness, AO and detail are packed inside one texture and therefore you need to split the color channels of your texture mask. I think it's better so stick to one system in case you later decide to reuse textures on the default HDRP shaders.

    But all in all I'm on your side: It really sucks to recreate so much default functionality in shader graph and with custom shaders the material UI is not even the same as for HDRP Lit. I really wish the UI would look the same for custom shaders recreating the basic setup. Just look at this mess.

    I tried to use the exact same variable names and order in the inspector to get a little bit of consistency.
     

    Attached Files:

  6. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
  7. cubrman

    cubrman

    Joined:
    Jun 18, 2016
    Posts:
    412
    Just an update for anyone concerned: copying a Lit shader code and then modifying it to suite your needs is actually doable (I first thought it was next to impossible) if you understand shader code and did something similar with the builtin standard shader.

    The way you do it is by getting the shader code here: [YOUR UNITY PROJECT FORLDER]\Library\PackageCache\com.unity.render-pipelines.high-definition@8.1.0\Runtime\Material\Lit\Lit.shader

    you can quickly access it by right clicking on any Lit material and choosing "Select Shader", then right clicking on the shader file and selecting "Show in Explorer".

    Then you modify these files:

    VaryingMesh.hlsl - to modify what data you receive from your mesh and what data you send from the vertex shader to the pixel shader.

    VertMesh.hlsl - to modify the vertex shader and to link the new VaryingMesh.hlsl.

    LitSharePass.hlsl - to link the new VaryingMesh.hlsl file.

    LitDepthPass.hlsl - the same but for the DepthOnly path.

    ShaderPassForward.hlsl - if you want to change the pixel shader for forward lighting. You link the new VertMesh file here.

    ShaderPassDepthOnly.hlsl - modify this if you introduced clipping into your forward pixel shader to ensure that the new pixlel shader for your forward lighting works properly.

    The location of the files above can be found by reading through the "Lit.shader" file.

    Here I added texture-based dissolve for my forward cutout mesh:

    upload_2020-6-28_14-11-43.png

    I had no luck changing the position of the object in the vertex shader so far, but I believe soon I will crack that too.

    Update: yeah, the way you edit the variables you introduce into the shader is by writing a monobehaviour and attaching it to the object - writing custom editor for your lit material seems impossible right now as the parent class the original editor references is inaccessible.