Search Unity

PBR roughness in unity shader?

Discussion in 'Shaders' started by ekergraphics, Apr 11, 2017.

  1. ekergraphics

    ekergraphics

    Joined:
    Feb 22, 2017
    Posts:
    257
    I'm trying to create a material which replicates the preview for the excellent set of textures available here:

    http://freepbr.com/materials/worn-scuffed-plastic-pbr-material/

    However, the material looks flat and boring in Unity regardless of smoothness value.

    Now, that site offers two options, one for Unity and one for Unreal and the Unreal download contains an extra roughness map that Unity's standard shader doesn't seem to have a place for.

    However, if you switch to the specular setup shader, you can use the roughness map in the specular position, although that doesn't seem to look correct.

    Can anyone offer some guidance in this area?
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    Unity's Standard shader has the smoothness stored in the alpha channel of the metal texture (or optionally the albedo). Those PBR textures come with a metal texture which you need to use.
     
  3. ekergraphics

    ekergraphics

    Joined:
    Feb 22, 2017
    Posts:
    257
    That metal texture is all black, though (I've checked with Photoshop).

    However, if I put the roughness texture in that metal slot you mentioned, and then mark that texture as alpha from greyscale, I do get better results.

    The only problem now is that the material is really super shiny, and if I switch to the standard shader (without specular), it's really super dull.
     
  4. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,794
    Metalness RGB should be black and the alpha should contain the inverse of the roughness map.
     
  5. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    Yes, the metal texture's RGB is all black, because it's plastic and plastic isn't metal, but there's an alpha channel that isn't just black. They're supplying that texture for a reason.
     
  6. ekergraphics

    ekergraphics

    Joined:
    Feb 22, 2017
    Posts:
    257
    Well, that was real silly of me. I mistakenly assumed that Unity wouldn't be able to read PSD files (because it's a complicated proprietary format), but it did and correctly included the alpha as well!

    It does appear to work now, thank you!