Search Unity

LWRP - Proper way to set up LWRP Standard and Simple lighting shaders?

Discussion in 'Graphics Experimental Previews' started by LeGiangAnh, Aug 3, 2018.

  1. LeGiangAnh

    LeGiangAnh

    Joined:
    Nov 10, 2013
    Posts:
    114
    Hi,

    My team is stuck at setup the material for LWRP Standard and Simple lighting shaders. Especially how to deal with specular and metallic maps.
    As the document stated, we should put the roughness or smoothness map into the alpha channel of the specular map. However, the output of the material is quite ugly and doesn't look like it was in Substance Painter.
    Is there any document for this?
    Link for the psd file of the specular map here: https://drive.google.com/open?id=1N40BufZW4BmvFIPKAPvT_vE3xH4wB0NX

    2018-08-03_15-53-53.jpg Bigdaddy_LOD0_colar1_lambert1_Specular.png
     
  2. Andre_Mcgrail

    Andre_Mcgrail

    Unity Technologies

    Joined:
    Dec 9, 2016
    Posts:
    192
    Would you be able to post up some images from Substance VS Unity?

    From the inspector screenshot I can see 2 things though:
    1. The 'Smoothness' slider should be set to 1, this value gets multiplied with the smoothness map.
    2. The normal map you have there looks like a object/world space normal map, make sure from substance you export out a tangent space normal map as thats what Unity wants.

    Let me know if after trying those things it still looks bad, as it should be pretty close to substance.
     
    LeGiangAnh likes this.
  3. LeGiangAnh

    LeGiangAnh

    Joined:
    Nov 10, 2013
    Posts:
    114
    Hi @Andre_Mcgrail,

    1. Actually, we tried Smoothness 1 but the specular effect almost disappeared completely. Reducing it to 0 also had the same result. The only working value is 0.5. Please see the attached image.
    2. I also send you the correct normal map including all other maps via direct message
    Thanks,
    Anh
     

    Attached Files:

  4. Andre_Mcgrail

    Andre_Mcgrail

    Unity Technologies

    Joined:
    Dec 9, 2016
    Posts:
    192
    Hi,

    So I took a quick look at the files you sent, seems that you were missing the alpha channel in the specular map for the gloss/smoothness, I see you are using PNG, I would suggest TIF if you need a dedicated alpha channel as PNG can do some weird things, its ok if the alpha is just for alpha but I find TIF better for if you are packing in a texture.
    Secondly seems like the Gloss map was in the wrong colourspace somehow, maybe this was due to export settings in substance? which export preset did you use? I has to apply a 0.45 Gamma(1 / 2.2) shift in photoshop for it to match what was in substance.

    Heres what I ended up with after those tweaks:
     
    LeGiangAnh likes this.
  5. LeGiangAnh

    LeGiangAnh

    Joined:
    Nov 10, 2013
    Posts:
    114
    Hi,

    1. I corrected the normal map as this (export to 32 bit to have correct alpha channel):
      https://drive.google.com/open?id=1U82ZRbud3JifF4a1uqnGnTTzedfxRPIo
      Is this the correct setup or I must use TIF?
    2. Here is the export preset of Substance Painter
      Preset.png
    3. After modifying the specular map as 1. above, the gloss effect appeared when I set to 1 already but only in PBR, not in Simple Lighting
      PBR.png
      Simple_Lighting.png
      I assume that we should have the glossiness effect on Simple Lighting as well although it may not be clear as PBR?
     
  6. LeGiangAnh

    LeGiangAnh

    Joined:
    Nov 10, 2013
    Posts:
    114
  7. Andre_Mcgrail

    Andre_Mcgrail

    Unity Technologies

    Joined:
    Dec 9, 2016
    Posts:
    192
    By the looks of the inspector, in the simple lighting screenshot, the glossiness source is set to BaseAlpha which should be switched to SpecularAlpha.

    Sorry for the late reply, I have been on vacation for the last few days.
     
  8. LeGiangAnh

    LeGiangAnh

    Joined:
    Nov 10, 2013
    Posts:
    114
    Hi,

    That's my mistake when taking screenshot actually. I switched to SpecularAlpha before but I didn't help.
    2018-08-15_3-18-26.jpg
     
  9. Andre_Mcgrail

    Andre_Mcgrail

    Unity Technologies

    Joined:
    Dec 9, 2016
    Posts:
    192
    Hmm, you are right, and I actually think this is a limitation fo the simple lighting shader (something I've been meaning to look at fixing) the Glossiness is actually the strength of the highlight, and what you want is to control the shininess with a texture yet you only get given the slider, this is a huge oversight on our part I apologise.

    I will look into creating a solution for this, unfortunately I will also have to figure out how to create an upgrader to not ruin anyones project who is using this currently as is.
     
    LeGiangAnh likes this.
  10. LeGiangAnh

    LeGiangAnh

    Joined:
    Nov 10, 2013
    Posts:
    114
    Yes that's the problem.
    If I remove the specular map, change the specular color to White and use the slider, it will show the clear glossy effect like this:
    2018-08-15_15-00-28.jpg
     
    Last edited: Dec 5, 2018
  11. LeGiangAnh

    LeGiangAnh

    Joined:
    Nov 10, 2013
    Posts:
    114
    Any update for this @Andre_Mcgrail ?
    It is quite confusing that the model without a specular map showing a clearer glossy effect than the one with specular. My 3D artist is so confused and recommended me to remove the spec to reduce the file size (while even increase the quality). The most annoying issue is, I have to put the smoothness value to 0.6 to show the glossy effect (while it should be 1 as you said)
    Here is the example: I removed the specular map on the right one and it is much better.
    Spec vs Non-Spec.jpg
     
  12. Andre_Mcgrail

    Andre_Mcgrail

    Unity Technologies

    Joined:
    Dec 9, 2016
    Posts:
    192
    Hey sorry for not getting back earlier.

    There is a PR in flight to fix this, but it will change how all the materials created with the SimpleLit shader will look, since you now have a layout that makes sense and matches more closely with the Lit shader. The ETA on this is probably 2 weeks out and will only be going into a 19.1 compatible package since it is bundled with a lot of shader library changes.
     
  13. LeGiangAnh

    LeGiangAnh

    Joined:
    Nov 10, 2013
    Posts:
    114
    Thank you. Btw, what is the PR?
     
  14. Andre_Mcgrail

    Andre_Mcgrail

    Unity Technologies

    Joined:
    Dec 9, 2016
    Posts:
    192
    This PR: https://github.com/Unity-Technologies/ScriptableRenderPipeline/pull/2464

    I need to do some cleanup on it still and we are also working on a material versioning system so we can upgrade peoples shaders, since right now if you use this branch you will have to do some manual fix-ups to your materials as property names have changed.
     
  15. LeGiangAnh

    LeGiangAnh

    Joined:
    Nov 10, 2013
    Posts:
    114
    Thank you. Wait for your news then
     
  16. morphtek

    morphtek

    Joined:
    Jan 13, 2018
    Posts:
    2
    So was this fixed or not ?
     
  17. Andre_Mcgrail

    Andre_Mcgrail

    Unity Technologies

    Joined:
    Dec 9, 2016
    Posts:
    192
    Yes this was merged quite some time ago and will be in any version of LWRP >=5.3.0 and also in Universal RP.
     
  18. morphtek

    morphtek

    Joined:
    Jan 13, 2018
    Posts:
    2
    Were at 6.9.1 lightweight rp and unity 2019.2.5f1 and still it doesnt work ,were also using substance painter 2019.1 ,
    and the problem still persists its like theres no diference with or without the metalic alpha map ,

    also sometimes it seems to work when i switch to simple lit and back to lit ,but when scene is reloaded some materials keep the proper rendering while some lose and its like theres no map
     
unityunity