Understanding PBR and digital color for game artists.
Since our move to Cambridge (the quaint village of St Ives to be more exact) I've been studying PBR (physically based rendering) and digital color more closely. I was happy to discover many things I did not know about.
The following is not a deep dive into details of PBR or digital color, but instead a highlight of the fundamental principles which help us make informed decisions.
Physically Based Rendering
PBR emulates how light behaves in the real world, specifically with the law of conservation of energy. It's primary goal is photorealism. Highlights and reflectance are all determined by the game engine, instead of baking it into maps (AO being an exception, but you should not bake the AO into the albedo or roughness. Micro-occlusion is the other exception).
Sébastien Lagarde has a fantastic PDF online (from his GDC talk) where he dives into how PBR was implemented in UE3 for Remember Me, and specifically what that meant for the artists on the project. Much of what I've learned is inspired by him.
The right values
The most important thing to note is that PBR doesn't magically make things realistic. You need to input the correct values observed from real life. These can be counterintutive to grasp, such as albedo (diffuse/base color). In real life, we never see an objects' true color. Sebastien notes that most artists author an albedo map too dark, resulting in too-dark materials and fewer light bounces than would occur in real life.
Using a process called cross polarization photography we can see an object's color without any highlights. This in combination with a Macbeth chart gives you the ability to get really close to an object's true color (in RGB).
You can also find existing values on this chart: https://seblagarde.wordpress.com/2014/04/14/dontnod-physically-based-rendering-chart-for-unreal-engine-4/ and on this website: https://physicallybased.info/, as well as here https://gbaran.gumroad.com/l/rjthlk.
For metallic surfaces the albedo value is extra important since metal (smooth metal especially) is difficult to light. The albedo values of metals are really high, sitting at a minimum of 180. There's more detail in Adobe's PBR guide.
As Sebastien mentions, the porosity (porousness) is notably absent in the PBR shading model, but is highly influential when the material gets wet. As a general rule, more rough surfaces are also more porous, but there are numerous exceptions. Knowing and defining the porosity of your surface might be useful when making games with dynamic weather.
The roughness map gets a special callout because its the map that is most creative and has the most potential for storytelling. Fingerprints, dust, smudges, you name it.
Getting the right values is key for getting the most out of the PBR shading model and preventing your scenes from becoming too dark.
In real life, the more chromatic (saturated) a color is, the darker they appear. The reason for this is pretty complex but what is important is that some digital colorspaces, especially when looking at HDR, can display colors that would not be possible in real life. The result, to our human eyes, is that some objects become "emissive". That is, they look like they are emitting light themselves by being brighter than they could be in real life. That means the law of conservation of energy is broken.
Since digital color is additive, but real life color is substractive, by definition any digital color is in its own right emissive, and therefore not respecting the law of conservation of energy. While the shading model inside your game engine might respect the law of conservation of energy, your monitor still has to light up a pixel. This can result in issues mentioned like above.
A quick fix to make things appear more realistic is to use a filmic lookup tables (LUT) to adjust the colors. This is a "hack" but it's interesting to investigate why it works.
Filmic (or cinematic) LUTs are based upon real film developed from real photos. How light interacts with developed film is identical to how light interacts with other surfaces, with the bonus that the chemical composition of the film further "tweaks" the colors. This makes filmic LUTs look realistic, because it prevents colors that cannot exist in the real world from appearing on-screen. With LUTs you can also do the opposite to achieve effects that would not be possible otherwise inside the standard PBR shading model.
As an aside, LUTs are no longer recommended for video game pipelines because it only exists in LDR (low dynamic range) and sRGB. Using the tonemapper included in game engines is the way to go.
Armed with this knowledge we can prevent colors on-screen from clipping into impossible ranges. And the PBR shading model is a huge tool to help us do that.
At KeokeN we have just recently implemented a post process material that helps us check our average albedo values, similar to what Sébastien Lagarde did for Remember Me. Like he observed (back in 2012), we've discovered that most of our albedos are too dark and cause rooms that should be brighter end up pretty dark. Hacks were employed like increasing the bounce light intensity, but now that we're able to fix the root cause those will no longer be necessary (except for art direction purposes).
Thanks for reading. Please tweet or email me if you have any comments/opinions/questions, I’ll be happy to engage with you.
Substance PBR guide part 1 & Substance PBR guide part 2
Feeding a physically based shading model - Sébastien Lagarde
Implementing PBR in Remember Me - Sébastien Lagarde
Why do wet objects become darker - Ask a mathematician
Filmic Tonemapper - Unreal Engine