Texel A field guide to 3D techniques

Ground-Truth Ambient Occlusion × Screen-Space Contact Shadows × Real-time hatching with tonal art maps

Hatching that deepens in the creases. Real-time pen-and-ink where cross-hatching gathers in cavities and under objects the way illustrators shade. Occlusion and contact shadows feed the tone lookup, and tonal art maps turn darker tone into added strokes rather than grey smudge.

Open in StudioReproduced36.3× · 1.13 ms

Ground-Truth Ambient OcclusionVisibility · Real-timein: depth, normalsout: visibility-mask, normalsnormalsScreen-Space Contact ShadowsVisibility · Real-timein: depth, normalsout: visibility-maskcompositeReal-time hatching with tonal art mapsMaterial · Real-timein: mesh, uv-atlas, normals, textureout: ldr-image

Verified proof

reproduced · 2026-12-01texel-arena-seedlicense MIT
Specimen render of Occlusion-driven cross-hatching (left: direct tone, right: AO + bent normal + contact shadow)
Cross-proof specimen. Occlusion-driven cross-hatching (left: direct tone, right: AO + bent normal + contact shadow). Verified WebGL2 proof · 2026-12-01

Split-screen WebGL2 proof comparing direct-light tonal art map hatching (left) against horizon ambient occlusion, bent normals, and contact-shadow marches driving multi-tier pen-and-ink stroke density in cavities and grounding creases (right).

Chromium Headless ANGLE/SwiftShader WebGL2 · 512x512 · deepens 4-level directional cross-hatching inside cavities and under contact edges while keeping lit planes clean paper

