Marschner hair scattering model
A physically motivated hair fibre model splitting scattering into surface reflection R, transmission TT and internal reflection TRT, each with its own longitudinal and azimuthal term. It explains hair's two highlights and coloured glow.
Also known as Marschner hair BSDF, R TT TRT hair model
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 | Built in | HDRP Hair Shader Graph > Material Type = Physically Based docs HDRP Hair shader. |
| Unreal 5.7 | Built in | Material > Shading Model = Hair (dual-highlight strand scattering used with Groom Hair) docs |
| Blender 5.2 | Built in | Shader node: Principled Hair BSDF (Chiang model) docs Chiang model extends Marschner; no separate pure-Marschner option. |
| WebGPU W3C | None found | |
| Metal | None found |
How it works
Hair is modelled as a smooth dielectric cylinder with a tilted cuticle and an absorbing interior. The scattering function factorises per lobe p into a longitudinal term M_p(theta) and an azimuthal term N_p(phi). R is a mirror-like bounce off the cuticle and stays white. TT is light refracting in and out of the fibre; TRT adds one internal reflection and exits on the same side as the viewer, picking up the colour of the pigment through the absorption coefficient. Longitudinal terms are Gaussians centred at shifts of 2 alpha, -alpha and -4 alpha for the cuticle tilt alpha, with different widths per lobe, which is why the highlights are offset along the strand and differently coloured. The azimuthal terms come from tracing the refracted ray through the circular cross-section with Fresnel weights and attenuation. Modern implementations such as the pbrt formulation add energy-preserving normalisation and importance sampling, and extend the model with ellipse cross-sections or glints.
When to choose it
Reach for it when
- hair looks wrong compared to photographs
- want physically based hair highlights and colored glow
- path traced hair needs accurate fibre scattering
- need separate reflection and transmission lobes for fibres
- reference model to validate real-time hair shader
Choose it as the reference for path-traced hair in film or look development and as the basis for pre-integrated real-time approximations. Prefer Disney / Chiang hair and fur BSDF for artist-friendly parameters (melanin, roughness, tint) built on the same lobes. Prefer Kajiya-Kay hair shading where shader cost or hair cards dominate. Use Strand-based real-time hair (TressFX style) to supply the strand geometry and tangents.
Field marks
- Single-fibre scattering misses inter-fibre multiple scattering, so light hair looks too dark without a dual-scattering or path-traced fix
- Azimuthal term evaluated by root solving can have numerical problems near grazing incidence
- Unnormalised lobes break energy conservation when roughness changes
- Incorrect tangent orientation along the curve flips the highlight order of R and TRT
- Noisy highlights at low sample counts since the lobes are very narrow
Presets
Marschner Hair Scattering — single Kajiya-Kay highlight (left) vs physical R + TT + TRT lobes & glints (right)
{
"P_MELANIN": 0.48,
"P_CUTICLE_SHIFT": 0.11,
"P_ROUGHNESS": 0.18,
"P_SPLIT": 0.46
}Show GLSL (139 lines)
const float P_MELANIN = 0.48; // P Hair Melanin [0.05, 1.0, 0.02]
const float P_CUTICLE_SHIFT = 0.11; // P Cuticle Tilt [0.02, 0.22, 0.01]
const float P_ROUGHNESS = 0.18; // P Longitudinal Beta [0.06, 0.42, 0.01]
const float P_SPLIT = 0.46; // P Kajiya / Marschner [0.0, 1.0, 0.02]
float gauss(float x, float beta) {
float b = max(beta, 0.02);
return exp(-0.5 * (x * x) / (b * b)) / (2.5066 * b);
}
// Flowing sculptural lock of curved hair fibers (sweeping ribbon-cylinder SDF)
float mapHairLock(vec3 p) {
vec3 q = p;
q.x -= 0.18 * sin(q.y * 2.6 + 0.4);
q.z -= 0.12 * cos(q.y * 2.2);
// Elliptical ribbon bundle tapering slightly at ends
float width = 0.56 - 0.16 * q.y * q.y;
float d = length(vec2(q.x / max(width, 0.18), q.z / 0.28)) - 1.0;
d *= 0.24;
// Fine micro-strand grooves running vertically along the tangent
float strandPhase = atan(q.z, q.x) * 34.0 + q.x * 28.0;
d += 0.008 * sin(strandPhase);
return max(d, abs(q.y) - 0.85) * 0.82;
}
vec3 calcNormal(vec3 p) {
vec2 e = vec2(0.0025, 0.0);
return normalize(vec3(
mapHairLock(p + e.xyy) - mapHairLock(p - e.xyy),
mapHairLock(p + e.yxy) - mapHairLock(p - e.yxy),
mapHairLock(p + e.yyx) - mapHairLock(p - e.yyx)
));
}
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 screenX = fragCoord.x / max(iResolution.x, 1.0);
float split = clamp(P_SPLIT, 0.0, 1.0);
bool isMarschner = screenX >= split;
float melanin = clamp(P_MELANIN, 0.04, 1.0);
float alphaShift = clamp(P_CUTICLE_SHIFT, 0.01, 0.25);
float betaR = clamp(P_ROUGHNESS, 0.05, 0.45);
vec3 ro = vec3(0.0, 0.0, 2.25);
vec3 rd = normalize(vec3(uv, -1.52));
vec3 col = mix(vec3(0.022, 0.024, 0.038), vec3(0.062, 0.072, 0.105), smoothstep(-0.55, 0.55, uv.y));
float t = 0.0;
bool hit = false;
for (int i = 0; i < 56; i++) {
float d = mapHairLock(ro + rd * t);
if (d < 0.0025) { hit = true; break; }
t += d;
if (t > 5.0) break;
}
if (hit) {
vec3 p = ro + rd * t;
vec3 n = calcNormal(p);
// Hair strand tangent follows the S-curve derivative
vec3 tang = normalize(vec3(0.18 * 2.6 * cos(p.y * 2.6 + 0.4), 1.0, -0.12 * 2.2 * sin(p.y * 2.2)));
// Project tangent orthogonal to macro surface normal for fiber shading
tang = normalize(tang - n * dot(tang, n));
// Animated key light + warm rim backlight to reveal TT transmission!
vec3 lKey = normalize(vec3(0.55 * cos(iTime * 0.55), 0.72, 0.55));
vec3 lRim = normalize(vec3(-0.62, 0.35, -0.70));
vec3 v = -rd;
// Strand-by-strand subtle melanin & micro-shift jitter
float strandId = sin((p.x - 0.18 * sin(p.y * 2.6 + 0.4)) * 95.0) * 0.5 + 0.5;
float strandTone = 0.82 + 0.36 * strandId;
// Physical hair absorption spectrum sigma_a from eumelanin/pheomelanin
vec3 sigmaA = mix(vec3(0.18, 0.48, 0.92), vec3(1.15, 2.15, 3.65), melanin);
vec3 hairCol = exp(-sigmaA * 0.95) * strandTone;
// Longitudinal angles theta_i, theta_r relative to normal plane
float sinTi = clamp(dot(lKey, tang), -0.99, 0.99);
float sinTr = clamp(dot(v, tang), -0.99, 0.99);
float thetaH = 0.5 * (asin(sinTi) + asin(sinTr));
float thetaD = 0.5 * (asin(sinTr) - asin(sinTi));
// Azimuthal projections perpendicular to hair tangent
vec3 lPerp = normalize(lKey - tang * sinTi + vec3(1e-5));
vec3 vPerp = normalize(v - tang * sinTr + vec3(1e-5));
float cosPhi = clamp(dot(lPerp, vPerp), -1.0, 1.0);
float phi = acos(cosPhi);
if (!isMarschner) {
// Left: Classic Kajiya-Kay single unshifted strand specular band + sin(T, L) diffuse
float diff = sqrt(max(1.0 - sinTi * sinTi, 0.0));
vec3 hVec = normalize(lKey + v);
float dotTH = dot(tang, hVec);
float sinTH = sqrt(max(1.0 - dotTH * dotTH, 0.0));
float spec = pow(sinTH, 28.0) * 0.75;
col = hairCol * (0.20 + 0.85 * diff) + vec3(0.95, 0.92, 0.88) * spec;
} else {
// Right: Full Marschner R (white primary shifted -alpha), TRT (colored secondary shifted +3*alpha + glints), TT (transmitted rim)
float mR = gauss(thetaH + alphaShift, betaR);
float mTRT = gauss(thetaH - 1.5 * alphaShift, betaR * 1.9);
// Azimuthal terms N_R (smooth cosine) and N_TRT (caustic glints near phi ~ 35 deg)
float nR = 0.25 + 0.75 * cos(phi * 0.5);
float glint = exp(-pow((phi - 0.62) / 0.16, 2.0)) * (0.45 + 0.55 * strandId);
float nTRT = 0.45 + 1.35 * glint;
// Fresnel & internal absorption through hair cross section (twice for TRT)
float fres = 0.046 + 0.954 * pow(1.0 - max(cos(thetaD), 0.0), 5.0);
vec3 attenTRT = exp(-sigmaA * 1.55) * (1.0 - fres);
// Backlight TT lobe (forward-scattering translucent halo at grazing rim!)
float sinTiRim = clamp(dot(lRim, tang), -0.99, 0.99);
float thetaHRim = 0.5 * (asin(sinTiRim) + asin(sinTr));
float mTT = gauss(thetaHRim - 0.5 * alphaShift, betaR * 0.75);
vec3 lRimPerp = normalize(lRim - tang * sinTiRim + vec3(1e-5));
float backAlign = clamp(-dot(lRimPerp, vPerp), 0.0, 1.0);
float nTT = pow(backAlign, 3.5);
vec3 attenTT = exp(-sigmaA * 0.65);
float wrapDiff = max(dot(n, lKey) * 0.5 + 0.5, 0.0);
vec3 lobeR = vec3(0.96, 0.97, 1.0) * mR * nR * fres * 0.52;
vec3 lobeTRT = attenTRT * mTRT * nTRT * 0.95;
vec3 lobeTT = attenTT * mTT * nTT * 1.35 * (0.35 + 0.65 * pow(1.0 - max(dot(n, v), 0.0), 2.0));
col = hairCol * (0.16 + 0.52 * wrapDiff) + lobeR + lobeTRT + lobeTT;
}
}
float sep = smoothstep(0.0035, 0.0008, abs(screenX - 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 |
|---|---|---|---|
| marschner-hair-scattering-live | Tesla T4 1920x1080 | 18.8× baseline (moderate) · 0.618 ms / 0.662 ms | opengl-timer-query · 32 frames · GPU Weight Atlas · Colab T4 sweep |
| marschner-hair-scattering-live | NVIDIA L4 1920x1080 | 17.1× baseline (moderate) · 0.271 ms / 0.273 ms · 2.3× faster on L4 | opengl-timer-query · Cross-architecture validation |
| marschner-hair-scattering-live | NVIDIA A100-SXM4-40GB 1920x1080 | 12.2× baseline (moderate) · 0.352 ms / 0.354 ms · 1.8× faster on A100 | opengl-timer-query · Cross-architecture validation |
Lineage
From the citation graph (Crossref reference lists): its primary source cites Deep shadow maps.
Crosses
- Unidirectional Path Tracing: The fibre BSDF is sampled at each strand hit while the path tracer handles inter-strand multiple scattering.
Sources
- primaryStephen R. Marschner, Henrik Wann Jensen, Mike Cammarano, Steve Worley, Pat Hanrahan (2003). Light scattering from human hair fibers. ACM Transactions on Graphics.Verified via crossref · 2026-11-29doi:10.1145/882262.882345
- secondaryMatt Pharr, Wenzel Jakob, Greg Humphreys. Scattering from Hair (pbrt-v4). pbr-book.org.Verified via live page · 2026-11-29