Search Unity

Question Bump/Normal mapping on LWRP unlit graph?

Discussion in 'Shader Graph' started by R42_Leon, Jul 15, 2019.

  1. R42_Leon

    R42_Leon

    Joined:
    Feb 24, 2016
    Posts:
    25
    I was surprised to see there's no normal input on the unlit master node. What alternative workflow could I use to achieve the equivalent of the bumped diffuse shader in shadergraph? Maybe use the normal map as an height map and plug that into the position instead? Any takes on this?
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,348
    An Unlit Master Node is... unlit... which means lighting has no effect, which means normal maps have no use as they only exist to modify lighting.

    If you want a bumped diffuse shader use a PBR Master Node. Change the workflow to Specular, set the specular color to black, smoothness to 0.0, and now you have the equivalent of a bumped diffuse shader.
     
    ZoeQi0755 and andywatts like this.
  3. oddreams

    oddreams

    Joined:
    Dec 3, 2016
    Posts:
    17
    Hello, will this have any performance hit for mobile devices? I made a shader that uses only Unlit Master node, and now I just need a normal map support. The shader works very well on mobile, as it is right now. I am a bit worried that switching to PBR master node will have a performance impact, even though I will just be using the normal map of that. Thanks in advance
     
  4. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,348
    Yes, the PBR Master node is more expensive than the Unlit Master node. It's doing lighting calculations which the Unlit node is not, and that has a cost. But if you want a normal map to do anything, those are the calculations you need to do. Whether or not this will actually translate to a noticeable performance hit depends on how expensive your graph is to begin with, your scene setup, URP settings, and the device you're using.
     
  5. oddreams

    oddreams

    Joined:
    Dec 3, 2016
    Posts:
    17
    How much slower do you think the PBR Master node is, than a simple Bumped Diffuse shader that is built-in Unity?
     
  6. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,348
    If you hardcode the specular color to black like I describe above, not significantly different.