Documentation

Discord GitHub
Hekky Shader Docs

What is PBR?

Note

This explanation is not a technical one. It is designed to familiarise you with the core concepts of PBR, as understanding them well is important if you want to make or use good textures. This explanation will focus the concepts implemented inside of Hekky PBR, but these should be exchangeable for other shaders too.

Physically Based Rendering (PBR) refers to the practise of using realistic (i.e. based on real life physics) shading and lighting algorithms to achieve the most photorealistic result possible in 3D rendering. While PBR is designed to mimic realistic shading and lighting, it does not mean that it can’t be stylized.

Standardisation

PBR is NOT standardised. Each application, shader and renderer have their own implementation of it. Luckily, the implementations are similar enough to be able to transfer PBR textures from one shader to another.

Core concepts

Reflections

In the real world, light rays get reflected off a surface and bounce around the scene. The way light gets reflected can be represented in one of two ways, based on how rough a surface is.

Specular Reflections refer to light rays which are reflected in the exact same angle they arrived in. This is basically a mirror, and what you normally think of as a reflection.

Specular reflection example demonstrating a highly reflective surface

Diffuse Reflections refer to light rays which are reflected randomly. Diffuse reflections aren’t really “reflected”. In reality the light is absorbed (i.e. the light goes inside the material) by the material, then scattered about. Some of the light gets absorbed by the material itself, meaning that the light color can changed based on the material. This is why we perceive orange painted plastic as “orange” instead of white for example.

Specular reflection example demonstrating a red and rough surface

We can control if a surface uses specular reflections or diffuse reflections with the metal mask parameter. A surface cannot be half metallic and half dielectric (a dielectric surface is the opposite of a metallic surface).

Other pipelines

You might see metal mask referred to as metalness, metallic or metal in other shaders. These refer to the same property.

We can control the reflectivity of a surface via the roughness parameter. The rougher a surface is, the blurrier the reflections appear. The smoother a surface is, the smoother the reflections appear.

Smoothness

Smoothness (or glossiness) is the inverse of roughness.

Roughness

Energy Conservation

One of the key principles of PBR rendering in comparision to other rendering methods is the principle of energy conservation. This means that a surface never reflects more light than it receives. The only exception to this is when a surface is said to be emissive.

Occlusion

Occlusion refers to the lack of light reaching a surface. It’s used to tell the shader which parts of the model should be darker than others.

Ambient Occlusion Off Ambient Occlusion On

Emission

Some surfaces, such as small LEDs, emit light, but are too small to be an entire light source. An emissive map is used to allow such surfaces to cast light.

Anisotropy

Anisotropy refers to stretched specular reflections. It’s typically seen at angles around a point on a surface too. Brushed materials are common anisotropic materials.

Anisotropy example