Material Library & Shaders
The physics of optical reflectance, microfacet scattering, and procedural synthesis—from Lambertian diffuse and Cook-Torrance BRDFs to the Disney Principled BSDF, subsurface scattering, and Perlin noise.
Cook-Torrance & GGX Reflectance Dial
Optical & Shading Models (12)
Energy-Conserving Microfacet MathematicsLambertian Ideal Diffuse Reflection
The fundamental baseline of diffuse shading. Assumes light entering a matte surface is scattered equally in all directions, regardless of the camera view angle.
f_{\text{Lambert}}(\mathbf{l}, \mathbf{v}) = \frac{\rho}{\pi} \max(0, \mathbf{n} \cdot \mathbf{l})vec3 diffuse = (albedo / 3.14159265) * max(dot(N, L), 0.0) * lightColor;
Cook-Torrance Microfacet Specular BRDF
The cornerstone of Physically Based Rendering (PBR). Breaks specular reflection into three distinct physical phenomena: facet alignment (D), reflection strength (F), and micro-shadowing (G).
f_{\text{spec}}(\mathbf{l}, \mathbf{v}) = \frac{D(\mathbf{h}) \cdot F(\mathbf{v}, \mathbf{h}) \cdot G(\mathbf{l}, \mathbf{v}, \mathbf{h})}{4 (\mathbf{n} \cdot \mathbf{l}) (\mathbf{n} \cdot \mathbf{v})}vec3 specular = (D * F * G) / (4.0 * max(dot(N, L), 0.001) * max(dot(N, V), 0.001));
GGX / Trowbridge-Reitz Normal Distribution (D)
The industry standard microfacet distribution. Unlike Gaussian or Beckmann models, GGX exhibits extended highlight tails that perfectly match real metals, plastics, and coated surfaces.
D_{\text{GGX}}(\mathbf{h}) = \frac{\alpha^2}{\pi \left( (\mathbf{n} \cdot \mathbf{h})^2 (\alpha^2 - 1) + 1 \right)^2}float NdotH = max(dot(N, H), 0.0); float a2 = alpha * alpha; float denom = (NdotH * NdotH * (a2 - 1.0) + 1.0); float D = a2 / (3.14159265 * denom * denom);
Schlick's Fresnel Approximation (F)
A fast, hyper-accurate polynomial approximation of the complex dielectric Fresnel equations. Explains why water, glass, car paint, and wood gleam brilliantly at grazing view angles.
F_{\text{Schlick}}(\mathbf{v}, \mathbf{h}) = F_0 + (1 - F_0)(1 - (\mathbf{v} \cdot \mathbf{h}))^5vec3 F = F0 + (1.0 - F0) * pow(clamp(1.0 - max(dot(V, H), 0.0), 0.0, 1.0), 5.0);
Smith Height-Correlated Masking & Shadowing (G)
Prevents unrealistically bright specular highlights at grazing angles by mathematically accounting for self-shadowing among microscopic surface peaks.
G_2(\mathbf{l}, \mathbf{v}) = \frac{2(\mathbf{n} \cdot \mathbf{l})(\mathbf{n} \cdot \mathbf{v})}{(\mathbf{n} \cdot \mathbf{v})\sqrt{\alpha^2 + (1-\alpha^2)(\mathbf{n} \cdot \mathbf{l})^2} + (\mathbf{n} \cdot \mathbf{l})\sqrt{\alpha^2 + (1-\alpha^2)(\mathbf{n} \cdot \mathbf{v})^2}}float NdotL = max(dot(N, L), 0.0); float NdotV = max(dot(N, V), 0.0); float ggxV = NdotL * sqrt(NdotV * NdotV * (1.0 - a2) + a2); float ggxL = NdotV * sqrt(NdotL * NdotL * (1.0 - a2) + a2); float G = 0.5 / max(ggxV + ggxL, 0.0001);
Disney Principled BSDF (Burley 2012)
The shader model that unified the 3D industry. Introduced by Brent Burley at Pixar/Disney in 2012 (*Wreck-It Ralph*), it is now the universal standard in Blender, Unreal, Maya, and glTF.
f(\mathbf{l}, \mathbf{v}) = (1 - \text{metallic}) f_{\text{diffuse}} + f_{\text{specular}} + f_{\text{clearcoat}} + f_{\text{sheen}} + f_{\text{glass}}vec3 finalBSDF = mix(diffuseEnergy * baseColor, specularLobe, metallic) + clearcoatLobe;
Subsurface Scattering (BSSRDF & Random Walk)
The optical secret to living, organic materials. Without SSS, human skin looks like dry, chalky painted plastic. Subsurface scattering softens harsh shadow terminators with warm organic glow.
S(\mathbf{x}_i, \vec{\omega}_i, \mathbf{x}_o, \vec{\omega}_o) = \frac{1}{\pi} F_t(\mathbf{x}_i, \vec{\omega}_i) R(\|\mathbf{x}_i - \mathbf{x}_o\|) F_t(\mathbf{x}_o, \vec{\omega}_o)// Random Walk path tracer step in participating volume float stepSize = -log(rand()) / extinctionCoeff; currentPos += rayDir * stepSize;
Volumetric Absorption & Scattering (Beer-Lambert)
Governs light traveling through particulate space. Computes how much light is absorbed by colored glass or scattered into god-rays across atmospheric fog.
I(s) = I_0 \exp\left( -\int_0^s \sigma_t(x) dx \right) + \int_0^s L_s(x) \sigma_s(x) \exp\left( -\int_x^s \sigma_t(t') dt' \right) dxfloat transmittance = exp(-extinction * stepLength); accumulatedLight += inScattering * transmittance * stepLength;
Thin-Film Wave Interference & Iridescence
The mesmerizing spectral shimmer seen on soap bubbles, oil slicks on water, beetle carapaces, and tempered heat-treated titanium.
\Delta \phi = \frac{4\pi d}{\lambda} \sqrt{n_2^2 - n_1^2 \sin^2 \theta} + \delta_r// Spectral phase interference evaluation for RGB wavelengths vec3 phase = (4.0 * 3.14159265 * filmThickness / vec3(650.0, 532.0, 450.0)) * sqrt(n2*n2 - sinTheta*sinTheta); vec3 iridColor = 0.5 + 0.5 * cos(phase);
Oren-Nayar Rough Diffuse Shading
Generalizes Lambertian reflection for porous, powdery surfaces. Explains why the full moon appears as a flat, uniformly illuminated disk rather than a smoothly shaded sphere.
f_{\text{ON}}(\mathbf{l}, \mathbf{v}) = \frac{\rho}{\pi} \left( A + B \max\left(0, \cos(\phi_i - \phi_r)\right) \sin \alpha \tan \beta \right) (\mathbf{n} \cdot \mathbf{l})float A = 1.0 - 0.5 * (sigma2 / (sigma2 + 0.33)); float B = 0.45 * (sigma2 / (sigma2 + 0.09)); float diffuseON = (albedo / 3.14159) * NdotL * (A + B * max(0.0, cosPhi) * sinAlpha * tanBeta);
Perlin & Simplex Procedural Gradient Noise
The mathematical brush of procedural materials. Ken Perlin's gradient noise (1985 Academy Award) allows infinite procedural texture generation with zero image files.
N(\mathbf{x}) = \sum_{i} K(\mathbf{x} - \mathbf{p}_i) \cdot (\mathbf{g}_i \cdot (\mathbf{x} - \mathbf{p}_i)), \quad \text{fBm}(\mathbf{x}) = \sum_{k=0}^{M} \gamma^k N(2^k \mathbf{x})float fbm(vec3 p) {
float v = 0.0; float a = 0.5;
for(int i=0; i<5; i++) { v += a * simplexNoise(p); p *= 2.0; a *= 0.5; }
return v;
}Worley / Voronoi Cellular Distance Noise
Introduced by Steven Worley in 1996. Evaluates distance metrics across 3D cell domains, perfectly generating organic skin pores, reptile scales, dried mud cracks, and foam bubbles.
F_k(\mathbf{x}) = k\text{-th smallest } \|\mathbf{x} - \mathbf{p}_i\| \quad \forall \mathbf{p}_i \in \mathcal{S}_{\text{feature points}}// 3x3x3 cell neighborhood distance query float d1 = minDistanceToFeaturePoint(p); float d2 = secondMinDistanceToFeaturePoint(p); float edge = d2 - d1; // sharp organic cell boundary