{
 "id": "matcap-shading",
 "title": "MatCap (lit sphere) shading",
 "aliases": [
  "material capture",
  "lit sphere",
  "litsphere",
  "MatCap"
 ],
 "domain": "npr",
 "subdomain": "image-based shading",
 "stage": "material",
 "realtime": "realtime",
 "platforms": [
  "webgl2",
  "webgpu",
  "desktop-gpu",
  "mobile-gpu",
  "blender",
  "unity",
  "godot"
 ],
 "year_introduced": 2001,
 "inputs": [
  "normals",
  "texture"
 ],
 "outputs": [
  "ldr-image"
 ],
 "style": "stylized",
 "dynamic": "both",
 "summary": "Colour each pixel by looking up the view-space normal in a single image of a lit sphere. Material, lighting and reflections are baked into the image, so shading is one texture fetch with no lights.",
 "how_it_works": "The lit-sphere idea is that a picture of a sphere with the desired material under the desired lighting encodes a shading function of the normal. For a pixel with view-space normal `n`, take `uv = n.xy * 0.5 + 0.5` and fetch the picture; the sphere's centre corresponds to normals facing the camera and its rim to grazing normals.\n\nBecause the lookup uses view-space normals, the light follows the camera and the object appears to be lit the same way as it rotates, which is exactly what sculpting tools want. Artists can paint any material by painting a sphere, from clay and chrome to toon ramps and painted metal, and get a complete shader.\n\nNormal maps and displacement work naturally because only the normal is used. Fixes people apply include correcting UVs near the rim to avoid texel stretching, using a per-vertex view-space normal rotated by the camera roll, and combining the matcap with an albedo texture by multiply or overlay.",
 "when_to_use": "Choose it for sculpting viewports, stylised previews, prototypes and non-photoreal looks where artists paint the lighting, and for cheap shading on mobile.\n\nPrefer [toon-shading](toon-shading) or [gooch-shading](gooch-shading) when the look must respond to scene lights and cast shadows. Prefer [split-sum-ibl](split-sum-ibl) or full [cook-torrance-brdf](cook-torrance-brdf) lighting for physically consistent materials. Prefer [environment-mapping-cubemaps](environment-mapping-cubemaps) when reflections should depend on the view direction and the world, not just the camera space.",
 "cost": {
  "class": "cheap",
  "notes": "A normal transform and one texture fetch per pixel; no lights, no shadows."
 },
 "failure_modes": [
  "Lighting is locked to the camera; rotating the view changes nothing about the highlight position, which breaks the illusion in scenes with several objects",
  "No shadows, no occlusion and no inter-object reflection, so objects look pasted together",
  "Texel stretching and pinching near the sphere's rim where the normal is almost perpendicular to the view",
  "View-space normals under strong perspective give different shading for the same surface orientation across the frame",
  "Hard to match two matcaps for continuity between meshes, since the sphere image is the entire lighting model",
  "Backfacing or flipped normals fetch from the wrong side of the sphere and shade as dark blobs"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "url:https://docs.blender.org/manual/en/latest/render/workbench/lighting.html",
   "type": "web",
   "title": "Blender Workbench lighting: MatCap",
   "authors": [
    "Blender Foundation"
   ],
   "year": null,
   "venue": "docs.blender.org",
   "url": "https://docs.blender.org/manual/en/latest/render/workbench/lighting.html",
   "ids": {},
   "license": null,
   "extra": {
    "http_status": 200,
    "live": true,
    "archive": {
     "url": "http://web.archive.org/web/20261115151018/https://docs.blender.org/manual/en/latest/render/workbench/lighting.html",
     "timestamp": "20261115151018"
    },
    "page_title": "Lighting - Blender 5.3 Manual",
    "host": "docs.blender.org",
    "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://docs.blender.org/manual/en/latest/render/workbench/lighting.html → 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://docs.blender.org/manual/en/latest/render/workbench/lighting.html → 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.4444444444444444,
   "__bib": "foundationblender"
  },
  {
   "role": "implementation",
   "key": "url:https://threejs.org/examples/webgl_materials_matcap.html",
   "type": "web",
   "title": "three.js MeshMatcapMaterial example",
   "authors": [
    "three.js contributors"
   ],
   "year": null,
   "venue": "threejs.org",
   "url": "https://threejs.org/examples/webgl_materials_matcap.html",
   "ids": {},
   "license": null,
   "extra": {
    "http_status": 200,
    "live": true,
    "archive": {
     "url": "http://web.archive.org/web/20260821154930/https://threejs.org/examples/webgl_materials_matcap.html",
     "timestamp": "20260821154930"
    },
    "page_title": "three.js webgl - materials - matcap",
    "host": "threejs.org",
    "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://threejs.org/examples/webgl_materials_matcap.html → 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://threejs.org/examples/webgl_materials_matcap.html → 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.4444444444444444,
   "__bib": "contributorsthreec"
  }
 ],
 "presets": [
  {
   "id": "matcap-procedural-clay",
   "title": "Procedural matcap on a wobbling blob",
   "runtime": "glsl-fragment",
   "params": {
    "key_light": [
     -0.4,
     0.5,
     0.8
    ],
    "rim_strength": 0.4
   },
   "code": "// MatCap: shading is a pure function of the view-space normal; here the \"lit sphere image\" is procedural.\nvec3 matcap(vec2 n) {\n  float d = length(n);\n  vec3 base = mix(vec3(0.18, 0.2, 0.3), vec3(0.85, 0.62, 0.5), 0.5 + 0.5 * n.y);\n  base *= 0.35 + 0.65 * clamp(dot(vec3(n, sqrt(max(1.0 - d * d, 0.0))), normalize(vec3(-0.4, 0.5, 0.8))), 0.0, 1.0);\n  float spec = exp(-dot(n - vec2(-0.3, 0.4), n - vec2(-0.3, 0.4)) * 25.0);\n  float rim = pow(d, 4.0) * 0.4;\n  return base + vec3(spec) * 0.9 + vec3(0.4, 0.55, 0.9) * rim;\n}\nfloat h(vec2 p) { return sin(p.x * 6.0 + iTime) * sin(p.y * 5.0 - iTime * 0.7) * 0.06 + sin(p.x * 17.0) * sin(p.y * 13.0) * 0.012; }\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n  vec2 p = (fragCoord - 0.5 * iResolution.xy) / (0.42 * iResolution.y);\n  float r2 = dot(p, p);\n  vec3 col = vec3(0.1);\n  if (r2 < 1.0) {\n    vec3 n = vec3(p, sqrt(1.0 - r2));\n    vec2 e = vec2(0.002, 0.0);\n    vec3 b = vec3(-(h(p + e.xy) - h(p - e.xy)) / (2.0 * e.x), -(h(p + e.yx) - h(p - e.yx)) / (2.0 * e.x), 0.0);\n    n = normalize(n + b * 1.5);\n    col = matcap(n.xy);\n  }\n  fragColor = vec4(pow(col, vec3(1.0 / 2.2)), 1.0);\n}\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": "matcap-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.5267,
      "std": 0.1881,
      "unique_colors": 180
     },
     "image": "/specimens/matcap-procedural-clay.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "toon-shading",
  "gooch-shading",
  "split-sum-ibl",
  "environment-mapping-cubemaps",
  "guilty-gear-xrd-shading",
  "normal-mapping-mikktspace"
 ],
 "extends": [],
 "supersedes": [],
 "combines_with": [
  {
   "id": "normal-mapping-mikktspace",
   "why": "Tangent-space normal maps perturb the view-space normal before the matcap lookup, adding surface detail without lights."
  },
  {
   "id": "screen-space-edge-outline",
   "why": "Outline pass adds contour lines the matcap lacks, giving a complete sculpt-viewport look."
  },
  {
   "id": "toon-shading",
   "why": "A banded matcap image is a cheap view-locked toon ramp."
  }
 ],
 "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/matcap-shading.json"
 },
 "solves": [
  "want shading without any lights in the scene",
  "need a quick clay or sculpt viewport look",
  "artist wants to paint the lighting on a sphere",
  "cheap stylized material for mobile with one texture fetch"
 ],
 "authority": "Foundation",
 "url": "https://texelatlas.vercel.app/t/matcap-shading/",
 "execution_fidelity": "faithful-pass",
 "fidelity_label": "Faithful Pass",
 "benchmark_eligible": true,
 "gpu_weight": {
  "weight_x": 1.3,
  "tier": "feather",
  "p50_ms": 0.0427,
  "p95_ms": 0.043,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 40,
  "preset_id": "matcap-procedural-clay",
  "execution_fidelity": "faithful-pass",
  "fidelity_label": "Faithful Pass",
  "benchmark_eligible": true,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 1.12,
   "tier": "feather",
   "p50_ms": 0.0178,
   "p95_ms": 0.018,
   "speedup_x": 2.4,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 1,
   "tier": "feather",
   "p50_ms": 0.0288,
   "p95_ms": 0.0289,
   "speedup_x": 1.48,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}