Search Unity

Understanding PBR reflections etc

Discussion in 'General Graphics' started by mbowen89, Oct 4, 2018.

  1. mbowen89

    mbowen89

    Joined:
    Jan 21, 2013
    Posts:
    639
    So I have made a custom shader that uses R for spec, G for smoothness. That means I am not using an RGB spec for my spec PBR shader, just greyscale.

    Anyways, it seems like I really have to crank up the spec to get it so I can see clouds/trees very clearly on my blue tractor hood. I think it's ok to compare this to a car hood. So the problem is, when I turn up the spec it basically is lerping it from a blue hood from the blue albedo color, to a mirror at the other extreme. However if you look at the attached picture of this black car, you can see the clouds as if the hood was a mirror, yet it's still black retaining the cars color.

    I just can't seem to wrap my mind around how all of this works.

    image.png
     
  2. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    A car surface - like in this picture - would be almost 100% smooth, and almost 100% metal.

    A metal surface contribute very little to the color, while the opposite - a plastic surface - gives almost all its color to the reflection.

     
  3. mbowen89

    mbowen89

    Joined:
    Jan 21, 2013
    Posts:
    639
    OK exactly, but then why does that car hood still look black other than the sun/clouds? It should look either like a complete mirror then if its fully smooth and metal.
     
  4. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,348
    Nope. Quite smooth, yes, but not metal. Most of the reflections you see in car paint comes from the glossy coating on the paint, and not the paint itself. If it was from the paint, and the paint is metallic, then the reflection would be significantly more blue and much darker. In reality even "metallic paint" used on cars is quite diffuse as the metal reflections come from small bits of metal ground up or flaked and embedded within the paint. In this case the car paint is a non-metallic black paint.

    The real answer is the sky is really, really bright. Using your basic LDR skybox, or even using Unity's built in procedural sky box, is not realistically bright. Try an HDR panoramic skydome instead and you'll get something much closer to what you see in the real world. For example, try this:
    https://www.hdri-hub.com/hdrishop/freesamples/freehdri/item/76-hdr-sky-cloudy

    Unity's Standard shader does not do a good job of replicating layer materials. For black car paint or similarly basic colored paints, just having a high smoothness will get you pretty close. But for fancier paints you'll likely need to use a custom shader, or get one from the asset store that better approximates clear coating. Unity's HDRP includes a clear coat option as well, as many real world materials actually have a clear coat of some kind.
     
    Meceka likes this.
  5. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,348
    Here's an example of that HDR skybox I linked above with a sphere using the standard shader set to albedo of RGB (12,12,12), smoothness 0.94, metallic 0.

    upload_2018-10-4_13-43-39.png
    edit: fixed exposure
     
    Last edited: Oct 4, 2018
  6. mbowen89

    mbowen89

    Joined:
    Jan 21, 2013
    Posts:
    639
    So it's almost like I need to have it do the base layer of paint, and then somehow the reflections are more of what are in the "clear coat layer"?

    Let me show you what I have so far, please let me know if you think this is very accurate:

    Capture.PNG
    capture2.PNG


    I was having what I thought were some problems but I think it's because I had a lot of gravel on one side going up a steep hill making the reflection have a lot of "bright" gravel really throwing my reflections off even though the hood seemed realistic. I moved the tractor to a couple other locations and it seems much better.

    There are couple of bad things about reflection probes though... I can't seem to set layer cull distances like I can on a camera, so if I want to show trees but only within 20m etc I can't do that like a camera can, anyone have ideas on that?

    Also in the lighting tab in unity, there is gradient environment lighting with sky color, equator, and ground. Could I use this instead of a reflection probe for a lower end version of a shader and get similar results, just won't have actual cloud/tree reflections in it of course? Thanks for the help guys!
     
  7. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,348
    I mean, everything in that scene is quite dark compared to the real world. Even freshly tilled soil is probably brighter than the dirt you have there. Same with grass, sand, trees, sky, everything. It seems like you have your main directional light and skybox set to be way darker than they should be, or have some sort of post that's making everything darker. That almost feels like a day for night photo. That's probably a big reason why the tractor's reflections feel so dull. Crank everything up!
     
  8. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,348
    The easiest solution is just to use a relatively short clip distance for realtime reflection probes. The alternative would be to use layers and hide all trees from the reflection probe, then have a seperate reflection probe only layer of simplified trees.

    You could also not use a placed reflection probe at all. By default objects will reflect a reflection probe that's just the skybox. If the skybox is reasonably related to the scene you have (ie: has brown or green ground) you may not even need a reflection probe at all for something like what you're doing.
     
  9. mbowen89

    mbowen89

    Joined:
    Jan 21, 2013
    Posts:
    639
    I'm using an asset called Unistorm which comes with it's own dynamic skybox. One reason I have the clip distance so far for the probe is that is the only way to get the dynamic clouds that also come with Unistorm.

    Another big thing is that I just tried switching to linear color space today, after already making a couple of PBR based assets, so that changed stuff a bit too and had me more confused etc.. but I think it'll be a good change.