{
 "id": "henyey-greenstein-phase-function",
 "title": "Henyey-Greenstein Phase Function",
 "aliases": [
  "HG phase",
  "Cornette-Shanks (variant)"
 ],
 "domain": "volumes",
 "subdomain": "scattering",
 "stage": "volume",
 "realtime": "realtime",
 "platforms": [
  "webgl2",
  "webgpu",
  "desktop-gpu",
  "mobile-gpu",
  "cpu"
 ],
 "year_introduced": 1941,
 "inputs": [
  "volume-density"
 ],
 "outputs": [
  "radiance"
 ],
 "style": "both",
 "dynamic": "both",
 "summary": "A one-parameter model of the angular distribution of scattered light in a medium; the asymmetry g runs from strongly backward (negative) to strongly forward (positive) scattering.",
 "how_it_works": "A phase function gives the probability density of light scattering from one direction into another, and depends only on the cosine of the angle between them. The HG form is (1 - g^2) divided by 4 pi times (1 + g^2 - 2 g cos theta) to the power 1.5. With g = 0 it is isotropic; g near 0.7 to 0.9 gives the strong forward lobe seen on clouds and aerosol haze near the sun; negative g gives backscatter. It integrates to one over the sphere and has an exact importance-sampling inverse, so it is cheap in both ray marchers and path tracers. Real media often need two lobes: a forward and a backward HG lobe blended, which also approximates the silver lining and dark core of clouds. Rayleigh scattering uses its own dipole phase and should not be replaced by HG.",
 "when_to_use": "Choose it whenever you need anisotropic scattering for fog, clouds, atmospheric Mie scattering or skin-like media at the cost of one pow per evaluation.\n\nPrefer the Rayleigh phase inside `rayleigh-mie-single-scattering` for molecular scattering, and use a two-lobe HG mix in `nubis-volumetric-clouds` or `multiple-scattering-octaves` when a single lobe cannot capture both the sun glare and the backscattered brightness. For exact droplet behaviour use tabulated Mie phase functions offline.",
 "cost": {
  "class": "cheap",
  "notes": "A few multiplies and one pow per sample."
 },
 "failure_modes": [
  "Single lobe cannot reproduce the real Mie peak: glory and fogbow are missing",
  "Using g close to 1 gives a very narrow lobe that aliases in ray marching with few samples",
  "Forgetting the 4 pi normalization makes fog energy scale wrongly with g",
  "Applying HG to Rayleigh scattering gives wrong sky polarisation-free brightness and color",
  "Mismatch of sign convention for the angle (view vs light direction) flips forward and backward scattering"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "doi:10.1086/144246",
   "type": "paper",
   "title": "Diffuse radiation in the Galaxy",
   "authors": [
    "L. C. Henyey",
    "J. L. Greenstein"
   ],
   "year": 1941,
   "venue": "The Astrophysical Journal",
   "url": "https://doi.org/10.1086/144246",
   "ids": {
    "doi": "10.1086/144246"
   },
   "license": null,
   "extra": {
    "csl_type": "journal-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1086/144246",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1086/144246",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1086/144246",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1086/144246",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1086/144246",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "henyey1941diffuse"
  },
  {
   "role": "tutorial",
   "key": "url:https://www.pbr-book.org/4ed/Volume_Scattering/Phase_Functions",
   "type": "tutorial",
   "title": "Phase Functions (Physically Based Rendering, 4th ed.)",
   "authors": [
    "Matt Pharr",
    "Wenzel Jakob",
    "Greg Humphreys"
   ],
   "year": null,
   "venue": "pbr-book.org",
   "url": "https://www.pbr-book.org/4ed/Volume_Scattering/Phase_Functions",
   "ids": {},
   "license": null,
   "extra": {
    "http_status": 200,
    "live": true,
    "archive": null,
    "page_title": "Phase Functions",
    "host": "pbr-book.org",
    "title_confirmed_by_page": true,
    "title_unconfirmed": false
   },
   "provenance": {
    "title": {
     "authority": "http",
     "endpoint": "GET https://www.pbr-book.org/4ed/Volume_Scattering/Phase_Functions → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "http",
     "endpoint": "GET https://www.pbr-book.org/4ed/Volume_Scattering/Phase_Functions → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "http",
     "endpoint": "GET https://www.pbr-book.org/4ed/Volume_Scattering/Phase_Functions → 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.95,
   "__bib": "pharrphase"
  }
 ],
 "presets": [
  {
   "id": "henyey-greenstein-phase-function-specimen",
   "title": "Henyey-Greenstein anisotropy g = -0.6, 0, 0.8 on a backlit medium",
   "runtime": "glsl-fragment",
   "params": {
    "SIGMA": 3.5,
    "RAD": 0.72,
    "LIGHT": 14
   },
   "code": "// A uniform-density sphere of scattering medium, lit from behind, single scattering only.\n// Three panels differ ONLY in the Henyey-Greenstein anisotropy g: -0.6 (back), 0 (isotropic), +0.8 (forward).\nconst float SIGMA = 3.5;\nconst float RAD = 0.72;\nconst float LIGHT = 14.0;\n\nfloat hg(float c, float g) { float g2 = g * g; return (1.0 - g2) / (12.566371 * pow(1.0 + g2 - 2.0 * g * c, 1.5)); }\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n  float pw = iResolution.x / 3.0;\n  int panel = int(floor(fragCoord.x / pw));\n  float g = panel == 0 ? -0.6 : (panel == 1 ? 0.0 : 0.8);\n  vec2 uv = (fragCoord - vec2((float(panel) + 0.5) * pw, 0.5 * iResolution.y)) / (0.5 * pw);\n  vec3 col = vec3(0.015, 0.02, 0.03) + 0.02 * (uv.y * 0.5 + 0.5);\n  vec3 ro = vec3(uv, 3.0), rd = vec3(0.0, 0.0, -1.0);\n  vec3 L = normalize(vec3(0.25, 0.15, -1.0));\n  float b = dot(ro, rd); float h = b * b - dot(ro, ro) + RAD * RAD;\n  if (h > 0.0) {\n    float t0 = -b - sqrt(h), t1 = -b + sqrt(h);\n    float ds = (t1 - t0) / 24.0; vec3 acc = vec3(0.0); \n    for (int i = 0; i < 24; i++) {\n      float s = (float(i) + 0.5) * ds; vec3 p = ro + rd * (t0 + s);\n      float bl = dot(p, L); float tl = -bl + sqrt(max(bl * bl - dot(p, p) + RAD * RAD, 0.0));\n      acc += vec3(1.0, 0.95, 0.85) * SIGMA * ds * exp(-SIGMA * s) * exp(-SIGMA * tl) * hg(dot(L, rd), g) * LIGHT;\n    }\n    col += acc;\n  }\n  float edge = fract(fragCoord.x / pw);\n  if (edge < 0.004 || edge > 0.996) col = vec3(0.3);\n  col = 1.0 - exp(-col * 1.5);\n  fragColor = vec4(pow(col, vec3(1.0 / 2.2)), 1.0);\n}\n",
   "basis": "original",
   "license_note": "written for this index",
   "execution_fidelity": "reduced-sandbox",
   "proof": {
    "kind": "rendered",
    "label": "rendered 2026-11-29",
    "ok": true,
    "proof": {
     "ok": true,
     "technique": "henyey-greenstein-phase-function",
     "runtime": "glsl-fragment",
     "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.2729,
      "std": 0.1705,
      "unique_colors": 91
     },
     "image": "/specimens/henyey-greenstein-phase-function-specimen.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "rayleigh-mie-single-scattering",
  "nubis-volumetric-clouds",
  "volume-ray-marching",
  "multiple-scattering-octaves"
 ],
 "extends": [],
 "supersedes": [],
 "combines_with": [
  {
   "id": "volume-ray-marching",
   "why": "Gives the per-sample phase weight applied to in-scattered light."
  },
  {
   "id": "froxel-volumetric-fog",
   "why": "Used when injecting light into each froxel to produce a forward-scattering halo around lights."
  }
 ],
 "provenance": {
  "prose": "original text written for this index (research draft, editorially reviewed)",
  "sources_verified_at": "2026-11-29T15:51:27.588Z",
  "draft": "data/drafts/volumes/henyey-greenstein-phase-function.json"
 },
 "solves": [
  "fog and clouds need forward scattering glow",
  "volume scattering direction needs one tunable parameter",
  "light halo around sun seen through haze",
  "cheap anisotropic scattering for participating media"
 ],
 "authority": "Henyey & Greenstein, 1941",
 "url": "https://texelatlas.vercel.app/t/henyey-greenstein-phase-function/",
 "execution_fidelity": "reduced-sandbox",
 "fidelity_label": "Analytic Sandbox",
 "benchmark_eligible": true,
 "gpu_weight": {
  "weight_x": 3.19,
  "tier": "light",
  "p50_ms": 0.1049,
  "p95_ms": 0.1073,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 40,
  "preset_id": "henyey-greenstein-phase-function-specimen",
  "execution_fidelity": "reduced-sandbox",
  "fidelity_label": "Analytic Sandbox",
  "benchmark_eligible": true,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 3.08,
   "tier": "light",
   "p50_ms": 0.0489,
   "p95_ms": 0.0492,
   "speedup_x": 2.15,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 2.26,
   "tier": "light",
   "p50_ms": 0.0652,
   "p95_ms": 0.0654,
   "speedup_x": 1.61,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}