{
 "id": "ggx-trowbridge-reitz",
 "title": "GGX / Trowbridge-Reitz normal distribution",
 "aliases": [],
 "domain": "materials",
 "subdomain": "microfacet BRDF",
 "stage": "material",
 "realtime": "realtime",
 "platforms": [
  "webgl2",
  "webgpu",
  "desktop-gpu",
  "mobile-gpu",
  "unity",
  "unreal",
  "godot",
  "blender"
 ],
 "year_introduced": 2007,
 "inputs": [
  "material-params",
  "normals"
 ],
 "outputs": [
  "radiance"
 ],
 "style": "photoreal",
 "dynamic": "both",
 "summary": "The microfacet normal distribution with a long, heavy tail, popularised for graphics by Walter et al. Its soft halo around the highlight matches measured materials well and it has closed-form visible-normal sampling, so it is the default D term in PBR.",
 "how_it_works": "GGX describes the density of microfacet normals with an ellipsoid-derived function: D(h) = a^2 / (pi * ((n.h)^2 (a^2 - 1) + 1)^2), where a = roughness^2 in the common remapping. Compared with Beckmann it falls off polynomially rather than exponentially, giving the characteristic bright core with a faint wide glow. Walter et al. introduced it to graphics (it is the Trowbridge-Reitz distribution from 1975 optics) in the context of rough refraction, and showed how to importance-sample it. In a renderer it appears as the D factor of a Cook-Torrance BRDF; pair it with the height-correlated Smith G for consistency. The anisotropic form replaces a with two axis-aligned roughnesses ax, ay.",
 "when_to_use": "Choose it as the D term of any real-time or offline microfacet specular lobe; it is the de facto standard in glTF, Unreal, Filament and OpenPBR. Prefer plain Beckmann only to match legacy assets. For fabric or velvet, where highlights brighten at grazing angles, prefer `charlie-sheen`. For stretched highlights use `anisotropic-ggx`.",
 "cost": {
  "class": "cheap",
  "notes": "One division and a few multiplies per light; the cost is dominated by the surrounding lighting, not D."
 },
 "failure_modes": [
  "Very low roughness makes D numerically explode near the peak, so clamp roughness (about 0.03-0.045) or you get fireflies and aliased pinpoint highlights",
  "Long tail can overpower thin dielectric looks, creating a milky halo on glossy plastics",
  "Without specular antialiasing (toksvig-mipmapping, normal-distribution-filtering) normal-mapped surfaces shimmer",
  "Single-scattering GGX darkens rough metals; compensate with kulla-conty-multiscatter"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "doi:10.2312/egwr/egsr07/195-206",
   "type": "paper",
   "title": "Microfacet Models for Refraction through Rough Surfaces",
   "authors": [
    "Bruce Walter",
    "Stephen R. Marschner",
    "Hongsong Li",
    "Kenneth E. Torrance"
   ],
   "year": 2007,
   "venue": "Rendering Techniques",
   "url": "https://doi.org/10.2312/egwr/egsr07/195-206",
   "ids": {
    "doi": "10.2312/egwr/egsr07/195-206"
   },
   "license": null,
   "extra": {
    "csl_type": "article"
   },
   "provenance": {
    "title": {
     "authority": "doi.org",
     "endpoint": "https://doi.org/10.2312/egwr/egsr07/195-206 (CSL-JSON)",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "doi.org",
     "endpoint": "https://doi.org/10.2312/egwr/egsr07/195-206 (CSL-JSON)",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "doi.org",
     "endpoint": "https://doi.org/10.2312/egwr/egsr07/195-206 (CSL-JSON)",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "doi.org",
     "endpoint": "https://doi.org/10.2312/egwr/egsr07/195-206 (CSL-JSON)",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "doi.org",
     "endpoint": "https://doi.org/10.2312/egwr/egsr07/195-206 (CSL-JSON)",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "walter2007microfacet"
  },
  {
   "role": "implementation",
   "key": "gh:mrdoob/three.js",
   "type": "code",
   "title": "mrdoob/three.js",
   "description": "JavaScript 3D Library.",
   "authors": [
    "mrdoob"
   ],
   "year": 2010,
   "venue": "GitHub",
   "url": "https://github.com/mrdoob/three.js",
   "ids": {
    "repo": "mrdoob/three.js"
   },
   "license": "MIT",
   "extra": {
    "stars": 119718,
    "stars_checked": "2026-11-29",
    "archived": false,
    "fork": false,
    "pushed_at": "2026-11-29T11:39:51Z",
    "language": "JavaScript",
    "homepage": "https://threejs.org/",
    "license_name": "MIT License"
   },
   "provenance": {
    "title": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/mrdoob/three.js",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/mrdoob/three.js",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/mrdoob/three.js",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/mrdoob/three.js",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/mrdoob/three.js",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "license": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/mrdoob/three.js",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": null,
   "__bib": "mrdoob2010mrdoob"
  },
  {
   "role": "dataset",
   "key": "url:https://physicallybased.info/",
   "type": "dataset",
   "title": "physicallybased.info",
   "authors": [
    "Anton Palmqvist"
   ],
   "year": null,
   "venue": "physicallybased.info",
   "url": "https://physicallybased.info/",
   "ids": {},
   "license": null,
   "extra": {
    "http_status": 200,
    "live": true,
    "archive": {
     "url": "http://web.archive.org/web/20261126071531/https://physicallybased.info/",
     "timestamp": "20261126071531"
    },
    "page_title": "Physically Based - The PBR values database",
    "host": "physicallybased.info",
    "title_confirmed_by_page": false,
    "title_unconfirmed": true
   },
   "provenance": {
    "title": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "http",
     "endpoint": "GET https://physicallybased.info/ → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "http",
     "endpoint": "GET https://physicallybased.info/ → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "http",
     "endpoint": "GET https://physicallybased.info/ → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 0,
   "__bib": "palmqvistphysicallybased"
  }
 ],
 "presets": [
  {
   "id": "ggx-aluminium",
   "title": "Aluminium, roughness 0.35",
   "runtime": "three-material",
   "params": {
    "color": "#f5f6f6",
    "roughness": 0.35,
    "metalness": 1
   },
   "basis": 2,
   "license_note": "written for this index; colour, IOR and metalness from physicallybased.info (CC0), roughness chosen here",
   "execution_fidelity": "faithful-pass",
   "proof": {
    "kind": "rendered",
    "label": "rendered 2026-11-29",
    "ok": true,
    "proof": {
     "ok": true,
     "technique": "ggx-trowbridge-reitz",
     "runtime": "three-material",
     "checked_at": "2026-11-29T15:51:50.471Z",
     "renderer": "Chromium 145.0.7632.6 headless, WebGL2 via ANGLE/SwiftShader, 512×512, iTime=1.5",
     "stats": {
      "mean": 0.6898,
      "std": 0.0931,
      "unique_colors": 43
     },
     "image": "/specimens/ggx-aluminium.webp",
     "reason": null
    }
   }
  },
  {
   "id": "ggx-gold-polished",
   "title": "Polished gold",
   "runtime": "three-material",
   "params": {
    "color": "#ffe496",
    "roughness": 0.12,
    "metalness": 1
   },
   "basis": 2,
   "license_note": "written for this index; colour, IOR and metalness from physicallybased.info (CC0), roughness chosen here",
   "execution_fidelity": "faithful-pass",
   "proof": {
    "kind": "rendered",
    "label": "rendered 2026-11-29",
    "ok": true,
    "proof": {
     "ok": true,
     "technique": "ggx-trowbridge-reitz",
     "runtime": "three-material",
     "checked_at": "2026-11-29T15:51:50.471Z",
     "renderer": "Chromium 145.0.7632.6 headless, WebGL2 via ANGLE/SwiftShader, 512×512, iTime=1.5",
     "stats": {
      "mean": 0.6384,
      "std": 0.1033,
      "unique_colors": 180
     },
     "image": "/specimens/ggx-gold-polished.webp",
     "reason": null
    }
   }
  },
  {
   "id": "ggx-trowbridge-reitz-wgsl",
   "title": "GGX / Trowbridge-Reitz microfacet BRDF (WGSL)",
   "runtime": "webgpu-wgsl",
   "basis": "original",
   "license_note": "written for this index",
   "params": {
    "ROUGHNESS": 0.28,
    "METALNESS": 0.85,
    "IOR": 1.5
   },
   "code": "// WebGPU WGSL fragment specimen: GGX NDF + Smith G2 + Schlick Fresnel\nconst ROUGHNESS: f32 = 0.2800; // P\nconst METALNESS: f32 = 0.8500; // P\nconst IOR: f32 = 1.5000; // P\n\nfn d_ggx(nh: f32, a: f32) -> f32 {\n  let a2 = a * a;\n  let d = nh * nh * (a2 - 1.0) + 1.0;\n  return a2 / (3.1415926 * d * d + 1e-5);\n}\n\nfn f_schlick(uVal: f32, f0: vec3f) -> vec3f {\n  return f0 + (vec3f(1.0) - f0) * pow(clamp(1.0 - uVal, 0.0, 1.0), 5.0);\n}\n\nfn studio_env(d: vec3f) -> vec3f {\n  let y = clamp(d.y * 0.5 + 0.5, 0.0, 1.0);\n  let key = smoothstep(0.82, 0.96, dot(d, normalize(vec3f(0.55, 0.72, 0.42)))) * 2.6;\n  let rim = smoothstep(0.80, 0.95, dot(d, normalize(vec3f(-0.72, 0.40, 0.56)))) * 1.4;\n  return mix(vec3f(0.18, 0.19, 0.21), vec3f(0.82, 0.84, 0.86), pow(y, 1.2)) + vec3f(key + rim * 0.85);\n}\n\n@fragment\nfn fs_main(@builtin(position) pos: vec4f) -> @location(0) vec4f {\n  let uv = (pos.xy - 0.5 * u.resolution) / u.resolution.y;\n  let ro = vec3f(0.0, 0.12, 2.6);\n  let rd = normalize(vec3f(uv.x, -uv.y, -1.45));\n  let b = dot(ro, rd);\n  let c = dot(ro, ro) - 0.62;\n  let h = b * b - c;\n  if (h < 0.0) {\n    let bg = mix(vec3f(0.86, 0.87, 0.85), vec3f(0.75, 0.76, 0.78), clamp(-uv.y + 0.5, 0.0, 1.0));\n    return vec4f(pow(bg, vec3f(1.0 / 2.2)), 1.0);\n  }\n  let p = ro + rd * (-b - sqrt(h));\n  let n = normalize(p);\n  let v = -rd;\n  let l = normalize(vec3f(cos(u.time * 0.4) * 0.75, 0.72, 0.62));\n  let hv = normalize(l + v);\n  let nl = max(dot(n, l), 0.0);\n  let nv = max(dot(n, v), 0.001);\n  let nh = max(dot(n, hv), 0.0);\n  let vh = max(dot(v, hv), 0.0);\n  let base = vec3f(0.88, 0.71, 0.46);\n  let f0s = pow((IOR - 1.0) / (IOR + 1.0), 2.0);\n  let f0 = mix(vec3f(f0s), base, METALNESS);\n  let a = max(0.04, ROUGHNESS * ROUGHNESS);\n  let F = f_schlick(vh, f0);\n  let D = d_ggx(nh, a);\n  let G = 1.0 / (4.0 * max(nl * nv, 0.05));\n  let spec = D * F * G * nl * 2.5;\n  let diff = (vec3f(1.0) - F) * (1.0 - METALNESS) * base / 3.1415926 * nl * 2.2;\n  let ibl = studio_env(reflect(-v, n)) * f_schlick(nv, f0) * mix(1.0, 0.25, ROUGHNESS) + studio_env(n) * (1.0 - METALNESS) * base * 0.35;\n  let col = diff + spec + ibl;\n  let mapped = (col * (2.51 * col + 0.03)) / (col * (2.43 * col + 0.59) + 0.14);\n  return vec4f(pow(clamp(mapped, vec3f(0.0), vec3f(1.0)), vec3f(1.0 / 2.2)), 1.0);\n}",
   "execution_fidelity": "faithful-pass",
   "proof": {
    "kind": "wgsl",
    "label": "WebGPU WGSL runtime",
    "ok": true,
    "proof": null
   }
  }
 ],
 "related": [
  "cook-torrance-brdf",
  "smith-masking-shadowing",
  "anisotropic-ggx",
  "vndf-sampling",
  "kulla-conty-multiscatter"
 ],
 "extends": [
  "cook-torrance-brdf"
 ],
 "supersedes": [],
 "combines_with": [],
 "provenance": {
  "prose": "original text written for this index (research draft, editorially reviewed)",
  "sources_verified_at": "2026-11-29T15:51:27.588Z",
  "draft": "data/drafts/materials/ggx-trowbridge-reitz.json"
 },
 "solves": [
  "highlights look plasticky with no long tail",
  "need a physically based specular lobe for metals",
  "specular falloff too sharp compared to real materials",
  "match reflections of rough surfaces seen in photographs"
 ],
 "authority": "Walter et al., 2007",
 "url": "https://texelatlas.vercel.app/t/ggx-trowbridge-reitz/",
 "execution_fidelity": "faithful-pass",
 "fidelity_label": "Faithful Pass",
 "benchmark_eligible": true,
 "gpu_weight": {
  "weight_x": 1.91,
  "tier": "feather",
  "p50_ms": 0.0627,
  "p95_ms": 0.0654,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 40,
  "preset_id": "ggx-aluminium",
  "execution_fidelity": "faithful-pass",
  "fidelity_label": "Faithful Pass",
  "benchmark_eligible": true,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 1.77,
   "tier": "feather",
   "p50_ms": 0.0282,
   "p95_ms": 0.0295,
   "speedup_x": 2.22,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 1.25,
   "tier": "feather",
   "p50_ms": 0.0361,
   "p95_ms": 0.0362,
   "speedup_x": 1.74,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}