{
 "id": "curvature-map-baking",
 "title": "Curvature map generation for edge wear and masking",
 "aliases": [
  "curvature baking",
  "convexity and concavity map",
  "edge wear mask"
 ],
 "domain": "materials",
 "subdomain": "mask generation",
 "stage": "material",
 "realtime": "interactive",
 "platforms": [
  "blender",
  "cpu",
  "desktop-gpu",
  "webgl2",
  "python",
  "houdini"
 ],
 "year_introduced": 2004,
 "inputs": [
  "mesh",
  "normals"
 ],
 "outputs": [
  "texture"
 ],
 "style": "both",
 "dynamic": "static",
 "summary": "Computes per-vertex or per-texel mean curvature to tell convex edges from concave cavities, then bakes it to a texture. Texture artists use it to drive edge wear, dirt in crevices and highlights.",
 "how_it_works": "Mean curvature measures how quickly the normal changes across the surface: positive on convex ridges, negative in creases. On a triangle mesh one fits the shape operator per face from the differences of vertex normals across each edge, as Rusinkiewicz does, then averages onto vertices with area or angle weights to get principal curvatures. A cheaper estimate uses the cotangent Laplacian of positions or the angle between neighbouring vertex normals. For texture-space baking, the vertex values are rasterised into the UV atlas, or computed in the pixel shader by comparing a normal map with its blurred neighbour (the screen-space Laplacian trick). Radius control comes from smoothing before measuring. The map is remapped by a ramp to produce an edge mask, which is multiplied into procedural wear, rust or paint chipping layers. Output can be signed or split into convex and concave masks.",
 "when_to_use": "Choose it to drive procedural wear, dirt accumulation and edge highlighting in a texturing workflow, or to feed `weathering-simulation` and masks in material graphs. Prefer ambient occlusion bakes (see `ground-truth-ambient-occlusion`) for crevice darkening that depends on surroundings rather than local shape. Prefer `pre-integrated-skin-shading` when the curvature is used at runtime in a skin LUT. The baker is typically part of `normal-map-baking` tools.",
 "cost": {
  "class": "offline",
  "notes": "Per-vertex estimate is fast on CPU; baking to texels is a standard rasterisation pass."
 },
 "failure_modes": [
  "Noisy per-vertex curvature on irregular triangulation, giving speckled wear masks",
  "Low-poly bevels give a single hard edge instead of a smooth falloff, so the mask looks blocky",
  "Normal-map-derived curvature depends on texture resolution and compression artefacts",
  "Mirrored or overlapping UVs bake mismatched values",
  "Sign convention differs between tools, inverting edge and cavity masks"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "doi:10.1109/tdpvt.2004.1335277",
   "type": "paper",
   "title": "Estimating curvatures and their derivatives on triangle meshes",
   "authors": [
    "S. Rusinkiewicz"
   ],
   "year": null,
   "venue": "Proceedings. 2nd International Symposium on 3D Data Processing, Visualization and Transmission, 2004. 3DPVT 2004.",
   "url": "https://doi.org/10.1109/tdpvt.2004.1335277",
   "ids": {
    "doi": "10.1109/tdpvt.2004.1335277"
   },
   "license": null,
   "extra": {
    "csl_type": "proceedings-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1109/tdpvt.2004.1335277",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1109/tdpvt.2004.1335277",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1109/tdpvt.2004.1335277",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1109/tdpvt.2004.1335277",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1109/tdpvt.2004.1335277",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "rusinkiewiczestimating"
  }
 ],
 "presets": [
  {
   "id": "curvature-laplacian-sdf",
   "title": "SDF-Laplacian curvature visualisation",
   "runtime": "glsl-fragment",
   "params": {
    "EPS": 0.02,
    "GAIN": 0.25
   },
   "code": "// GLSL ES 3.0, Shadertoy-style. Convex (warm) vs concave (cool) tint from the SDF Laplacian.\nconst float EPS = 0.02;\nconst float GAIN = 0.25;\n\nmat2 rot(float a) { float c = cos(a), s = sin(a); return mat2(c, -s, s, c); }\n\nfloat map(vec3 p) {\n    p.xz = rot(iTime * 0.5) * p.xz;\n    float s = length(p - vec3(0.0, 0.55, 0.0)) - 0.55;\n    vec3 q = abs(p - vec3(0.0, -0.35, 0.0)) - vec3(0.8, 0.3, 0.8);\n    float b = length(max(q, 0.0)) + min(max(q.x, max(q.y, q.z)), 0.0) - 0.08;\n    float k = 0.2;\n    float hh = clamp(0.5 + 0.5 * (b - s) / k, 0.0, 1.0);\n    return mix(b, s, hh) - k * hh * (1.0 - hh);\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.5, 3.2);\n    vec3 rd = normalize(vec3(uv, -1.6));\n    vec3 col = vec3(0.05, 0.06, 0.09);\n    float t = 0.0;\n    bool hit = false;\n    for (int i = 0; i < 90; i++) {\n        float d = map(ro + rd * t);\n        if (d < 0.001) { hit = true; break; }\n        t += d;\n        if (t > 8.0) break;\n    }\n    if (hit) {\n        vec3 p = ro + rd * t;\n        vec2 e = vec2(EPS, 0.0);\n        vec3 n = normalize(vec3(map(p + e.xyy) - map(p - e.xyy), map(p + e.yxy) - map(p - e.yxy), map(p + e.yyx) - map(p - e.yyx)));\n        float lap = (map(p + e.xyy) + map(p - e.xyy) + map(p + e.yxy) + map(p - e.yxy) + map(p + e.yyx) + map(p - e.yyx) - 6.0 * map(p)) / (EPS * EPS);\n        float c = clamp(lap * GAIN, -1.0, 1.0);\n        vec3 base = vec3(0.45);\n        vec3 tint = c > 0.0 ? mix(base, vec3(1.0, 0.65, 0.2), c) : mix(base, vec3(0.1, 0.3, 0.8), -c);\n        float diff = 0.25 + 0.75 * max(dot(n, normalize(vec3(0.5, 0.8, 0.6))), 0.0);\n        col = tint * diff;\n    }\n    fragColor = vec4(pow(col, vec3(1.0 / 2.2)), 1.0);\n}",
   "basis": "original",
   "license_note": "written for this index",
   "execution_fidelity": "conceptual-diagram",
   "proof": {
    "kind": "rendered",
    "label": "rendered 2026-11-29",
    "ok": true,
    "proof": {
     "ok": true,
     "technique": "curvature-map-baking",
     "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.4504,
      "std": 0.1916,
      "unique_colors": 186
     },
     "image": "/specimens/curvature-laplacian-sdf.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "normal-map-baking",
  "weathering-simulation",
  "pre-integrated-skin-shading",
  "bent-normals",
  "ground-truth-ambient-occlusion"
 ],
 "extends": [],
 "supersedes": [],
 "combines_with": [
  {
   "id": "weathering-simulation",
   "why": "Curvature masks decide where edge wear and cavity dirt accumulate."
  },
  {
   "id": "normal-map-baking",
   "why": "Both bake from the same high-poly mesh and share UVs and cage settings."
  }
 ],
 "provenance": {
  "prose": "original text written for this index (research draft, editorially reviewed)",
  "sources_verified_at": "2026-11-29T15:51:27.588Z",
  "draft": "data/drafts/materials/curvature-map-baking.json"
 },
 "solves": [
  "need edge wear mask from a mesh",
  "dirt should collect in crevices and creases",
  "separate convex and concave areas for procedural texturing",
  "painted wear on corners without hand painting",
  "curvature map looks noisy or blocky"
 ],
 "authority": "Rusinkiewicz",
 "url": "https://texelatlas.vercel.app/t/curvature-map-baking/",
 "execution_fidelity": "conceptual-diagram",
 "fidelity_label": "Visual Diagram",
 "benchmark_eligible": false,
 "gpu_weight": {
  "weight_x": 11.12,
  "tier": "moderate",
  "p50_ms": 0.3659,
  "p95_ms": 0.3878,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 40,
  "preset_id": "curvature-laplacian-sdf",
  "execution_fidelity": "conceptual-diagram",
  "fidelity_label": "Visual Diagram",
  "benchmark_eligible": false,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 8.55,
   "tier": "moderate",
   "p50_ms": 0.1359,
   "p95_ms": 0.1417,
   "speedup_x": 2.69,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 6.88,
   "tier": "moderate",
   "p50_ms": 0.1982,
   "p95_ms": 0.202,
   "speedup_x": 1.85,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}