Show GLSL proof (100 lines)
const float AO_WEIGHT = 0.85; // P
const float HATCH_SCALE = 54.0; // P
const float INK_CONTRAST = 1.25; // P
float sdTorus(vec3 p, vec2 t) { vec2 q = vec2(length(p.xz) - t.x, p.y); return length(q) - t.y; }
float sdBox(vec3 p, vec3 b) { vec3 q = abs(p) - b; return length(max(q, 0.0)) + min(max(q.x, max(q.y, q.z)), 0.0); }
float mapScene(vec3 p) {
  float floorD = p.y + 0.55;
  float ped = sdBox(p - vec3(0.0, -0.35, 0.0), vec3(0.75, 0.20, 0.75)) - 0.03;
  float tor = sdTorus(p - vec3(-0.08, 0.04, 0.04), vec2(0.36, 0.16));
  float sph = length(p - vec3(0.32, -0.02, 0.24)) - 0.22;
  float wall = sdBox(p - vec3(0.0, 0.25, -0.78), vec3(1.4, 0.9, 0.12));
  return min(floorD, min(ped, min(tor, min(sph, wall))));
}
vec3 calcNormal(vec3 p) {
  vec2 e = vec2(0.0015, -0.0015);
  return normalize(e.xyy * mapScene(p + e.xyy) + e.yyx * mapScene(p + e.yyx) + e.yxy * mapScene(p + e.yxy) + e.xxx * mapScene(p + e.xxx));
}
void calcGTAOAndBent(vec3 p, vec3 n, out float ao, out vec3 bent) {
  vec3 t = normalize(cross(abs(n.y) > 0.9 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0), n));
  vec3 b = cross(n, t);
  ao = 0.0; bent = vec3(0.0);
  for (int i = 0; i < 6; i++) {
    float a = float(i) * 1.0471975 + 0.35;
    vec3 dir = normalize(n * 0.65 + (cos(a) * t + sin(a) * b) * 0.75);
    float occ = 0.0;
    for (int s = 1; s <= 4; s++) {
      float dist = 0.05 * float(s) * float(s);
      float d = mapScene(p + dir * dist);
      occ = max(occ, clamp((dist - d) / dist, 0.0, 1.0));
    }
    float vis = 1.0 - occ;
    ao += vis;
    bent += dir * vis;
  }
  ao = clamp(ao / 6.0, 0.0, 1.0);
  bent = length(bent) > 1e-4 ? normalize(bent) : n;
}
float contactShadow(vec3 p, vec3 l) {
  float res = 1.0;
  for (int i = 1; i <= 10; i++) {
    float t = 0.025 * float(i);
    float d = mapScene(p + l * t);
    res = min(res, clamp(8.0 * d / t, 0.0, 1.0));
  }
  return res;
}
float hatchLayer(vec2 uv, float ang, float freq, float width) {
  float c = cos(ang), s = sin(ang);
  vec2 r = vec2(c * uv.x - s * uv.y, s * uv.x + c * uv.y) * freq;
  float wave = abs(fract(r.x + 0.06 * sin(r.y * 0.7)) - 0.5);
  return smoothstep(width, width + 0.08, wave);
}
float tonalArtMap(vec2 uv, float tone) {
  float ink = 1.0;
  if (tone < 0.78) ink = min(ink, mix(hatchLayer(uv, 0.55, HATCH_SCALE, 0.14), 1.0, smoothstep(0.56, 0.78, tone)));
  if (tone < 0.56) ink = min(ink, mix(hatchLayer(uv, -0.55, HATCH_SCALE * 1.05, 0.16), 1.0, smoothstep(0.36, 0.56, tone)));
  if (tone < 0.36) ink = min(ink, mix(hatchLayer(uv, 1.48, HATCH_SCALE * 1.15, 0.19), 1.0, smoothstep(0.18, 0.36, tone)));
  if (tone < 0.20) ink = min(ink, mix(hatchLayer(uv, 0.08, HATCH_SCALE * 1.35, 0.24), 1.0, smoothstep(0.04, 0.20, tone)));
  return ink;
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
  vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
  vec3 ro = vec3(0.45 * sin(iTime * 0.2), 0.62, 1.85);
  vec3 ta = vec3(0.0, -0.08, 0.0);
  vec3 fw = normalize(ta - ro);
  vec3 rt = normalize(cross(fw, vec3(0.0, 1.0, 0.0)));
  vec3 up = cross(rt, fw);
  vec3 rd = normalize(fw * 1.45 + rt * uv.x + up * uv.y);
  float t = 0.0; bool hit = false;
  for (int i = 0; i < 72; i++) {
    float d = mapScene(ro + rd * t);
    if (d < 0.001) { hit = true; break; }
    t += d;
    if (t > 8.0) break;
  }
  vec3 paper = vec3(0.965, 0.955, 0.935);
  vec3 inkCol = vec3(0.085, 0.095, 0.115);
  vec3 col = paper;
  if (hit) {
    vec3 pos = ro + rd * t;
    vec3 n = calcNormal(pos);
    vec3 l = normalize(vec3(0.62, 0.78, 0.48));
    vec2 suv = pos.xz * 0.65 + pos.xy * 0.45;
    float direct = clamp(dot(n, l), 0.0, 1.0) * 0.85 + 0.15;
    float tone = direct;
    if (uv.x > 0.0) {
      float ao; vec3 bent;
      calcGTAOAndBent(pos, n, ao, bent);
      float csh = contactShadow(pos + n * 0.006, l);
      float bentLit = clamp(dot(bent, l), 0.0, 1.0) * 0.82 + 0.18;
      tone = bentLit * mix(0.25, 1.0, csh) * mix(1.0, ao, AO_WEIGHT);
    }
    tone = clamp(pow(tone, INK_CONTRAST), 0.0, 1.0);
    float tam = tonalArtMap(suv, tone);
    float rim = smoothstep(0.18, 0.0, abs(dot(n, -rd)));
    col = mix(inkCol, paper, tam * (1.0 - 0.72 * rim));
  }
  if (abs(uv.x) < 0.0028) col = inkCol;
  fragColor = vec4(pow(clamp(col, 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);
}

Why they connect

Ground-Truth Ambient Occlusion outputs an AO term and bent normals from the depth and normals buffers. The bent normals replace the surface normal in the tone computation of Real-time hatching with tonal art maps (a normals hop), so cavities face away from the light, and the AO value darkens tone directly. Screen-Space Contact Shadows outputs a visibility-mask from a short ray march toward the light; that hop is composite because tonal art maps take no mask input, so the mask is multiplied into the lighting term before the tone lookup. Tonal art maps then picks and blends the two nearest stroke levels, adding strokes where tone drops.

How to build it

three.js: use the official GTAO pass on a depth-normal prepass and a short contact-shadow march toward the key light, both written to screen-space targets. In the tonal-art-map material, read those targets at the fragment's screen position and compute tone as saturate(dot(bentNormal, L)) × contactVisibility × lerp(1, AO, k), then select the tone levels. Quantize tone with slight hysteresis, or filter AO more strongly over time than usual, so strokes do not flicker between levels as the denoiser updates. Keep hatching in UV space with a direction field, and use Inverted-hull outlines for silhouettes. Tune AO influence per material so flat lit areas stay clean paper.

Field marks

  1. Noisy or ghosting AO makes strokes appear and vanish from frame to frame.
  2. AO halos at silhouettes add hatch strokes outside the drawn object.
  3. Screen-space contact shadows miss off-screen occluders, so grounding marks pop at frame edges.
  4. UV seams break stroke continuity, as with any tonal art map.

Prior art

No prior art found on 2026-11-29.

Searches run (4)
  • arXiv: all:"hatching" AND all:"ambient occlusion" → 0 results
  • GitHub repos: hatching "ambient occlusion" → 0 results
  • arXiv: all:"tonal art maps" AND all:"shadows" → 0 results
  • GitHub repos: "tonal art maps" shadows → 0 results