Kajiya-Kay hair shading
Treats a hair strand as an infinitely thin cylinder with a tangent instead of a normal. Diffuse and specular depend on the angle between tangent, light and view, giving the stretched highlight band every game hair shader starts from.
Also known as Kajiya-Kay model, strand tangent shading
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 = Approximate docs HDRP Hair shader. |
| Unreal 5.7 | None found | Unreal Hair shading uses physical Marschner strand scattering rather than Kajiya-Kay. |
| Blender 5.2 | None found | |
| WebGPU W3C | None found | |
| Metal | None found |
How it works
A fibre has no single surface normal, so the model works with the strand tangent T. Diffuse is the average over all normals perpendicular to T, which comes out as sin of the angle between T and the light: sqrt(1 - dot(T,L)^2). Specular uses the cone around T on which light reflects: the highlight is strongest when the angle of the light to the strand mirrors the angle of the eye, giving spec = pow(dot(T,L)dot(T,V) + sinTLsinTV, p) with sinTL = sqrt(1-dot(T,L)^2) and sinTV likewise. Real-time versions usually add a second, differently coloured and shifted lobe by sliding the tangent along the normal using a noise or shift map, imitating the secondary reflection, and multiply by a flow-map or card tangent so highlights follow the hair direction. Shadows and opacity come from separate hair-card or strand techniques; the shading itself is purely local.
When to choose it
Reach for it when
- need cheap shiny highlight along hair strands
- hair cards look like flat plastic
- want anisotropic highlight following hair direction
- game character hair that runs on mobile
- two-tone specular on hair cards
Choose it for hair cards, fur cards, anisotropic satin and stylised hair where cost and artist control matter. Prefer Marschner hair scattering model or Disney / Chiang hair and fur BSDF when physically based fibre colour, multiple lobes and path-traced reference are required. Prefer Anisotropic GGX for brushed metal where a surface normal still exists. Use Strand-based real-time hair (TressFX style) for the geometry side when hair is simulated and rendered as lines.
Field marks
- Highlight sits at the wrong place on the strand because the tangent is not normalised or flips direction along the card
- No light transport through the fibre, so blond or white hair lacks glow and backlighting
- Highlights are single and white without the shifted second lobe, giving a plastic look
- Hair cards sorted wrongly with alpha blending cause popping; alpha-to-coverage trades that for noise
- Specular aliasing on thin fibres sparkles without a roughness or power adjustment at distance
Presets
Kajiya-Kay highlights on latitude strands
{
"SPEC_POWER": 80,
"SPEC_POWER_2": 20
}Show GLSL (32 lines)
// GLSL ES 3.0, Shadertoy-style. Strands run along latitude lines of a sphere.
const float SPEC_POWER = 80.0;
const float SPEC_POWER_2 = 20.0;
const vec3 HAIR = vec3(0.35, 0.18, 0.08);
float kk(vec3 t, vec3 l, vec3 v, float p) {
float tl = dot(t, l), tv = dot(t, v);
float s = tl * tv + sqrt(max(1.0 - tl * tl, 0.0)) * sqrt(max(1.0 - tv * tv, 0.0));
return pow(clamp(s, 0.0, 1.0), p);
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
vec3 ro = vec3(0.0, 0.0, 3.0);
vec3 rd = normalize(vec3(uv, -1.5));
vec3 col = vec3(0.03, 0.03, 0.05);
float b = dot(ro, rd);
float h = b * b - (dot(ro, ro) - 1.0);
if (h > 0.0) {
vec3 p = ro + rd * (-b - sqrt(h));
vec3 n = normalize(p);
vec3 t = normalize(cross(vec3(0.0, 1.0, 0.0), n));
vec3 l = normalize(vec3(sin(iTime) * 0.8, 0.7, 0.9));
vec3 v = -rd;
float tl = dot(t, l);
float diff = sqrt(max(1.0 - tl * tl, 0.0)) * (0.3 + 0.7 * max(dot(n, l) * 0.5 + 0.5, 0.0));
vec3 t2 = normalize(t + 0.25 * n);
vec3 spec = vec3(1.0) * kk(t, l, v, SPEC_POWER) + HAIR * 3.0 * kk(t2, l, v, SPEC_POWER_2);
col = HAIR * diff + 0.6 * spec;
}
fragColor = vec4(pow(col, vec3(1.0 / 2.2)), 1.0);
}Attribution: written for this index
Measured GPU weight & timing
| Preset | GPU | Weight / p50 / p95 | Method |
|---|---|---|---|
| kajiya-kay-ball | Tesla T4 1920x1080 | 1.45× baseline (feather) · 0.048 ms / 0.049 ms | opengl-timer-query · 40 frames · GPU Weight Atlas · Colab T4 sweep |
| kajiya-kay-ball | NVIDIA L4 1920x1080 | 1.28× baseline (feather) · 0.020 ms / 0.020 ms · 2.4× faster on L4 | opengl-timer-query · Cross-architecture validation |
| kajiya-kay-ball | NVIDIA A100-SXM4-40GB 1920x1080 | 1.01× baseline (feather) · 0.029 ms / 0.029 ms · 1.6× faster on A100 | opengl-timer-query · Cross-architecture validation |
Lineage
From the citation graph (Crossref reference lists): its primary source cites Phong and Blinn-Phong shading, Particle systems; cited by Disney / Chiang hair and fur BSDF, Shell and fin fur rendering.
Crosses
- Strand-based real-time hair (TressFX style): Simulated strand lines supply per-vertex tangents that the Kajiya-Kay lobes consume.
Sources
- primaryJ. T. Kajiya, T. L. Kay (1989). Rendering fur with three dimensional textures. Proceedings of the 16th annual conference on Computer graphics and interactive techniques.Verified via crossref · 2026-11-29doi:10.1145/74333.74361
- secondaryCem Yuksel, Sarah Tariq. Advanced techniques in real-time hair rendering and simulation. cemyuksel.com.Verified via live page · 2026-11-29