Home Technical Talk

theoretical pbr question, how does energy conservation work?

polycounter lvl 11
Offline / Send Message
stickadtroja polycounter lvl 11
so im trying to understand pbr, and make it relatable to the real world, and im stuck on the energy conservation theory.
it says, the how much reflective light a material has, is directly proportional to how little diffuse light it has.

so a highly reflective material has a darker diffuse, and a non reflective have brighter.
this doesnt work in the real world for me.
say i have a white rubber ball, not very reflective. i dip it in water and now its very reflective, but clearly the diffuse colour hasnt changed right? how does this make sense?

Replies

  • CapableWizard
    Offline / Send Message
    CapableWizard polycounter lvl 9
    In the example you've used (the white rubber ball) by dipping it in water you're not increasing it's specularity but rather increasing it's gloss. The specular amount is relative to the chemical composition of the material and in this example the material is staying the same. What is actually happening is all the microscopic cracks in the rubber that cause it to reflect light all over the place are filled in by water which by it's nature is very smooth. Therefore the light is mostly reflected in the same direction hence the sharper highlight. 

    There's actually some more complicated stuff that happens when something gets wet but this is a layman's explanation I guess.
  • Eric Chadwick
    The reflection on a shiny white ball is much less bright than the reflection on a shiny black ball. They are receiving the same lighting. The white ball is reflecting most of that light from its indirect bounces (diffuse), and little from its direct bounces (reflection). It's bouncing the sum of what it receives (minus a little in absorbed heat, subsurface scattering, etc.). The black ball does the opposite. I don't know if that helps.
  • EarthQuake
    The concept of energy conservation states that a given surface can not reflect more than 100% of the light that hits it. This is logical and physically grounded in reality, how could something reflect more than 100% of the light that hits it? It would have to generate photons of its own to do such a thing.

    So, if you have a chrome ball, which is 100% reflective, and you mistakenly set the diffuse/albedo value to 50% (for pure metals, diffuse/albedo is typically zero), a shader that has an energy conservation function would automatically darken your diffuse to zero.

    Energy conservation does not in any way state that a material must reflect 100% of the light. Most insulators (non-metals) adsorb or scatter some of the light so it's very plausible to have a material that has a diffuse value of 50% and a reflectivity value of 4%, or any number of a huge range of possibilities, as long as diffuse + specular doesn't = greater than 100%.

    I think it's also important to clarify between diffuse reflections (scattered, indirect reflections, the color of most insulators) and specular reflections (direct reflections, what we typically refer to as reflections in rendering), otherwise Eric's sentence "The reflection on a shiny white ball is much less bright than the reflection on a shiny black ball." can be rather confusing. Both a white and black rubber ball have the same specular reflection intensity, but differing diffuse reflection intensities.

    As capablewizard points out, it's also very important to understand the difference between specular reflection intensity, and surface roughness/glossiness. Most insulators have specular reflectivity in a pretty narrow range, around 4%, however, a good deal of variation in terms of the look of the specular reflections depends on how smooth or glossy the surface is. The smoother the surface, sharper the highlight, the rougher the surface, the more the rays are reflected in random directions, which creates larger, blurrier highlights. Energy conservation applies here too! Even though the specular reflection intensity is the same on two types of plastic, one smooth, and one rough, the rough one will appear to have dimmer reflections, as the reflections are spread over a larger area. Most modern PBR shaders will account for this, so you don't have to manually adjust the reflectivity content, only the gloss/roughness map.

    More here:
    http://www.marmoset.co/toolbag/learn/pbr-theory
    http://www.marmoset.co/toolbag/learn/pbr-practice


  • stickadtroja
    Offline / Send Message
    stickadtroja polycounter lvl 11
    alright i read those links, so here is my visaulisation to make sure i understand;

    1. specular
    2. angle of the specular reflection, based on the glossiness of the surface. if its wide its more spread out and thus weaker (energy conservation)
    3. diffuse

    different materials have different amounts of specular reflections and diffuse reflections. metals have high amount of specular, and thus, lower diffuse (energy conservation)

    is this correct?

    if so, the maps we use in a pbr workflow would be,
    diffuse; the colour of the light after it bounced around underneath the surface
    gloss: the angle of specular reflections (microsurface)
    metalness: amount of specular vs diffuse

    is this also correct?
  • stickadtroja
    Offline / Send Message
    stickadtroja polycounter lvl 11
    ""The reflection on a shiny white ball is much less bright than the reflection on a shiny black ball." can be rather confusing. Both a white and black rubber ball have the same specular reflection intensity, but differing diffuse reflection intensities."

    so the total light output is lower for the black ball? same spec, lower diffuse? so the spec doesnt change in strength or angle if only the diffuse is different right? sounds really obvouis when i wrote this now, a black ball is less bright than a white ball basically
  • JordanN
    Offline / Send Message
    JordanN interpolator
    Somewhat related: I once did a test and found out certain colors will always appear brighter/darker than others in the same lighting conditions.

    I wrote about it here.
    http://polycount.com/discussion/133040/color-theory-question





  • EarthQuake
    ".... is this correct?"

    Yep.

    "if so, the maps we use in a pbr workflow would be,
    diffuse; the colour of the light after it bounced around underneath the surface
    gloss: the angle of specular reflections (microsurface)
    metalness: amount of specular vs diffuse

    is this also correct?"

    A PBR system doesn't have a specific set of inputs. Unreal 4 for instance uses Albedo, Roughness (same as gloss but inverted) and Metalness. Other engines use Diffuse (or albedo), Gloss and Specular. The difference between the Metalness and Specular workflows are outlined in the tutorials I linked above, but here is another that goes into more detail: 
    http://www.marmoset.co/toolbag/learn/pbr-conversion

    "so the total light output is lower for the black ball? same spec, lower diffuse? so the spec doesnt change in strength or angle if only the diffuse is different right? sounds really obvouis when i wrote this now, a black ball is less bright than a white ball basically"

    Yep, pretty much. The black ball absorbs more of the light, which is why a car with a black interior left out in the sun will be hotter than a car with a white interior, and why painting a black roof white can help reduce cooling costs. The specular reflectivity does not tend to vary for insulators of the same material type, metals of various sorts have higher variances, pure metals tend to reflect in the 70-100% range.
  • EarthQuake
    Another interesting tidbit, if you have two balls, and you paint one with a glossy white paint, and the other with a glossy black paint, and looked at each of them, you might quite reasonably assume the black one was more reflective. It's not though, the diffuse is simply darker, while the specular reflectivity is the same brightness, so you get a bright highlight on a white surface and a bright highlight on a black surface, and the end result is that due to the contrast in values, the darker material looks more reflective.

    Here is an example, both have specular intensity set to 0.04 and gloss set to 0.09:
  • JedTheKrampus
    Offline / Send Message
    JedTheKrampus polycounter lvl 8
    Well, technically UE4 calls it Base Color since it can represent albedo or reflectivity depending on the value of the metallic map.
  • EarthQuake
    Semantics, albedo is basically a synonym for base color, albedo essentially means the measured reflectance value of something, which could, on a more esoteric level, mean specifically diffuse albedo or specular albedo. The reason the base color/albedo map stores both diffuse and specular content in UE4 is because they use the metalness workflow, not the other way around. It's important not to get too attached to input types/names and rather pay attention to their function instead.
  • stickadtroja
    Offline / Send Message
    stickadtroja polycounter lvl 11
    aright i think i got it now! thanks eq and the others!

    follow up question:
    a big difference with the pbr workflow is that you cant pick the diffuse values yourself anymore you have to base it somewhat on scanned data and such.
    why? if i paint a wall in real life, i get to pick whatever diffuse i want right? why is this not true for the pbr workflow?
    in one of the pbr texture conversion tutorials you had a gun, and wrote  "this diffuse is to dark, clearly made for a specific light condition". how do you know thats just not a dark painted gun?
  • CapableWizard
    Offline / Send Message
    CapableWizard polycounter lvl 9
     A big advantage of PBR is that materials will look accurate whatever their lighting conditions. This was not always the case before PBR so textures were often custom made to match the lighting they're intended to be used in.
    Obviously Earthquake wrote the article, but I'd guess he was referring to the real world reference of the plastic on the gun. Effectively what he's saying is - when I compare the plastic in marmoset to the plastic in this photo I have of the gun in real life, it's too dark. Paint can be any albedo you want really, so long as you mimic the physical properties of the material. A red matte paint and a blue matte paint will probably have an extremely similar spec and gloss, so in this example changing the albedo is probably fine.
  • EarthQuake
    It's a misconception that you can't pick your diffuse/albedo value in a PBR system. Diffuse values will vary heavily for insulators depending on what color a material is. If you find a measured diffuse value for say, red paint, that doesn't you have to use that value for every type of paint, obviously blue paint or black paint or white paint will have a totally different value.

    So, how do you tell if your textures are too dark? In the case of that gun from the tutorial, it was a lesson we learned over the course of the project, that we we're constantly turning up the brightness with the lighting system to compensate for textures that were painted too dark. Even if that sort of workflow works out in the end, you're going to see a drop in texture quality because you have less range to store the values in if most values are below 127 or so. Plus, tweaking lighting conditions to match assets can easily result in a big time sink.

    You can also compare to a macbeth/ color chart, which has known values for certain materials. See: https://en.wikipedia.org/wiki/ColorChecker - Note that black is is not 0,0,0 but rather about 20% brightness (sRGB), black here corresponds to black paint essentially. There are few real world materials that get anywhere close to actual black, by that I mean do not reflect a portion of the light that hits the surface.

    So there is a range of usable values you should generally stick to, unfortunately there isn't one universal source with enough examples for various material types, so you'll have to do some experimentation and use logic/extrapolation to find good values.
Sign In or Register to comment.