{
 "id": "suggestive-contours",
 "title": "Suggestive contours",
 "aliases": [],
 "domain": "npr",
 "subdomain": "line drawing",
 "stage": "material",
 "realtime": "interactive",
 "platforms": [
  "desktop-gpu",
  "cpu",
  "webgl2"
 ],
 "year_introduced": 2003,
 "inputs": [
  "mesh",
  "normals"
 ],
 "outputs": [
  "curves",
  "ldr-image"
 ],
 "style": "stylized",
 "dynamic": "dynamic",
 "summary": "Line-drawing technique that adds, beyond true silhouettes, lines at places where a contour would appear under a small viewpoint change, conveying shape the way an artist's sketch does.",
 "how_it_works": "True contours occur where the surface normal is perpendicular to the view vector. Suggestive contours are the nearby points where the surface is a minimum of the normal-dot-view function along the view-projected direction; equivalently, the radial curvature crosses zero while the derivative of curvature along the view direction is positive. These loci can be computed per vertex, linearly interpolated across triangles to extract line segments, and drawn with thickness by view-dependent criteria. Because they depend on the camera, they must be recomputed every frame or approximated in image space. Subsequent work added temporal coherence and GPU evaluation.",
 "when_to_use": "Choose it when you need line-art depiction of smooth organic shapes, such as anatomy or scanned sculptures, that silhouettes alone render as a bare outline. Prefer `screen-space-edge-outline` when you want a cheap image-space look for hard-surface scenes, and `inverted-hull-outline` for plain game-style outlines. It is not a good fit for noisy meshes.",
 "cost": {
  "class": "medium",
  "notes": "Per-vertex curvature derivatives plus line extraction each frame; interactive on CPU for moderate meshes, cheap on GPU after precomputation."
 },
 "failure_modes": [
  "Needs clean, well-tessellated smooth meshes; noisy scans produce spurious squiggles",
  "Curvature derivative estimation is sensitive to mesh quality and sampling",
  "Lines flicker or pop in animation without temporal smoothing",
  "Creates no lines on flat or developable surfaces"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "doi:10.1145/882262.882354",
   "type": "paper",
   "title": "Suggestive contours for conveying shape",
   "authors": [
    "Doug DeCarlo",
    "Adam Finkelstein",
    "Szymon Rusinkiewicz",
    "Anthony Santella"
   ],
   "year": 2003,
   "venue": "ACM Transactions on Graphics",
   "url": "https://doi.org/10.1145/882262.882354",
   "ids": {
    "doi": "10.1145/882262.882354"
   },
   "license": null,
   "extra": {
    "csl_type": "journal-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/882262.882354",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/882262.882354",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/882262.882354",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/882262.882354",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/882262.882354",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "decarlo2003suggestive"
  }
 ],
 "presets": [
  {
   "id": "suggestive-contours-live",
   "title": "Suggestive contours — radial curvature D_w(N·V)=0 ink lines on 3D sculpted form",
   "runtime": "glsl-fragment",
   "params": {
    "P_CONTOUR_WIDTH": 1,
    "P_SUGGESTIVE_TH": 0.48,
    "P_PAPER_TONE": 0.62,
    "P_SPIN_SPEED": 1
   },
   "basis": "original",
   "license_note": "Original interactive WebGL2 fragment shader written for Texel Atlas (MIT).",
   "code": "const float P_CONTOUR_WIDTH = 1.0; // P Ink Width [0.4, 2.2, 0.05]\nconst float P_SUGGESTIVE_TH = 0.48; // P Suggestive Sens [0.1, 1.0, 0.02]\nconst float P_PAPER_TONE = 0.62; // P Wash Shading [0.0, 1.0, 0.02]\nconst float P_SPIN_SPEED = 1.0; // P Turntable Speed [0.0, 2.5, 0.05]\n\nmat2 rot2(float a) { float c = cos(a), s = sin(a); return mat2(c, -s, s, c); }\n\nfloat smin(float a, float b, float k) {\n  float h = clamp(0.5 + 0.5 * (b - a) / k, 0.0, 1.0);\n  return mix(b, a, h) - k * h * (1.0 - h);\n}\n\n// Sculpted organic classical bust/metaball form with rich concave valleys & cheekbones\n// (concave inflections are exactly where DeCarlo suggestive contours emerge!)\nfloat mapSculpt(vec3 p) {\n  vec3 q = p;\n  q.xz = rot2(iTime * 0.42 * max(P_SPIN_SPEED, 0.0) + 0.35) * q.xz;\n  q.yz = rot2(0.18 * sin(iTime * 0.35)) * q.yz;\n\n  // Torus core blended with sculpted lobes to form valleys, brow ridges & flutes\n  vec2 tq = vec2(length(q.xz) - 0.56, q.y);\n  float dTorus = length(tq) - 0.28;\n  float dHead = length(q - vec3(0.0, 0.24, 0.0)) - 0.46;\n  float dChin = length(q - vec3(0.0, -0.34, 0.22)) - 0.34;\n  float d = smin(dTorus, dHead, 0.26);\n  d = smin(d, dChin, 0.24);\n\n  // Subtle carved organic flutes producing vivid radial-curvature valleys\n  float ang = atan(q.z, q.x);\n  d += 0.048 * sin(ang * 5.0 + q.y * 4.5) * smoothstep(0.15, 0.65, length(q.xz));\n  d += 0.032 * cos(q.y * 9.5 - q.x * 3.5);\n  return d * 0.72;\n}\n\nvec3 calcNormal(vec3 p) {\n  vec2 e = vec2(0.0025, 0.0);\n  return normalize(vec3(\n    mapSculpt(p + e.xyy) - mapSculpt(p - e.xyy),\n    mapSculpt(p + e.yxy) - mapSculpt(p - e.yxy),\n    mapSculpt(p + e.yyx) - mapSculpt(p - e.yyx)\n  ));\n}\n\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n  vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;\n\n  vec3 ro = vec3(0.0, 0.04, 2.02);\n  vec3 rd = normalize(vec3(uv, -1.55));\n\n  // Warm museum sketchbook paper with fine fiber grain\n  float grain = 0.97 + 0.03 * sin(uv.x * 210.0 + sin(uv.y * 140.0)) * cos(uv.y * 195.0);\n  vec3 paper = vec3(0.955, 0.925, 0.865) * grain;\n  vec3 col = paper * (1.0 - 0.14 * dot(uv, uv));\n\n  float t = 0.0;\n  bool hit = false;\n  for (int i = 0; i < 68; i++) {\n    float d = mapSculpt(ro + rd * t);\n    if (d < 0.0018) { hit = true; break; }\n    t += d;\n    if (t > 8.0) break;\n  }\n\n  if (hit) {\n    vec3 p = ro + rd * t;\n    vec3 n = calcNormal(p);\n    vec3 v = -rd;\n    float ndv = dot(n, v);\n\n    // Projected view vector w onto the surface tangent plane: w = normalize(v - (n·v) n)\n    vec3 wRaw = v - n * ndv;\n    float wLen = length(wRaw) + 1e-4;\n    vec3 w = wRaw / wLen;\n\n    // Evaluate DeCarlo directional derivatives along w in the tangent plane:\n    // Radial curvature k_r proportional to D_w(n·v) = (n(p+eps*w)·v - n(p-eps*w)·v) / (2*eps)\n    float eps = 0.014;\n    vec3 pPlus = p + w * eps;\n    vec3 pMinus = p - w * eps;\n    // Project back onto isosurface for exact surface derivative\n    pPlus -= calcNormal(pPlus) * mapSculpt(pPlus);\n    pMinus -= calcNormal(pMinus) * mapSculpt(pMinus);\n\n    float ndvPlus = dot(calcNormal(pPlus), normalize(ro - pPlus));\n    float ndvMinus = dot(calcNormal(pMinus), normalize(ro - pMinus));\n\n    // First derivative D_w(N·V) ~ 0 at suggestive contours\n    float dw = (ndvPlus - ndvMinus) / (2.0 * eps);\n    // Second derivative D_w^2(N·V) > 0 guarantees local MINIMUM of N·V (concave valley, not ridge!)\n    float d2w = (ndvPlus - 2.0 * ndv + ndvMinus) / (eps * eps);\n\n    float wScale = clamp(P_CONTOUR_WIDTH, 0.35, 2.5);\n    float sens = clamp(P_SUGGESTIVE_TH, 0.08, 1.1);\n\n    // 1) True occluding silhouette contour: N·V -> 0\n    float occluding = smoothstep(0.28 * wScale, 0.08 * wScale, ndv);\n\n    // 2) Suggestive contour: D_w(N·V) crosses 0 with positive second derivative d2w > threshold\n    //    and grazing filter so front-facing flat spots do not trigger noise\n    float nearZeroDw = exp(-pow(dw / (0.34 * wScale), 2.0));\n    float posCurv = smoothstep(0.65 / sens, 3.8 / sens, d2w);\n    float viewWindow = smoothstep(0.92, 0.35, ndv) * smoothstep(0.06, 0.16, ndv);\n    float suggestive = clamp(nearZeroDw * posCurv * viewWindow * 1.35, 0.0, 1.0);\n\n    // Subtle soft archival wash + cool/warm technical pencil tint\n    vec3 lDir = normalize(vec3(0.58, 0.78, 0.55));\n    float diff = max(dot(n, lDir), 0.0);\n    float washAmt = clamp(P_PAPER_TONE, 0.0, 1.0);\n    vec3 warmPaper = vec3(0.96, 0.93, 0.87);\n    vec3 coolShadow = vec3(0.56, 0.63, 0.72);\n    vec3 surfCol = mix(warmPaper, mix(coolShadow, warmPaper, 0.25 + 0.75 * diff), washAmt);\n\n    // Distinct ink hierarchy: deep charcoal for true contours, rich sepia-slate ink for suggestive contours\n    vec3 contourInk = vec3(0.06, 0.065, 0.085);\n    vec3 suggInk = vec3(0.16, 0.19, 0.28);\n\n    col = mix(surfCol, suggInk, suggestive * 0.92);\n    col = mix(col, contourInk, occluding * 0.96);\n  }\n\n  fragColor = vec4(pow(clamp(col, 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);\n}",
   "execution_fidelity": "conceptual-diagram",
   "proof": {
    "kind": "rendered",
    "label": "rendered 2026-11-30",
    "ok": true,
    "proof": {
     "ok": true,
     "technique": "suggestive-contours",
     "runtime": "glsl-fragment",
     "checked_at": "2026-11-30T16:50:13.852Z",
     "renderer": "Chromium 145.0.7632.6 headless, WebGL2 via ANGLE/SwiftShader, 512×512, iTime=1.5",
     "stats": {
      "mean": 0.9151,
      "std": 0.0825,
      "unique_colors": 113
     },
     "image": "/specimens/suggestive-contours-live.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "screen-space-edge-outline",
  "gooch-shading",
  "inverted-hull-outline"
 ],
 "extends": [],
 "supersedes": [],
 "combines_with": [],
 "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/suggestive-contours.json"
 },
 "solves": [
  "line drawing misses important shape features",
  "silhouettes alone don't convey the model's form",
  "non-photorealistic line art from 3d mesh",
  "illustration style outlines that show hidden ridges"
 ],
 "authority": "DeCarlo et al., 2003",
 "url": "https://texelatlas.vercel.app/t/suggestive-contours/",
 "execution_fidelity": "conceptual-diagram",
 "fidelity_label": "Visual Diagram",
 "benchmark_eligible": false,
 "gpu_weight": {
  "weight_x": 68.97,
  "tier": "extreme",
  "p50_ms": 2.2692,
  "p95_ms": 2.4881,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 40,
  "preset_id": "suggestive-contours-live",
  "execution_fidelity": "conceptual-diagram",
  "fidelity_label": "Visual Diagram",
  "benchmark_eligible": false,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 52.15,
   "tier": "heavy",
   "p50_ms": 0.8292,
   "p95_ms": 0.8438,
   "speedup_x": 2.74,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 41.37,
   "tier": "heavy",
   "p50_ms": 1.1914,
   "p95_ms": 1.2024,
   "speedup_x": 1.9,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}