{
 "id": "kajiya-kay-hair-shading",
 "title": "Kajiya-Kay hair shading",
 "aliases": [
  "Kajiya-Kay model",
  "strand tangent shading"
 ],
 "domain": "materials",
 "subdomain": "hair and fur",
 "stage": "material",
 "realtime": "realtime",
 "platforms": [
  "webgl2",
  "webgpu",
  "desktop-gpu",
  "mobile-gpu",
  "cpu",
  "unity",
  "unreal",
  "godot",
  "blender"
 ],
 "year_introduced": 1989,
 "inputs": [
  "curves",
  "material-params"
 ],
 "outputs": [
  "radiance"
 ],
 "style": "both",
 "dynamic": "both",
 "summary": "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.",
 "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) + sinTL*sinTV, 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_use": "Choose it for hair cards, fur cards, anisotropic satin and stylised hair where cost and artist control matter. Prefer `marschner-hair-scattering` or `disney-hair-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` for the geometry side when hair is simulated and rendered as lines.",
 "cost": {
  "class": "cheap",
  "notes": "A handful of dot products and pow per light; the second lobe roughly doubles the specular math."
 },
 "failure_modes": [
  "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"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "doi:10.1145/74333.74361",
   "type": "paper",
   "title": "Rendering fur with three dimensional textures",
   "authors": [
    "J. T. Kajiya",
    "T. L. Kay"
   ],
   "year": 1989,
   "venue": "Proceedings of the 16th annual conference on Computer graphics and interactive techniques",
   "url": "https://doi.org/10.1145/74333.74361",
   "ids": {
    "doi": "10.1145/74333.74361"
   },
   "license": null,
   "extra": {
    "csl_type": "proceedings-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/74333.74361",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/74333.74361",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/74333.74361",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/74333.74361",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/74333.74361",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "kajiya1989rendering"
  },
  {
   "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": "kajiya-kay-ball",
   "title": "Kajiya-Kay highlights on latitude strands",
   "runtime": "glsl-fragment",
   "params": {
    "SPEC_POWER": 80,
    "SPEC_POWER_2": 20
   },
   "code": "// GLSL ES 3.0, Shadertoy-style. Strands run along latitude lines of a sphere.\nconst float SPEC_POWER = 80.0;\nconst float SPEC_POWER_2 = 20.0;\nconst vec3 HAIR = vec3(0.35, 0.18, 0.08);\n\nfloat kk(vec3 t, vec3 l, vec3 v, float p) {\n    float tl = dot(t, l), tv = dot(t, v);\n    float s = tl * tv + sqrt(max(1.0 - tl * tl, 0.0)) * sqrt(max(1.0 - tv * tv, 0.0));\n    return pow(clamp(s, 0.0, 1.0), p);\n}\n\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n    vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;\n    vec3 ro = vec3(0.0, 0.0, 3.0);\n    vec3 rd = normalize(vec3(uv, -1.5));\n    vec3 col = vec3(0.03, 0.03, 0.05);\n    float b = dot(ro, rd);\n    float h = b * b - (dot(ro, ro) - 1.0);\n    if (h > 0.0) {\n        vec3 p = ro + rd * (-b - sqrt(h));\n        vec3 n = normalize(p);\n        vec3 t = normalize(cross(vec3(0.0, 1.0, 0.0), n));\n        vec3 l = normalize(vec3(sin(iTime) * 0.8, 0.7, 0.9));\n        vec3 v = -rd;\n        float tl = dot(t, l);\n        float diff = sqrt(max(1.0 - tl * tl, 0.0)) * (0.3 + 0.7 * max(dot(n, l) * 0.5 + 0.5, 0.0));\n        vec3 t2 = normalize(t + 0.25 * n);\n        vec3 spec = vec3(1.0) * kk(t, l, v, SPEC_POWER) + HAIR * 3.0 * kk(t2, l, v, SPEC_POWER_2);\n        col = HAIR * diff + 0.6 * spec;\n    }\n    fragColor = vec4(pow(col, vec3(1.0 / 2.2)), 1.0);\n}",
   "basis": "original",
   "license_note": "written for this index",
   "execution_fidelity": "faithful-pass",
   "proof": {
    "kind": "rendered",
    "label": "rendered 2026-11-29",
    "ok": true,
    "proof": {
     "ok": true,
     "technique": "kajiya-kay-hair-shading",
     "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.4742,
      "std": 0.1702,
      "unique_colors": 216
     },
     "image": "/specimens/kajiya-kay-ball.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "marschner-hair-scattering",
  "disney-hair-bsdf",
  "anisotropic-ggx",
  "shell-fur-rendering",
  "strand-based-real-time-hair"
 ],
 "extends": [],
 "supersedes": [],
 "combines_with": [
  {
   "id": "strand-based-real-time-hair",
   "why": "Simulated strand lines supply per-vertex tangents that the Kajiya-Kay lobes consume."
  }
 ],
 "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/kajiya-kay-hair-shading.json"
 },
 "solves": [
  "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"
 ],
 "authority": "Kajiya & Kay, 1989",
 "url": "https://texelatlas.vercel.app/t/kajiya-kay-hair-shading/",
 "execution_fidelity": "faithful-pass",
 "fidelity_label": "Faithful Pass",
 "benchmark_eligible": true,
 "gpu_weight": {
  "weight_x": 1.45,
  "tier": "feather",
  "p50_ms": 0.0478,
  "p95_ms": 0.0492,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 40,
  "preset_id": "kajiya-kay-ball",
  "execution_fidelity": "faithful-pass",
  "fidelity_label": "Faithful Pass",
  "benchmark_eligible": true,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 1.28,
   "tier": "feather",
   "p50_ms": 0.0203,
   "p95_ms": 0.0204,
   "speedup_x": 2.35,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 1.01,
   "tier": "feather",
   "p50_ms": 0.0292,
   "p95_ms": 0.0292,
   "speedup_x": 1.64,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}