{
 "id": "strand-based-real-time-hair",
 "title": "Strand-based real-time hair (TressFX style)",
 "aliases": [
  "TressFX",
  "strand hair",
  "NVIDIA HairWorks style"
 ],
 "domain": "materials",
 "subdomain": "hair and fur",
 "stage": "material",
 "realtime": "realtime",
 "platforms": [
  "desktop-gpu",
  "unreal",
  "unity",
  "webgpu"
 ],
 "year_introduced": 2012,
 "inputs": [
  "curves",
  "skeleton",
  "material-params"
 ],
 "outputs": [
  "radiance"
 ],
 "style": "photoreal",
 "dynamic": "dynamic",
 "summary": "Renders and simulates tens of thousands of individual hair strands on the GPU: guide strands run a position-based simulation, are interpolated into many render strands, expanded to camera-facing ribbons, then shaded and blended with an order-independent technique.",
 "how_it_works": "Authoring supplies guide hairs as polylines. A compute pass simulates them with a few constraints (length, local shape against the head's rest pose, global shape, wind) integrated by Verlet-style steps, and collides them with proxy capsules. A second pass interpolates guides to many follower strands and applies clumping and tessellation. Rendering expands each segment into a thin camera-facing quad (or tube), often one or two pixels wide, and shades it with a strand tangent lobe such as Kajiya-Kay or a Marschner approximation. Transparency is the hard part: TressFX stores per-pixel linked lists of fragments and sorts and blends them, while others use alpha-to-coverage or a k-buffer. Self-shadowing is approximated with deep shadow-like opacity maps or a density volume. Antialiasing relies on coverage-based thin-line handling plus temporal methods.",
 "when_to_use": "Choose it for hero characters on desktop and console where individual strands matter for silhouette and motion. Prefer `shell-fur-rendering` for short fur and `kajiya-kay-hair-shading` on cards for crowds or mobile. Use `marschner-hair-scattering` or `disney-hair-bsdf` for the shading model instead of Kajiya-Kay if path-traced fidelity is the goal. The simulation part uses ideas from `position-based-dynamics` and `xpbd`.",
 "cost": {
  "class": "heavy",
  "notes": "Hair is one of the costliest character features; cost scales with strand count, transparency method and shadows."
 },
 "failure_modes": [
  "Per-pixel linked-list transparency overflows its memory budget in dense close-ups",
  "Strands collide poorly with shoulders and clothing when only head proxies exist",
  "Aliasing and shimmering of one-pixel strands needs temporal accumulation, causing ghosting",
  "Strand count LOD pops without careful width compensation",
  "Self-shadowing is approximate, so hair looks flat or overly bright without it",
  "Stiff constraints under low frame rate or large time steps make hair explode or jitter"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "gh:gpuopen-effects/tressfx",
   "type": "code",
   "title": "GPUOpen-Effects/TressFX",
   "description": "DirectX 12 and Vulkan libraries that provide convenient access to realistically rendered and simulated hair and fur",
   "authors": [
    "GPUOpen-Effects"
   ],
   "year": 2016,
   "venue": "GitHub",
   "url": "https://github.com/GPUOpen-Effects/TressFX",
   "ids": {
    "repo": "GPUOpen-Effects/TressFX"
   },
   "license": "MIT",
   "extra": {
    "stars": 850,
    "stars_checked": "2026-11-29",
    "archived": false,
    "fork": false,
    "pushed_at": "2023-01-26T15:41:27Z",
    "language": "C++",
    "homepage": null,
    "license_name": "MIT License"
   },
   "provenance": {
    "title": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/GPUOpen-Effects/TressFX",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/GPUOpen-Effects/TressFX",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/GPUOpen-Effects/TressFX",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/GPUOpen-Effects/TressFX",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/GPUOpen-Effects/TressFX",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "license": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/GPUOpen-Effects/TressFX",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": null,
   "__bib": "gpuopeneffects2016gpuopen"
  },
  {
   "role": "secondary",
   "key": "url:https://www.cemyuksel.com/courses/conferences/siggraph2010-hair",
   "type": "web",
   "title": "Advanced techniques in real-time hair rendering and simulation",
   "authors": [
    "Cem Yuksel",
    "Sarah Tariq"
   ],
   "year": null,
   "venue": "cemyuksel.com",
   "url": "https://www.cemyuksel.com/courses/conferences/siggraph2010-hair",
   "ids": {},
   "license": null,
   "extra": {
    "http_status": 200,
    "live": true,
    "archive": {
     "url": "http://web.archive.org/web/20261024164407/http://www.cemyuksel.com/courses/conferences/siggraph2010-hair/",
     "timestamp": "20261024164407"
    },
    "page_title": "SIGGRAPH 2010 Course Notes - Advanced Techniques in Real-time Hair Rendering and Simulation - Cem Yuksel",
    "host": "cemyuksel.com",
    "title_confirmed_by_page": true,
    "title_unconfirmed": false
   },
   "provenance": {
    "title": {
     "authority": "http",
     "endpoint": "GET https://www.cemyuksel.com/courses/conferences/siggraph2010-hair → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "http",
     "endpoint": "GET https://www.cemyuksel.com/courses/conferences/siggraph2010-hair → 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.cemyuksel.com/courses/conferences/siggraph2010-hair → 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": "yukseladvanced"
  }
 ],
 "presets": [
  {
   "id": "strand-based-real-time-hair-live",
   "title": "Strand-Based Real-Time Hair — simulated PBD guide strands (left) vs dense interpolated Marschner ribbons (right)",
   "runtime": "glsl-fragment",
   "params": {
    "P_STRAND_DENSITY": 26,
    "P_WIND_SWAY": 0.75,
    "P_SPEC_SHIFT": 0.22,
    "P_SPLIT": 0.48
   },
   "basis": "original",
   "license_note": "MIT — written for this index.",
   "code": "const float P_STRAND_DENSITY = 26.0; // P Render Strands [10.0, 42.0, 2.0]\nconst float P_WIND_SWAY = 0.75; // P Wind & Sway [0.0, 1.8, 0.05]\nconst float P_SPEC_SHIFT = 0.22; // P Cuticle Shift [0.05, 0.45, 0.02]\nconst float P_SPLIT = 0.48; // P Guides / Hair Split [0.0, 1.0, 0.02]\n\nfloat hash11(float p) {\n  p = fract(p * 0.1031);\n  p *= p + 33.33;\n  return fract(p * (p + p));\n}\n\n// Compute strand centerline x(y) and tangent for a cascading hair lock swaying in wind\nvoid evalStrandCurve(float y, float id, float wind, out float cx, out float dxdy, out float zOff) {\n  float rootX = (id - 0.5) * 0.92;\n  float lenFactor = clamp(0.46 - y, 0.0, 1.15);\n  float phase = iTime * 2.1 + id * 6.8;\n  float wave = sin(phase - lenFactor * 4.2) * 0.085 * wind * lenFactor * lenFactor;\n  float curl = sin(lenFactor * 7.5 + id * 13.0) * 0.045 * (0.25 + lenFactor);\n  // Natural cascade curve over crown and shoulder\n  float drape = 0.12 * sin(lenFactor * 2.6) * sign(rootX + 0.001) * (0.3 + abs(rootX));\n  cx = rootX * (0.55 + 0.55 * smoothstep(0.46, -0.35, y)) + drape + wave + curl;\n\n  // Derivative dx/dy for strand tangent\n  float eps = 0.015;\n  float lf2 = clamp(0.46 - (y - eps), 0.0, 1.15);\n  float cx2 = rootX * (0.55 + 0.55 * smoothstep(0.46, -0.35, y - eps))\n            + 0.12 * sin(lf2 * 2.6) * sign(rootX + 0.001) * (0.3 + abs(rootX))\n            + sin(phase - lf2 * 4.2) * 0.085 * wind * lf2 * lf2\n            + sin(lf2 * 7.5 + id * 13.0) * 0.045 * (0.25 + lf2);\n  dxdy = (cx - cx2) / eps;\n  zOff = cos((id - 0.5) * 2.6) * 0.25 + 0.06 * cos(lenFactor * 5.0 + id * 9.0);\n}\n\nvec3 aces(vec3 x) {\n  x = max(x, 0.0);\n  return (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);\n}\n\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n  vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;\n  float sx = fragCoord.x / max(iResolution.x, 1.0);\n  float split = clamp(P_SPLIT, 0.0, 1.0);\n  bool showFullHair = sx >= split;\n\n  float wind = clamp(P_WIND_SWAY, 0.0, 2.2);\n  float shift = clamp(P_SPEC_SHIFT, 0.02, 0.5);\n  int numStrands = showFullHair ? int(clamp(floor(P_STRAND_DENSITY + 0.5), 8.0, 44.0)) : 7;\n\n  // Studio backdrop + mannequin head/shoulder silhouette\n  vec3 col = mix(vec3(0.05, 0.06, 0.09), vec3(0.13, 0.16, 0.22), smoothstep(-0.5, 0.5, uv.y));\n  float headD = length((uv - vec2(0.0, 0.14)) * vec2(1.15, 0.92)) - 0.34;\n  if (headD < 0.0) {\n    vec2 hxy = (uv - vec2(0.0, 0.14)) / 0.34;\n    vec3 hn = normalize(vec3(hxy, sqrt(max(1.0 - dot(hxy, hxy), 0.05))));\n    float nl = max(dot(hn, normalize(vec3(0.55, 0.7, 0.55))), 0.08);\n    col = vec3(0.18, 0.17, 0.19) * nl + vec3(0.06, 0.08, 0.12);\n  }\n\n  vec3 L = normalize(vec3(0.58 * cos(iTime * 0.35), 0.68, 0.62));\n  vec3 V = vec3(0.0, 0.0, 1.0);\n  vec3 H = normalize(L + V);\n\n  // Order-independent depth-composited ribbons across simulated hair strands\n  vec3 hairAcc = vec3(0.0);\n  float covAcc = 0.0;\n  float crownMask = smoothstep(0.48, 0.36, uv.y) * smoothstep(-0.52, -0.36, uv.y);\n\n  for (int i = 0; i < 44; i++) {\n    if (i >= numStrands) break;\n    float fi = (float(i) + 0.5) / float(numStrands);\n    float rnd = hash11(float(i) * 19.37 + 1.7);\n    float cx, dxdy, zOff;\n    evalStrandCurve(uv.y, fi, wind, cx, dxdy, zOff);\n\n    float strandEnd = -0.46 + 0.14 * rnd;\n    float tipFade = smoothstep(strandEnd, strandEnd + 0.10, uv.y);\n    float width = showFullHair ? (0.022 + 0.012 * rnd) : 0.014;\n    float dist = abs(uv.x - cx);\n\n    if (dist < width * 2.2 && tipFade > 0.01 && crownMask > 0.01) {\n      float alpha = smoothstep(width * 1.15, width * 0.25, dist) * tipFade * crownMask;\n      // Compute 3D ribbon tangent T and cross-strand normal N\n      vec3 T = normalize(vec3(dxdy, 1.0, 0.18 * sin(uv.y * 5.0 + rnd * 6.0)));\n      float across = clamp((uv.x - cx) / max(width, 1e-4), -1.0, 1.0);\n      vec3 N = normalize(vec3(across * 0.85, -dxdy * across * 0.4, sqrt(max(1.0 - across * across * 0.72, 0.1))));\n\n      vec3 strandCol;\n      if (!showFullHair) {\n        // Left: Distinct PBD guide strand visualization with animated particle beads along each guide\n        vec3 guideHue = 0.55 + 0.45 * cos(6.28318 * (fi + vec3(0.0, 0.33, 0.67)));\n        float bead = smoothstep(0.014, 0.005, abs(fract(uv.y * 9.0) - 0.5) * 0.11);\n        strandCol = mix(guideHue * 0.9, vec3(1.0, 0.98, 0.9), bead * 0.8);\n      } else {\n        // Right: Marschner / Kajiya-Kay dual-lobe specular (primary R white lobe + secondary TRT warm amber lobe)\n        vec3 baseHair = mix(vec3(0.18, 0.08, 0.04), vec3(0.36, 0.16, 0.07), rnd);\n        // Primary cuticle-shifted tangent T1 (white reflection)\n        vec3 T1 = normalize(T + N * shift);\n        float th1 = dot(T1, H);\n        float sinTH1 = sqrt(max(1.0 - th1 * th1, 0.0));\n        float specR = pow(sinTH1, 56.0) * 1.25;\n\n        // Secondary shifted tangent T2 (colored internal TRT reflection)\n        vec3 T2 = normalize(T - N * (shift * 1.65));\n        float th2 = dot(T2, H);\n        float sinTH2 = sqrt(max(1.0 - th2 * th2, 0.0));\n        float specTRT = pow(sinTH2, 18.0) * 0.75;\n\n        // Longitudinal diffuse + self-shadowing across hair volume depth\n        float sinTL = sqrt(max(1.0 - dot(T, L) * dot(T, L), 0.0));\n        float selfShadow = 0.38 + 0.62 * smoothstep(-0.25, 0.30, zOff);\n        float microFibers = 0.85 + 0.15 * sin(across * 18.0 + rnd * 20.0);\n        strandCol = (baseHair * (0.32 + 0.85 * sinTL) + vec3(1.0, 0.96, 0.90) * specR + vec3(0.95, 0.48, 0.18) * specTRT) * selfShadow * microFibers;\n      }\n\n      // Depth-biased soft OIT blend\n      float w = alpha * (0.45 + 0.85 * smoothstep(-0.3, 0.35, zOff));\n      hairAcc += strandCol * w;\n      covAcc += w;\n    }\n  }\n\n  if (covAcc > 0.001) {\n    vec3 finalHair = hairAcc / max(covAcc, 1e-4);\n    col = mix(col, finalHair, clamp(covAcc, 0.0, 1.0));\n  }\n\n  float sep = smoothstep(0.0035, 0.0008, abs(sx - split));\n  col = mix(col, vec3(0.95, 0.97, 1.0), sep);\n  fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);\n}",
   "execution_fidelity": "conceptual-diagram",
   "proof": {
    "kind": "rendered",
    "label": "rendered 2026-11-30",
    "ok": true,
    "proof": {
     "ok": true,
     "technique": "strand-based-real-time-hair",
     "runtime": "glsl-fragment",
     "checked_at": "2026-11-30T21:07:26.000Z",
     "renderer": "Headless EGL Tesla T4/PCIe/SSE2, OpenGL 3.30 Core, 512×512, iTime=1.5",
     "stats": {
      "mean": 0.5291,
      "std": 0.1745,
      "min": 0.2744,
      "max": 0.9014
     },
     "image": "/specimens/strand-based-real-time-hair-live.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "kajiya-kay-hair-shading",
  "marschner-hair-scattering",
  "shell-fur-rendering",
  "position-based-dynamics",
  "xpbd",
  "temporal-anti-aliasing"
 ],
 "extends": [],
 "supersedes": [],
 "combines_with": [
  {
   "id": "xpbd",
   "why": "Guide strands use distance and shape constraints solved position-based each frame."
  },
  {
   "id": "temporal-anti-aliasing",
   "why": "Resolves the sub-pixel strand coverage that single-frame antialiasing cannot."
  }
 ],
 "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/strand-based-real-time-hair.json"
 },
 "solves": [
  "want individual simulated hair strands in real time",
  "hero character hair with proper silhouette and motion",
  "hair transparency sorting is expensive",
  "hair strands alias and shimmer in motion",
  "need gpu hair simulation with collisions"
 ],
 "authority": "GPUOpen-Effects, 2016",
 "url": "https://texelatlas.vercel.app/t/strand-based-real-time-hair/",
 "execution_fidelity": "conceptual-diagram",
 "fidelity_label": "Visual Diagram",
 "benchmark_eligible": false,
 "gpu_weight": {
  "weight_x": 32.25,
  "tier": "heavy",
  "p50_ms": 1.0609,
  "p95_ms": 1.0723,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 32,
  "preset_id": "strand-based-real-time-hair-live",
  "execution_fidelity": "conceptual-diagram",
  "fidelity_label": "Visual Diagram",
  "benchmark_eligible": false,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 28.02,
   "tier": "heavy",
   "p50_ms": 0.4455,
   "p95_ms": 0.4539,
   "speedup_x": 2.38,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 23.03,
   "tier": "heavy",
   "p50_ms": 0.6632,
   "p95_ms": 0.6656,
   "speedup_x": 1.6,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}