Physically Based Rendering (PBR)¶
Physically based rendering is used in HE2 games and mostly associated with “PRM” textures. By combining several textures of various properties, you can create a wide range of materials to render physically accurate looking surfaces.
Components¶
Albedo¶
Albedo is the base color of a surface and is used with “diffuse” lighting.
Smoothness¶
Smoothness determines how reflective a surface is. The lower the smoothness, the blurrier the reflection. This is represented by a value between 0 and 1.
Specular¶
Specularity is less a physical property and moreso an artistic tool for creating materials. Hedgehog Engine 2 specifically makes use of “F0 reflectance”.
Seperately from diffuse lighting, specular lighting controls the visibility of specular lighting and reflections. You can imagine it as a “layer” on top of the diffuse lighting, with the specularity acting as the “layer transparency”.
It’s represented by a value between 0 and 1; Usually a specular value of 0.125 is considered the “default”.
Important
When used in a PBRFactor
shader parameter, the specular value is used as is.
In PRM textures however, it is divided by 4. Thus, the highest specular value achievable with a standard image format is 0.25.
This can be circumvented by using using an HDR image format such as R16G16B16A16_FLOAT
.
Metallic¶
Metallic is similar to specular, with the 2 differences:
The albedo color affects the color of reflection
A more linear value progression
Similarly to specular, it also can be seen as a seperate “layer” that is placed above the specular lighting.
It too is represented by a value between 0 and 1. Usually a metallic value of 0 is considered the “default”.
Tip
Usually, metallic is done either 0 or 1, and rarely anything in between.
Combining Specular and Metallic¶
While rarely done, it is possible to use specular and metallic lighting together.
Emission¶
Emission is essentially the colored “glow” of the surface, like the light coming from a lamp. This is unaffected by any lighting that may hit the surface.
Unlike the other surface values, emission supports high-dynamic-range images, and can use values beyond the 0-1 range, which the rendering engine may process in various ways.
Additionally, emission is often accompanied by a “Luminance” parameter that changes how bright the emission texture appears.
Ambient occlusion¶
Ambient occlusion (often abbrivated with “AO” or “A/O”) is, as the name implies, responsible for occluding/removing ambient lighting.
In Hedgehog Engine 2 games, ambient lighting consists of
Global illumination (GI)
Environment reflections (“Image based lighting”; IBL)
Screen space reflections (SSR)
Ambient occlusion too is represented by a value between 0 and 1. However, unlike the other values, where a higher greater value “increases” the effect, here a lower value increases the occlusion of ambient lighting.
Thus the default value, at which no ambient light is occluded, is 1.
Note
Note how, in the chart above, the “sun” in the reflection is still visible. That is because it is a sun light, and not actually part of the environmental reflections.
Ambient occlusion is often used to simulate shadows in narrow spaces and corners, as ambient light is more likely to get trapped in such spaces.
Compositing setup used above
Examples¶
Now, with all the info above, even moreso when combined with Normal maps, we can create a wide range of materials to use!
Let’s look at some examples: