Physically-based Rendering
- notations:
- p is the shading point.
- ωo is the outgoing view direction (shading point to eye)
- ωi is the outgoing lighting direction (shading point to light)
- n is the normal vector
- t=2(n⋅ωo)n−ωo is the reflective direction
- h=∣∣wi+wo∣∣wi+wo is the halfway vector (different from n !)
- m is the metalness
- ρ is the roughness
- a is the ambient color (base color)
- s(ωi) is the occlusion probability from the shading point to light.
- rendering Equation:
c(ωo)=∫ΩL(ωi)f(ωi,ωo)(ωi⋅n)dωi
-
micro-facet BRDF (Cook-Torrance 1982):
f(ωi,ωo)=(1−m)πa+4(ωi⋅n)(ωo⋅n)DFG
The BRDF can be divided into diffuse + specular terms, where the specular term includes:
F0=m∗a+(1−m)∗0.04F=F0+(1−F0)(1−(h⋅ωo))5
-
split-sum approximation (Karis and Games 2013)
∫ΩL(ωi)4(ωi⋅n)(ωo⋅n)DFG(ωi⋅n)dωi=∫ΩL(ωi)Ddωi∫Ω4(ωo⋅n)DFGdωi
-
lighting representation
L(ωi)=(1−s(ωi))gdirect(ωi)+s(ωi)gindirect(ωi,p)s(ωi)=gocc(ωi,p)
- direct term (from light): only dependent on the outgoing light direction.
- indirect term (from other reflective surfaces): also dependent on the current shading point.
Except for the common metallic-roughness model, there is also specular-glossiness model for PBR (e.g., Unity).
Both models can be converted between: https://kcoley.github.io/glTF/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness/examples/convert-between-workflows/
glossiness=1−roughnessdiffuse=(1−metallic)∗basecolorspecular=metallic∗basecolor
A detailed documentation can be found: https://kcoley.github.io/glTF/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness/