{
 "id": "guilty-gear-xrd-shading",
 "title": "Guilty Gear Xrd anime-style 3D shading",
 "aliases": [],
 "domain": "npr",
 "subdomain": "anime shading",
 "stage": "lighting",
 "realtime": "realtime",
 "platforms": [
  "desktop-gpu",
  "unreal"
 ],
 "year_introduced": 2014,
 "inputs": [
  "mesh",
  "normals",
  "texture"
 ],
 "outputs": [
  "ldr-image"
 ],
 "style": "stylized",
 "dynamic": "dynamic",
 "summary": "A production recipe that makes 3D characters look hand-drawn through artist-edited normals and vertex data, a threshold texture on shading, and custom outlines, animated at a lowered frame rate.",
 "how_it_works": "Characters are rendered with a simple toon shader whose light term is thresholded, but the key is how it is controlled: artists edit vertex normals so shadow terminators fall in drawn-looking shapes; a vertex-colour channel biases the threshold per area, and a texture channel adds ink-style lines inside the surface. Outlines combine inverted-hull shells with vertex-colour-driven thickness, plus separate strokes for interior lines. The characters are animated on limited key poses and with hand-adjusted camera angles to mimic 2D animation. The talk lays out these choices and the workflow around them.",
 "when_to_use": "Choose it when you want hand-controllable, anime-grade stills and animation from 3D, and can afford artist time. Prefer `toon-shading` with a standard ramp for generic stylization, and `ligne-claire-moebius-shading` when you want a sparse, European comics look.",
 "cost": {
  "class": "cheap",
  "notes": "Cheap shading, plus a hull outline pass; the real cost is authoring."
 },
 "failure_modes": [
  "Depends on heavy manual normal and vertex-data authoring per character",
  "Looks break when lighting changes or the model is re-posed beyond tuned ranges",
  "Edited normals conflict with standard skinning or LOD pipelines",
  "Low-framerate animation can read as stutter in a smooth game engine"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "url:https://www.gdcvault.com/play/1022031/GuiltyGearXrd-s-Art-Style-The",
   "type": "web",
   "title": "Guilty Gear Xrd's Art Style: The X Factor Between 2D and 3D",
   "authors": [
    "Junya Motomura"
   ],
   "year": null,
   "venue": "GDC 2015",
   "url": "https://www.gdcvault.com/play/1022031/GuiltyGearXrd-s-Art-Style-The",
   "ids": {},
   "license": null,
   "extra": {
    "http_status": 200,
    "live": true,
    "archive": {
     "url": "http://web.archive.org/web/20261014050242/https://www.gdcvault.com/play/1022031/GuiltyGearXrd-s-Art-Style-The",
     "timestamp": "20261014050242"
    },
    "page_title": "GuiltyGearXrd",
    "host": "gdcvault.com",
    "title_confirmed_by_page": false,
    "title_unconfirmed": true
   },
   "provenance": {
    "title": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "http",
     "endpoint": "GET https://www.gdcvault.com/play/1022031/GuiltyGearXrd-s-Art-Style-The → 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": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "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,
   "__bib": "motomuraguilty"
  }
 ],
 "presets": [
  {
   "id": "guilty-gear-xrd-shading-live",
   "title": "Guilty Gear Xrd anime 3D shading — stepped cel threshold, ink contour outlines and stylized rim",
   "runtime": "glsl-fragment",
   "params": {
    "SHADOW_THRESH": 0.18,
    "OUTLINE_WIDTH": 0.032,
    "RIM_STRENGTH": 0.9,
    "SPEC_CUTOFF": 0.72
   },
   "basis": "original",
   "license_note": "MIT — written for this index",
   "code": "const float SHADOW_THRESH = 0.18; // P\nconst float OUTLINE_WIDTH = 0.032; // P\nconst float RIM_STRENGTH = 0.9; // P\nconst float SPEC_CUTOFF = 0.72; // P\n\nfloat sdBox(vec3 p, vec3 b) {\n  vec3 q = abs(p) - b;\n  return length(max(q, 0.0)) + min(max(q.x, max(q.y, q.z)), 0.0);\n}\n\nfloat sdCapsule(vec3 p, vec3 a, vec3 b, float r) {\n  vec3 pa = p - a, ba = b - a;\n  float h = clamp(dot(pa, ba) / dot(ba, ba), 0.0, 1.0);\n  return length(pa - ba * h) - r;\n}\n\n// Stylized anime mecha-knight bust with angular armor plates, visor and crest\nvec2 mapHero(vec3 p) {\n  // Stepped 12 fps key-pose turntable (classic Xrd limited-framerate feel)\n  float tStep = floor(iTime * 12.0) / 12.0;\n  float yaw = 0.42 * sin(tStep * 0.9);\n  if (iMouse.z > 0.5 || length(iMouse.xy) > 1.0) {\n    yaw = (iMouse.x / iResolution.x - 0.5) * 2.6;\n  }\n  float cy = cos(yaw), sy = sin(yaw);\n  p.xz = mat2(cy, -sy, sy, cy) * p.xz;\n\n  // 1: crimson armor crown, 2: ivory faceplate, 3: glowing cyan visor, 4: gold V-fin crest\n  vec3 q = p - vec3(0.0, 0.14, 0.0);\n  float helm = length(q * vec3(1.05, 0.95, 0.98)) - 0.48;\n  float cheek = sdBox(vec3(abs(q.x) - 0.28, q.y + 0.14, q.z - 0.06), vec3(0.14, 0.24, 0.26)) - 0.04;\n  float pauldron = sdBox(vec3(abs(p.x) - 0.56, p.y + 0.48, p.z), vec3(0.28, 0.20, 0.28)) - 0.05;\n  float chest = sdBox(p - vec3(0.0, -0.56, -0.02), vec3(0.36, 0.26, 0.24)) - 0.04;\n  float dRed = min(min(helm, cheek), min(pauldron, chest));\n\n  float face = sdBox(q - vec3(0.0, -0.14, 0.28), vec3(0.20, 0.22, 0.18)) - 0.05;\n  float visor = sdBox(q - vec3(0.0, 0.02, 0.37), vec3(0.26, 0.075, 0.10)) - 0.015;\n\n  vec3 vp = vec3(abs(q.x), q.y - 0.24, q.z - 0.34);\n  float fin = sdCapsule(vp, vec3(0.0, -0.05, 0.05), vec3(0.46, 0.34, -0.06), 0.042);\n  float gem = sdBox(q - vec3(0.0, 0.22, 0.42), vec3(0.055, 0.075, 0.05)) - 0.01;\n  float dGold = min(fin, gem);\n\n  vec2 res = vec2(dRed, 1.0);\n  if (face < res.x) res = vec2(face, 2.0);\n  if (visor < res.x) res = vec2(visor, 3.0);\n  if (dGold < res.x) res = vec2(dGold, 4.0);\n  return res;\n}\n\nvec3 calcNormal(vec3 p) {\n  vec2 e = vec2(0.0025, 0.0);\n  return normalize(vec3(\n    mapHero(p + e.xyy).x - mapHero(p - e.xyy).x,\n    mapHero(p + e.yxy).x - mapHero(p - e.yxy).x,\n    mapHero(p + e.yyx).x - mapHero(p - e.yyx).x\n  ));\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.02, 2.55);\n  vec3 rd = normalize(vec3(uv, -1.65));\n\n  // Speedline anime backdrop\n  float ang = atan(uv.y, uv.x);\n  float rays = smoothstep(0.65, 0.95, sin(ang * 24.0 + iTime * 0.4) * 0.5 + 0.5);\n  vec3 bg = mix(vec3(0.11, 0.13, 0.22), vec3(0.22, 0.28, 0.46), clamp(uv.y + 0.55, 0.0, 1.0));\n  bg += vec3(0.07, 0.09, 0.16) * rays * smoothstep(0.15, 0.65, length(uv));\n\n  float t = 0.2, minD = 1e5;\n  vec2 hit = vec2(-1.0);\n  for (int i = 0; i < 72; i++) {\n    vec2 res = mapHero(ro + rd * t);\n    minD = min(minD, res.x);\n    if (res.x < 0.002) { hit = vec2(t, res.y); break; }\n    t += res.x * 0.85;\n    if (t > 6.5) break;\n  }\n\n  float outW = max(OUTLINE_WIDTH, 0.001);\n  vec3 inkCol = vec3(0.05, 0.04, 0.09);\n  vec3 col = bg;\n\n  if (hit.x > 0.0) {\n    vec3 p = ro + rd * hit.x;\n    vec3 n = calcNormal(p);\n    vec3 v = -rd;\n    vec3 L = normalize(vec3(0.68, 0.62, 0.55));\n    // Stylized edited-normal bias on the faceplate for clean 2D shadow shapes\n    vec3 nShade = (hit.y > 1.5 && hit.y < 2.5) ? normalize(mix(n, normalize(vec3(p.x, 0.15, 0.85)), 0.55)) : n;\n    float nl = dot(nShade, L);\n    float thresh = clamp(SHADOW_THRESH, -0.6, 0.85);\n    float litMask = smoothstep(thresh - 0.025, thresh + 0.025, nl);\n\n    // Saturated anime base & cool-shifted shadow palettes (never desaturated grey)\n    vec3 baseC, shadC;\n    if (hit.y < 1.5) { baseC = vec3(0.92, 0.20, 0.24); shadC = vec3(0.36, 0.08, 0.24); }\n    else if (hit.y < 2.5) { baseC = vec3(0.97, 0.94, 0.88); shadC = vec3(0.56, 0.58, 0.76); }\n    else if (hit.y < 3.5) { baseC = vec3(0.20, 0.96, 1.00); shadC = vec3(0.06, 0.45, 0.72); }\n    else { baseC = vec3(1.00, 0.80, 0.20); shadC = vec3(0.62, 0.32, 0.12); }\n\n    col = mix(shadC, baseC, litMask);\n\n    // Crisp stepped specular band\n    vec3 H = normalize(L + v);\n    float spec = smoothstep(SPEC_CUTOFF - 0.02, SPEC_CUTOFF + 0.02, dot(n, H)) * litMask;\n    col = mix(col, vec3(1.0, 0.98, 0.92), spec * 0.82);\n\n    // Lit-side stylized Fresnel rim highlight\n    float ndv = max(dot(n, v), 0.0);\n    float rim = smoothstep(0.56, 0.62, 1.0 - ndv) * smoothstep(-0.15, 0.15, nl);\n    col += vec3(0.95, 0.92, 1.0) * rim * clamp(RIM_STRENGTH, 0.0, 1.5) * 0.55;\n\n    // Subtle manga shadow hatch lines in deep shadow\n    float hatch = smoothstep(0.65, 0.85, sin((fragCoord.x + fragCoord.y) * 0.55));\n    col *= 1.0 - (1.0 - litMask) * smoothstep(thresh - 0.22, thresh - 0.35, nl) * hatch * 0.28;\n\n    // Interior crease & silhouette ink lines via normal derivative\n    float edgeN = length(fwidth(n)) * 1.45;\n    float sil = smoothstep(0.28, 0.14, ndv) * step(0.005, outW);\n    float innerInk = smoothstep(0.42, 0.65, edgeN);\n    col = mix(col, inkCol, clamp(max(sil, innerInk), 0.0, 1.0));\n  } else if (minD < outW) {\n    // Crisp inverted-hull-style exterior ink outline\n    float outMask = smoothstep(outW, outW * 0.65, minD);\n    col = mix(bg, inkCol, outMask);\n  }\n  fragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n}",
   "execution_fidelity": "conceptual-diagram",
   "proof": {
    "kind": "rendered",
    "label": "rendered 2026-11-30",
    "ok": true,
    "proof": {
     "ok": true,
     "technique": "guilty-gear-xrd-shading",
     "runtime": "glsl-fragment",
     "checked_at": "2026-11-30T16:15:34.232Z",
     "renderer": "Chromium 145.0.7632.6 headless, WebGL2 via ANGLE/SwiftShader, 512×512, iTime=1.5",
     "stats": {
      "mean": 0.4777,
      "std": 0.2924,
      "unique_colors": 319
     },
     "image": "/specimens/guilty-gear-xrd-shading-live.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "toon-shading",
  "inverted-hull-outline"
 ],
 "extends": [
  "inverted-hull-outline"
 ],
 "supersedes": [],
 "combines_with": [
  {
   "id": "inverted-hull-outline",
   "why": "Vertex-colour-controlled hull gives the varying line weight of the hand-drawn look."
  }
 ],
 "provenance": {
  "prose": "original text written for this index (research draft, editorially reviewed)",
  "sources_verified_at": "2026-11-29T15:51:27.588Z",
  "draft": "data/drafts/npr/guilty-gear-xrd-shading.json"
 },
 "solves": [
  "anime characters look flat in 3d toon shading",
  "shadow edges on toon faces look ugly and noisy",
  "make 3d model look like hand drawn 2d animation",
  "artist control over shadow shapes on cel shaded characters"
 ],
 "authority": "Motomura",
 "url": "https://texelatlas.vercel.app/t/guilty-gear-xrd-shading/",
 "execution_fidelity": "conceptual-diagram",
 "fidelity_label": "Visual Diagram",
 "benchmark_eligible": false,
 "gpu_weight": {
  "weight_x": 35.41,
  "tier": "heavy",
  "p50_ms": 1.1651,
  "p95_ms": 1.2162,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 40,
  "preset_id": "guilty-gear-xrd-shading-live",
  "execution_fidelity": "conceptual-diagram",
  "fidelity_label": "Visual Diagram",
  "benchmark_eligible": false,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 31.63,
   "tier": "heavy",
   "p50_ms": 0.5029,
   "p95_ms": 0.5172,
   "speedup_x": 2.32,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 21.81,
   "tier": "heavy",
   "p50_ms": 0.6281,
   "p95_ms": 0.6432,
   "speedup_x": 1.85,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}