skip to content

Physically Based Rendering

Why engines use microfacet BRDFs: the Cook-Torrance terms (GGX distribution, Smith geometry, Schlick Fresnel), metallic-roughness and image-based lighting. Senior loops probe energy conservation.

on this pageshow

explore

questions

5

In a PBR metallic-roughness material, what do the base colour, metallic and roughness parameters each control?

level: juniorimportance: must knowfreq 55%

answer

  1. one colour, two meanings
  2. metals have no diffuse term
  3. a shared grey reflectance for non-metals
  4. roughness spreads the highlight
  5. scalars packed into one texture

basics

~20 s

Base colour is diffuse albedo for non-metals and specular reflectance (F0) for metals; metallic chooses between those two meanings; roughness sets how widely microfacet normals spread, from a sharp mirror highlight to a broad, dim one.

solid answer

~50 s

A metallic-roughness material describes a surface with three main inputs. `baseColor` is the diffuse albedo when the surface is a dielectric (plastic, stone, wood) and the specular colour `F0` when it is a metal. `metallic` blends between the two cases: the shader computes `F0 = 0.04 * (1 - metallic) + baseColor * metallic` per channel and `diffuse = baseColor * (1 - metallic)`, so a metal gets a coloured reflection and no diffuse term, while a dielectric gets a grey reflectance of about 4% head-on. `roughness` controls how widely the microfacet normals spread; most shaders square it (`alpha = roughness^2`) so the slider feels perceptually even. Metallic is painted as 0 or 1 almost everywhere, with in-between values only at transitions and thin layers such as dust, and the scalar maps are often packed into the channels of one linear texture.

go deeper

for a junior

Recall the two meanings of base colour, that metallic picks between them, and that roughness widens and dims the highlight. Know the 0.04 default for non-metals.

for a middle

Write out how the shader derives F0 and the diffuse colour from the three inputs, why metals lose their diffuse term, and why roughness is squared before use.

for a senior

Spot bad authoring from a render: mid-grey metallic everywhere, dark metal base colours, scalar maps decoded as colour. Explain the transition fringe and how packing and storage choices affect it.

for a principal

Weigh metallic-roughness against specular-glossiness or an added reflectance input for a project: memory per material, how much artists can break, and which material classes need more than the core three.

