Strand-based real-time hair (TressFX style)
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.
Also known as TressFX, strand hair, NVIDIA HairWorks style
In the family Materials, BRDFs & texturing, hair and fur
Where it runs
Built inOfficial add-onPluginNone foundNot researched
| Engine | Support | How |
|---|---|---|
| three.js r187 | None found | |
| Babylon.js 9.38.0 | None found | |
| Godot 4.7 | None found | |
| Unity | None found | |
| Unreal 5.7 | Official add-on | Enable Groom plugins; import a Groom Asset and add a Groom Component docs Strand rendering plus Niagara-based hair simulation. |
| Blender 5.2 | Built in | Render Properties > Curves > Shape = Strand or Strip (EEVEE) docs Hair curve rendering; not TressFX-style GPU simulation. |
| WebGPU W3C | None found | |
| Metal | None found |
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 choose it
Reach for it when
- 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
Choose it for hero characters on desktop and console where individual strands matter for silhouette and motion. Prefer Shell and fin fur rendering for short fur and Kajiya-Kay hair shading on cards for crowds or mobile. Use Marschner hair scattering model or Disney / Chiang hair and fur 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 Extended Position-Based Dynamics.
Field marks
- 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
Presets
Strand-Based Real-Time Hair — simulated PBD guide strands (left) vs dense interpolated Marschner ribbons (right)
{
"P_STRAND_DENSITY": 26,
"P_WIND_SWAY": 0.75,
"P_SPEC_SHIFT": 0.22,
"P_SPLIT": 0.48
}Show GLSL (130 lines)
const float P_STRAND_DENSITY = 26.0; // P Render Strands [10.0, 42.0, 2.0]
const float P_WIND_SWAY = 0.75; // P Wind & Sway [0.0, 1.8, 0.05]
const float P_SPEC_SHIFT = 0.22; // P Cuticle Shift [0.05, 0.45, 0.02]
const float P_SPLIT = 0.48; // P Guides / Hair Split [0.0, 1.0, 0.02]
float hash11(float p) {
p = fract(p * 0.1031);
p *= p + 33.33;
return fract(p * (p + p));
}
// Compute strand centerline x(y) and tangent for a cascading hair lock swaying in wind
void evalStrandCurve(float y, float id, float wind, out float cx, out float dxdy, out float zOff) {
float rootX = (id - 0.5) * 0.92;
float lenFactor = clamp(0.46 - y, 0.0, 1.15);
float phase = iTime * 2.1 + id * 6.8;
float wave = sin(phase - lenFactor * 4.2) * 0.085 * wind * lenFactor * lenFactor;
float curl = sin(lenFactor * 7.5 + id * 13.0) * 0.045 * (0.25 + lenFactor);
// Natural cascade curve over crown and shoulder
float drape = 0.12 * sin(lenFactor * 2.6) * sign(rootX + 0.001) * (0.3 + abs(rootX));
cx = rootX * (0.55 + 0.55 * smoothstep(0.46, -0.35, y)) + drape + wave + curl;
// Derivative dx/dy for strand tangent
float eps = 0.015;
float lf2 = clamp(0.46 - (y - eps), 0.0, 1.15);
float cx2 = rootX * (0.55 + 0.55 * smoothstep(0.46, -0.35, y - eps))
+ 0.12 * sin(lf2 * 2.6) * sign(rootX + 0.001) * (0.3 + abs(rootX))
+ sin(phase - lf2 * 4.2) * 0.085 * wind * lf2 * lf2
+ sin(lf2 * 7.5 + id * 13.0) * 0.045 * (0.25 + lf2);
dxdy = (cx - cx2) / eps;
zOff = cos((id - 0.5) * 2.6) * 0.25 + 0.06 * cos(lenFactor * 5.0 + id * 9.0);
}
vec3 aces(vec3 x) {
x = max(x, 0.0);
return (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
float sx = fragCoord.x / max(iResolution.x, 1.0);
float split = clamp(P_SPLIT, 0.0, 1.0);
bool showFullHair = sx >= split;
float wind = clamp(P_WIND_SWAY, 0.0, 2.2);
float shift = clamp(P_SPEC_SHIFT, 0.02, 0.5);
int numStrands = showFullHair ? int(clamp(floor(P_STRAND_DENSITY + 0.5), 8.0, 44.0)) : 7;
// Studio backdrop + mannequin head/shoulder silhouette
vec3 col = mix(vec3(0.05, 0.06, 0.09), vec3(0.13, 0.16, 0.22), smoothstep(-0.5, 0.5, uv.y));
float headD = length((uv - vec2(0.0, 0.14)) * vec2(1.15, 0.92)) - 0.34;
if (headD < 0.0) {
vec2 hxy = (uv - vec2(0.0, 0.14)) / 0.34;
vec3 hn = normalize(vec3(hxy, sqrt(max(1.0 - dot(hxy, hxy), 0.05))));
float nl = max(dot(hn, normalize(vec3(0.55, 0.7, 0.55))), 0.08);
col = vec3(0.18, 0.17, 0.19) * nl + vec3(0.06, 0.08, 0.12);
}
vec3 L = normalize(vec3(0.58 * cos(iTime * 0.35), 0.68, 0.62));
vec3 V = vec3(0.0, 0.0, 1.0);
vec3 H = normalize(L + V);
// Order-independent depth-composited ribbons across simulated hair strands
vec3 hairAcc = vec3(0.0);
float covAcc = 0.0;
float crownMask = smoothstep(0.48, 0.36, uv.y) * smoothstep(-0.52, -0.36, uv.y);
for (int i = 0; i < 44; i++) {
if (i >= numStrands) break;
float fi = (float(i) + 0.5) / float(numStrands);
float rnd = hash11(float(i) * 19.37 + 1.7);
float cx, dxdy, zOff;
evalStrandCurve(uv.y, fi, wind, cx, dxdy, zOff);
float strandEnd = -0.46 + 0.14 * rnd;
float tipFade = smoothstep(strandEnd, strandEnd + 0.10, uv.y);
float width = showFullHair ? (0.022 + 0.012 * rnd) : 0.014;
float dist = abs(uv.x - cx);
if (dist < width * 2.2 && tipFade > 0.01 && crownMask > 0.01) {
float alpha = smoothstep(width * 1.15, width * 0.25, dist) * tipFade * crownMask;
// Compute 3D ribbon tangent T and cross-strand normal N
vec3 T = normalize(vec3(dxdy, 1.0, 0.18 * sin(uv.y * 5.0 + rnd * 6.0)));
float across = clamp((uv.x - cx) / max(width, 1e-4), -1.0, 1.0);
vec3 N = normalize(vec3(across * 0.85, -dxdy * across * 0.4, sqrt(max(1.0 - across * across * 0.72, 0.1))));
vec3 strandCol;
if (!showFullHair) {
// Left: Distinct PBD guide strand visualization with animated particle beads along each guide
vec3 guideHue = 0.55 + 0.45 * cos(6.28318 * (fi + vec3(0.0, 0.33, 0.67)));
float bead = smoothstep(0.014, 0.005, abs(fract(uv.y * 9.0) - 0.5) * 0.11);
strandCol = mix(guideHue * 0.9, vec3(1.0, 0.98, 0.9), bead * 0.8);
} else {
// Right: Marschner / Kajiya-Kay dual-lobe specular (primary R white lobe + secondary TRT warm amber lobe)
vec3 baseHair = mix(vec3(0.18, 0.08, 0.04), vec3(0.36, 0.16, 0.07), rnd);
// Primary cuticle-shifted tangent T1 (white reflection)
vec3 T1 = normalize(T + N * shift);
float th1 = dot(T1, H);
float sinTH1 = sqrt(max(1.0 - th1 * th1, 0.0));
float specR = pow(sinTH1, 56.0) * 1.25;
// Secondary shifted tangent T2 (colored internal TRT reflection)
vec3 T2 = normalize(T - N * (shift * 1.65));
float th2 = dot(T2, H);
float sinTH2 = sqrt(max(1.0 - th2 * th2, 0.0));
float specTRT = pow(sinTH2, 18.0) * 0.75;
// Longitudinal diffuse + self-shadowing across hair volume depth
float sinTL = sqrt(max(1.0 - dot(T, L) * dot(T, L), 0.0));
float selfShadow = 0.38 + 0.62 * smoothstep(-0.25, 0.30, zOff);
float microFibers = 0.85 + 0.15 * sin(across * 18.0 + rnd * 20.0);
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;
}
// Depth-biased soft OIT blend
float w = alpha * (0.45 + 0.85 * smoothstep(-0.3, 0.35, zOff));
hairAcc += strandCol * w;
covAcc += w;
}
}
if (covAcc > 0.001) {
vec3 finalHair = hairAcc / max(covAcc, 1e-4);
col = mix(col, finalHair, clamp(covAcc, 0.0, 1.0));
}
float sep = smoothstep(0.0035, 0.0008, abs(sx - split));
col = mix(col, vec3(0.95, 0.97, 1.0), sep);
fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);
}Attribution: MIT — written for this index.
Measured GPU weight & timing
| Preset | GPU | Weight / p50 / p95 | Method |
|---|---|---|---|
| strand-based-real-time-hair-live | Tesla T4 1920x1080 | 32.3× baseline (heavy) · 1.06 ms / 1.07 ms | opengl-timer-query · 32 frames · GPU Weight Atlas · Colab T4 sweep |
| strand-based-real-time-hair-live | NVIDIA L4 1920x1080 | 28.0× baseline (heavy) · 0.446 ms / 0.454 ms · 2.4× faster on L4 | opengl-timer-query · Cross-architecture validation |
| strand-based-real-time-hair-live | NVIDIA A100-SXM4-40GB 1920x1080 | 23.0× baseline (heavy) · 0.663 ms / 0.666 ms · 1.6× faster on A100 | opengl-timer-query · Cross-architecture validation |
Crosses
- Extended Position-Based Dynamics: Guide strands use distance and shape constraints solved position-based each frame.
- Temporal Anti-Aliasing: Resolves the sub-pixel strand coverage that single-frame antialiasing cannot.
Sources
- primaryGPUOpen-Effects (2016). GPUOpen-Effects/TressFX. DirectX 12 and Vulkan libraries that provide convenient access to realistically rendered and simulated hair and furGitHub API · license MIT · 2026-11-29
- secondaryCem Yuksel, Sarah Tariq. Advanced techniques in real-time hair rendering and simulation. cemyuksel.com.Verified via live page · 2026-11-29