Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

UPR Lit Shader, Specular Setup Keywords Scripting

Discussion in 'Universal Render Pipeline' started by nachocgi, Feb 10, 2020.

  1. nachocgi

    nachocgi

    Joined:
    Mar 13, 2018
    Posts:
    18
    Hi guys,
    working on a 2019.3 UPR template, using UPR Lit Shader with Specular Mode.

    Is a problem I read before in some threads, but this time I cannot resolve it (when the material looks correct only when you open the inspector and "refresh" it)

    Due to I change the material maps (also smoothness values and so) via script at runtime, I use the keywords as follow:

    "_SPECGLOSSMAP"
    "_SMOOTHNESS"
    "_NORMALMAP"

    and load the maps slots as follow:
    "_BaseColor"
    "_SpecGlossMap"
    "_BumpMap"

    As far as I know, this is correct, but Im missing something because in Debug Mode on Inspector I observe that when I load a Specular map, it loads correctly into the slot,
    BUT, it doesnt work properly until I look the inspector in Normal Mode, and also, when I change again to Debug Mode after the "refresh", the shader as added a "_METALLICSPECGLOSSMAP" keyword by itself, and removed the "_SPECGLOSSMAP".

    That is what i dont understand, because I setup the shader as Specular Mode from the beginning,

    Am I missing some aditional Keyword to make Lit Specular works properly?

    Many Thanks!!
     
  2. nachocgi

    nachocgi

    Joined:
    Mar 13, 2018
    Posts:
    18
    please help, anyone as this issue with Lit Shader in Specular Setup?
    I update the UPR to 7.2.0 but still the same.

    One curious thing is if I change the shader code from #pragma _METALLICSPECGLOSSMAP to #define, the Specular Map is loaded, but as no effect on editor (on the mesh), also it doesnt change the keyword by itself and dont make the "Inspector refresh effect"...

    Is like I need some more keyword to get Lit Shader understand the Specular Map... I tried keywords like "_GLOSSINES", "_SMOOTHNESS", "_GLOSSMAPSCALE"...but no luck

    Thanks guys!
     
  3. mendemarcus

    mendemarcus

    Joined:
    Feb 20, 2020
    Posts:
    1
    You can find the Keywords under Edit Shader:

    Bildschirmfoto 2020-02-20 um 10.22.28.png
     
    Oelson likes this.
  4. nachocgi

    nachocgi

    Joined:
    Mar 13, 2018
    Posts:
    18
    thanks mendemarcus!
    At the end, even if I use the specular setup, I also have to give the keyword "_METALLICSPECGLOSSMAP", to see the correct result.
    That was what I did not understand, if I use the Shader in Specular Mode,(an Specular Map), it didn't make sense to use a keyword for "Metal"....but it's the only way it works

    Thank you guys!