MatCap (lit sphere) shading
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.
Also known as material capture, lit sphere, litsphere, MatCap
In the family Stylized & non-photorealistic rendering, image-based shading
Where it runs
Built inOfficial add-onPluginNone foundNot researched
| Engine | Support | How |
|---|---|---|
| three.js r187 | Built in | new THREE.MeshMatcapMaterial({ matcap }) docs |
| Babylon.js 9.38.0 | None found | No MatCap material; use a custom node or shader material. |
| Godot 4.7 | None found | No built-in MatCap mode on BaseMaterial3D; implement via a custom ShaderMaterial. |
| Unity | None found | HDRP MatCap exists only as a Scene debug view, not an authorable shading mode. |
| Unreal 5.7 | None found | |
| Blender 5.2 | Built in | Viewport Shading (Workbench) > Lighting = MatCap docs |
| WebGPU W3C | None found | |
| Metal | None found |
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.
Because 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.
Normal 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 choose it
Reach for it when
- 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
Choose it for sculpting viewports, stylised previews, prototypes and non-photoreal looks where artists paint the lighting, and for cheap shading on mobile.
Prefer Toon / cel shading with lighting ramps or Gooch tone shading when the look must respond to scene lights and cast shadows. Prefer Split-Sum Image-Based Lighting or full Cook-Torrance microfacet BRDF lighting for physically consistent materials. Prefer Environment mapping, cubemaps and skyboxes when reflections should depend on the view direction and the world, not just the camera space.
Field marks
- 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
Presets
Procedural matcap on a wobbling blob
{
"key_light": [
-0.4,
0.5,
0.8
],
"rim_strength": 0.4
}Show GLSL (24 lines)
// MatCap: shading is a pure function of the view-space normal; here the "lit sphere image" is procedural.
vec3 matcap(vec2 n) {
float d = length(n);
vec3 base = mix(vec3(0.18, 0.2, 0.3), vec3(0.85, 0.62, 0.5), 0.5 + 0.5 * n.y);
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);
float spec = exp(-dot(n - vec2(-0.3, 0.4), n - vec2(-0.3, 0.4)) * 25.0);
float rim = pow(d, 4.0) * 0.4;
return base + vec3(spec) * 0.9 + vec3(0.4, 0.55, 0.9) * rim;
}
float 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; }
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 p = (fragCoord - 0.5 * iResolution.xy) / (0.42 * iResolution.y);
float r2 = dot(p, p);
vec3 col = vec3(0.1);
if (r2 < 1.0) {
vec3 n = vec3(p, sqrt(1.0 - r2));
vec2 e = vec2(0.002, 0.0);
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 = normalize(n + b * 1.5);
col = matcap(n.xy);
}
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 |
|---|---|---|---|
| matcap-procedural-clay | Tesla T4 1920x1080 | 1.30× baseline (feather) · 0.043 ms / 0.043 ms | opengl-timer-query · 40 frames · GPU Weight Atlas · Colab T4 sweep |
| matcap-procedural-clay | NVIDIA L4 1920x1080 | 1.12× baseline (feather) · 0.018 ms / 0.018 ms · 2.4× faster on L4 | opengl-timer-query · Cross-architecture validation |
| matcap-procedural-clay | NVIDIA A100-SXM4-40GB 1920x1080 | 1.00× baseline (feather) · 0.029 ms / 0.029 ms · 1.5× faster on A100 | opengl-timer-query · Cross-architecture validation |
Crosses
- Normal mapping with MikkTSpace: Tangent-space normal maps perturb the view-space normal before the matcap lookup, adding surface detail without lights.
- Depth/normal Sobel edge outlines: Outline pass adds contour lines the matcap lacks, giving a complete sculpt-viewport look.
- Toon / cel shading with lighting ramps: A banded matcap image is a cheap view-locked toon ramp.
Sources
- primaryBlender Foundation. Blender Workbench lighting: MatCap. docs.blender.org.Verified via live page · 2026-11-29
- implementationthree.js contributors. three.js MeshMatcapMaterial example. threejs.org.Verified via live page · 2026-11-29