## What a metallic-roughness material describes A **physically based** material does not describe "a colour plus a shininess" the way older lighting models did. It describes how a surface splits incoming light between **specular reflection** (light that bounces off the outermost interface) and **diffuse reflection** (light that enters the material, scatters inside it and comes back out). The **metallic-roughness** parameterization captures that split with a few inputs that artists paint as textures and that the shader turns into the inputs of a microfacet **BRDF** (bidirectional reflectance distribution function: how much light arriving from one direction leaves toward another). ## The three core parameters | Parameter | Stored as | Dielectric (metallic = 0) | Metal (metallic = 1) | |---|---|---|---| | **Base colour** | RGB, colour-encoded | diffuse albedo | specular colour `F0` | | **Metallic** | scalar, linear | selects the dielectric case | selects the metal case | | **Roughness** | scalar, linear | spread of the highlight | spread of the highlight | - **Base colour** has two meanings. On a non-metal it is the colour of the diffusely scattered light: red plastic, grey stone. On a metal it is the reflectance at normal incidence, `F0`, which is strongly coloured for gold or copper and nearly neutral for steel or aluminium. - **Metallic** decides which meaning applies. A real material is either a conductor or not, so painted values are almost always 0 or 1. Intermediate values appear where filtering blends a metal texel with a non-metal one, or for thin layers such as dust over metal. - **Roughness** describes how widely the microscopic facets of the surface are tilted. Low roughness gives a small, bright highlight and sharp reflections; high roughness spreads the same reflected energy over a wide lobe, so the highlight grows larger and dimmer. ## How the shader turns them into BRDF inputs 1. Specular colour: `F0 = 0.04 * (1 - metallic) + baseColor * metallic`, a blend applied per colour channel. Most non-metals reflect roughly 2-5% of light head-on, so one grey value of 0.04 stands in for all of them. 2. Diffuse colour: `diffuseColor = baseColor * (1 - metallic)`. Light refracted into a metal is absorbed within a tiny distance, so a metal has no diffuse term at all. 3. Roughness remap: `alpha = roughness * roughness`. Squaring makes equal slider steps look like equal visual steps; `alpha` is what the distribution and geometry terms consume. 4. Shading: a diffuse term (often Lambert, `diffuseColor / pi`) plus a microfacet specular term driven by `F0` and `alpha`, evaluated for each light and for the environment. ``` F0 = 0.04 * (1 - metallic) + baseColor * metallic // per channel diffuseColor = baseColor * (1 - metallic) alpha = roughness * roughness ``` ## One sky, three materials The parameterization earns its keep when very different surfaces share one lighting setup and all still look right: - **Brushed metal**: metallic 1, base colour a fairly bright neutral grey (the metal's `F0`), medium roughness. Isotropic roughness gives a soft, round highlight; the streaks of real brushing need an extra anisotropy input that the core set lacks. - **Rough plastic**: metallic 0, base colour the pigment, high roughness. Its colour comes from the diffuse term, and its faint, broad highlight is uncoloured because its `F0` is the shared 0.04. - **Wet stone**: metallic 0, base colour darker than dry stone because water filling the pores traps more light, and roughness much lower because a water film smooths the surface. It stays a dielectric. None of these values bakes in a light direction or a light colour, which is why the same three materials stay consistent from noon to sunset. ## Packing and storage - Base colour is colour data and is normally stored with a colour (sRGB) encoding; metallic, roughness and ambient occlusion are plain numbers and are stored linearly. - The scalar maps are often packed into the channels of one texture, for example occlusion, roughness and metallic in red, green and blue, which saves fetches and memory. - Some material models add a scalar **reflectance** input so that a dielectric's `F0` can move away from 0.04 for materials such as gemstones. ## Metallic-roughness vs specular-glossiness | | Metallic-roughness | Specular-glossiness | |---|---|---| | Inputs | base colour, metallic, roughness | diffuse colour, specular colour, glossiness | | Channels | 5 | 7 | | Dielectric `F0` | fixed near 0.04 | painted per texel | | Physically impossible combinations | hard to author | easy to author | | Typical artefact | thin fringe where metal meets non-metal | a surface reflecting more light than it receives | Glossiness is roughly `1 - roughness`. Metallic-roughness is the more common choice because it is cheaper to store and hard to misuse; specular-glossiness gives more control at the price of letting an artist paint a bright coloured specular on top of a bright diffuse.

  • Why should metallic be painted as 0 or 1 rather than in-between values?
    A real material is either a conductor or not. A value of 0.5 halves the diffuse colour and sets F0 halfway between 0.04 and the base colour, describing a material that does not exist and looks dull and murky. Intermediate values are fine only where they stand for a mix inside the texel, such as dust, corrosion or a filtered transition between a metal texel and a painted one.
  • What does a specular-glossiness workflow offer that metallic-roughness does not?
    An explicit RGB specular colour per texel, so a dielectric's F0 can differ from 0.04 and coated or gem-like surfaces are easy to express. The cost is seven channels instead of five and the freedom to author impossible materials, such as a bright coloured specular over a bright diffuse that together reflect more light than arrives.
  • Why do many shaders square the painted roughness before using it?
    Highlight width does not change linearly with the distribution's alpha parameter: most of the visible change happens at low alpha. Treating the painted value as perceptual roughness and using alpha = roughness squared spreads the visual change evenly across the slider, so artists get fine control over glossy materials instead of a slider that jumps from mirror to matte.

  • A metal needs a dark base colour because it reflects instead of absorbing.
  • Roughness only scales how bright the highlight is, not its size.
  • A dielectric's highlight should be tinted by its base colour.
  • Metallic 0.5 is a sensible default for a semi-shiny surface.
  • Roughness and metallic maps should use the same colour encoding as base colour.
open as a page

What are the terms of the Cook-Torrance microfacet specular BRDF, and what physical effect does each one model?

level: middleimportance: must knowfreq 60%

basics

~20 s

Cook-Torrance specular is D·F·G / (4·dot(n,l)·dot(n,v)): D is the density of microfacets facing the half vector, F how much each reflects at that angle, G the share neither shadowed nor masked, and the denominator maps facet terms back to the macro surface.

open as a page

What does Schlick's Fresnel approximation compute in a PBR shader, and why is F0 near 0.04 for dielectrics but coloured for metals?

level: middleimportance: should knowfreq 50%

basics

~20 s

Schlick's approximation gives reflectance as F0 + (1 - F0)(1 - cos theta)^5, rising from F0 head-on to 1 at grazing. Dielectrics reflect about 2-5% head-on, set by refractive index; metals reflect far more and unequally per wavelength, so their F0 is a colour.

open as a page

How does the split-sum approximation make image-based specular lighting from one environment map cheap enough for real time, and what does it get wrong?

level: middleimportance: should knowfreq 45%

basics

~20 s

It splits the specular lighting integral into two precomputed factors: an environment map prefiltered with the GGX lobe into roughness-indexed mips, and a 2D table over dot(n, v) and roughness that scales and biases F0. Assuming view equals normal loses stretched grazing reflections.

open as a page

In a microfacet PBR shader, an artist's rough gold material goes dark at grazing angles; how do you find out whether the BRDF is losing energy, and fix it?

level: seniorimportance: should knowfreq 40%

basics

~20 s

Run a white furnace test: spheres with F0 = 1 under uniform white light should vanish. Single-scattering GGX darkens rough spheres, worst at grazing, because Smith masking discards light that would bounce again; a multiple-scattering compensation factor restores it.

open as a page