{
 "id": "weathering-simulation",
 "title": "Weathering simulation (weathered stone)",
 "aliases": [],
 "domain": "materials",
 "subdomain": "procedural texturing",
 "stage": "material",
 "realtime": "offline",
 "platforms": [
  "cpu",
  "houdini",
  "blender",
  "python"
 ],
 "year_introduced": 1999,
 "inputs": [
  "mesh",
  "texture"
 ],
 "outputs": [
  "texture",
  "material-params"
 ],
 "style": "photoreal",
 "dynamic": "static",
 "summary": "Physically motivated ageing of surfaces: water flow, dust and salt deposition and erosion are simulated on the mesh to produce stains, crusts and wear that follow geometry and exposure rather than random noise.",
 "how_it_works": "Dorsey et al. model stone as a slab of layers with a water-transport simulation. Rainwater flows over the surface following gravity and exposure; where water seeps in it dissolves and transports minerals and, depending on the wetness and the saturation, deposits them in layers or erodes material. Surface and subsurface moisture are tracked on a volumetric grid (slab) beneath each surface point, and weathering creates stains, crusts (gypsum), erosion and discolouration. Appearance is rendered with subsurface-scattering since weathered stone is translucent and layered. Later work (gamma-ton tracing, Chen et al. 2005) replaces the fluid simulation with particle tracing, a stochastic transport of weathering agents across the surface, which handles dust, rust, moss and peeling paint in much less time.",
 "when_to_use": "Choose it when weathering must respond to geometry, orientation and exposure: ruins, monuments, rusting machinery. Prefer curvature- and AO-driven procedural masks in material shaders when you need a fast approximation in real-time. Prefer `procedural-noise-texturing` for unstructured variation, and `image-quilting` to extend a scanned weathered exemplar.",
 "cost": {
  "class": "offline",
  "notes": "Simulation runs offline on a mesh or voxel grid; results are baked to textures."
 },
 "failure_modes": [
  "Needs a watertight, well-tessellated mesh and parameter tuning per material",
  "Simulation time and memory scale with grid resolution",
  "Results look plausible but are not predictive of real ageing",
  "Artist control is indirect; fixing one stain requires re-running the simulation"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "doi:10.1145/311535.311560",
   "type": "paper",
   "title": "Modeling and rendering of weathered stone",
   "authors": [
    "Julie Dorsey",
    "Alan Edelman",
    "Henrik Wann Jensen",
    "Justin Legakis",
    "Hans Køhling Pedersen"
   ],
   "year": 1999,
   "venue": "Proceedings of the 26th annual conference on Computer graphics and interactive techniques  - SIGGRAPH '99",
   "url": "https://doi.org/10.1145/311535.311560",
   "ids": {
    "doi": "10.1145/311535.311560"
   },
   "license": null,
   "extra": {
    "csl_type": "proceedings-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/311535.311560",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/311535.311560",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/311535.311560",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/311535.311560",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/311535.311560",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "dorsey1999modeling"
  },
  {
   "role": "primary",
   "key": "doi:10.1145/1073204.1073321",
   "type": "paper",
   "title": "Visual simulation of weathering by γ-ton tracing",
   "authors": [
    "Yanyun Chen",
    "Lin Xia",
    "Tien-Tsin Wong",
    "Xin Tong",
    "Hujun Bao",
    "Baining Guo",
    "Heung-Yeung Shum"
   ],
   "year": 2005,
   "venue": "ACM Transactions on Graphics",
   "url": "https://doi.org/10.1145/1073204.1073321",
   "ids": {
    "doi": "10.1145/1073204.1073321"
   },
   "license": null,
   "extra": {
    "csl_type": "journal-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1073204.1073321",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1073204.1073321",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1073204.1073321",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1073204.1073321",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1073204.1073321",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "chen2005visual"
  }
 ],
 "presets": [
  {
   "id": "weathering-simulation-live",
   "title": "Stone Weathering Simulation — fresh carved limestone (left) vs moss, rain streaks & edge erosion (right)",
   "runtime": "glsl-fragment",
   "params": {
    "P_AGE_YEARS": 0.78,
    "P_MOSS_WET": 0.82,
    "P_RAIN_STREAK": 0.85,
    "P_SPLIT": 0.46
   },
   "basis": "original",
   "license_note": "MIT — written for this index.",
   "code": "const float P_AGE_YEARS = 0.78; // P Weathering Age [0.05, 1.0, 0.02]\nconst float P_MOSS_WET = 0.82; // P Moss & Moisture [0.0, 1.4, 0.04]\nconst float P_RAIN_STREAK = 0.85; // P Rain Wash Streaks [0.0, 1.5, 0.05]\nconst float P_SPLIT = 0.46; // P Fresh / Weathered [0.0, 1.0, 0.02]\n\nmat2 rot2(float a) { float c = cos(a), s = sin(a); return mat2(c, -s, s, c); }\n\nfloat hash21(vec2 p) {\n  p = fract(p * vec2(127.1, 311.7));\n  p += dot(p, p + 34.5);\n  return fract(p.x * p.y);\n}\n\nfloat vnoise(vec2 p) {\n  vec2 i = floor(p);\n  vec2 f = fract(p);\n  vec2 u = f * f * (3.0 - 2.0 * f);\n  return mix(\n    mix(hash21(i), hash21(i + vec2(1.0, 0.0)), u.x),\n    mix(hash21(i + vec2(0.0, 1.0)), hash21(i + vec2(1.0, 1.0)), u.x),\n    u.y\n  );\n}\n\nfloat fbm(vec2 p) {\n  float a = 0.5, s = 0.0;\n  for (int i = 0; i < 4; i++) {\n    s += a * vnoise(p);\n    p = p * 2.04 + vec2(13.7, 7.3);\n    a *= 0.5;\n  }\n  return s;\n}\n\nfloat sdBox(vec3 p, vec3 b) {\n  vec3 q = abs(p) - b;\n  return length(max(q, 0.0)) + min(max(q.x, max(q.y, q.z)), 0.0);\n}\n\n// Architectural stone balustrade / temple shrine plinth\nfloat mapStone(vec3 p, float erodeAmt) {\n  float base = sdBox(p - vec3(0.0, -0.52, 0.0), vec3(0.76, 0.16, 0.52)) - 0.02;\n  float colL = sdBox(p - vec3(-0.44, 0.02, 0.0), vec3(0.18, 0.42, 0.24)) - 0.02;\n  float colR = sdBox(p - vec3(0.44, 0.02, 0.0), vec3(0.18, 0.42, 0.24)) - 0.02;\n  float lintel = sdBox(p - vec3(0.0, 0.52, 0.0), vec3(0.72, 0.14, 0.34)) - 0.02;\n  float d = min(min(base, lintel), min(colL, colR));\n  // Subtle physical stone chipping & surface pitting increases with age\n  float pit = (fbm(p.xy * 7.5 + p.z * 3.1) - 0.5) * 0.028 * erodeAmt;\n  return (d + pit) * 0.85;\n}\n\nvec3 calcNormal(vec3 p, float erodeAmt) {\n  vec2 e = vec2(0.0025, 0.0);\n  return normalize(vec3(\n    mapStone(p + e.xyy, erodeAmt) - mapStone(p - e.xyy, erodeAmt),\n    mapStone(p + e.yxy, erodeAmt) - mapStone(p - e.yxy, erodeAmt),\n    mapStone(p + e.yyx, erodeAmt) - mapStone(p - e.yyx, erodeAmt)\n  ));\n}\n\nvec3 aces(vec3 x) {\n  x = max(x, 0.0);\n  return (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);\n}\n\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n  vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;\n  float screenX = fragCoord.x / max(iResolution.x, 1.0);\n  float split = clamp(P_SPLIT, 0.0, 1.0);\n  bool isWeathered = screenX >= split;\n  float age = clamp(P_AGE_YEARS, 0.05, 1.0);\n  float mossGain = clamp(P_MOSS_WET, 0.0, 1.5);\n  float streakGain = clamp(P_RAIN_STREAK, 0.0, 1.6);\n\n  float spin = sin(iTime * 0.38) * 0.42;\n  vec3 ro = vec3(0.0, 0.16, 2.38);\n  vec3 rd = normalize(vec3(uv - vec2(0.0, 0.03), -1.48));\n  ro.xz = rot2(spin) * ro.xz;\n  rd.xz = rot2(spin) * rd.xz;\n\n  vec3 col = mix(vec3(0.030, 0.036, 0.052), vec3(0.075, 0.092, 0.128), smoothstep(-0.55, 0.55, uv.y));\n  float erodeAmt = isWeathered ? age : 0.05;\n\n  float t = 0.0;\n  bool hit = false;\n  for (int i = 0; i < 60; i++) {\n    float d = mapStone(ro + rd * t, erodeAmt);\n    if (d < 0.0025) { hit = true; break; }\n    t += d;\n    if (t > 6.0) break;\n  }\n\n  if (hit) {\n    vec3 p = ro + rd * t;\n    vec3 n = calcNormal(p, erodeAmt);\n    vec3 lDir = normalize(vec3(0.62, 0.78, 0.52));\n    float diff = max(dot(n, lDir), 0.0);\n    float spec = pow(max(dot(n, normalize(lDir - rd)), 0.0), 22.0);\n\n    // Multi-scale ambient occlusion / crevice accessibility & convex edge curvature\n    float dNear = mapStone(p + n * 0.08, erodeAmt);\n    float dMid = mapStone(p + n * 0.22, erodeAmt);\n    float ao = clamp(0.32 + 0.68 * (dNear / 0.08 * 0.5 + dMid / 0.22 * 0.5), 0.18, 1.0);\n    float crevice = clamp(1.0 - ao, 0.0, 1.0);\n    float edgeWear = clamp((dNear - 0.078) * 18.0, 0.0, 1.0);\n\n    // Base fresh warm limestone\n    float grain = fbm(p.xy * 12.0 + p.z * 5.0);\n    vec3 stoneAlb = mix(vec3(0.76, 0.72, 0.64), vec3(0.88, 0.84, 0.76), grain);\n\n    if (isWeathered) {\n      // 1) Gravity-driven vertical rain-runoff stains & calcium carbonate leaching streaks under lintel!\n      float streakNoise = fbm(vec2(p.x * 16.0 + p.z * 9.0, p.y * 2.2));\n      float underLintel = smoothstep(0.55, 0.32, p.y) * smoothstep(-0.55, 0.35, p.y) * (1.0 - abs(n.y));\n      float streaks = smoothstep(0.42, 0.72, streakNoise) * underLintel * streakGain * age;\n\n      // 2) Upward-facing & damp-crevice biological moss colonization\n      float mossNoise = fbm(p.xz * 9.0 + p.y * 4.0);\n      float mossMask = smoothstep(0.38, 0.72, n.y * 0.65 + crevice * 0.75 + mossNoise * 0.45 - 0.32) * mossGain * age;\n      mossMask = clamp(mossMask, 0.0, 1.0);\n\n      // 3) Soot/dirt darkening inside recessed crevices + pale leached limestone on exposed convex edges\n      stoneAlb = mix(stoneAlb, vec3(0.24, 0.22, 0.20), clamp(crevice * 0.85 * age + streaks * 0.62, 0.0, 0.85));\n      stoneAlb = mix(stoneAlb, vec3(0.92, 0.90, 0.84), edgeWear * 0.55 * age);\n      vec3 mossCol = mix(vec3(0.14, 0.34, 0.12), vec3(0.34, 0.54, 0.16), mossNoise);\n      stoneAlb = mix(stoneAlb, mossCol, mossMask);\n      // Damp glossy sheen along rain runoff channels\n      spec *= (0.65 + 1.45 * streaks);\n    }\n\n    col = stoneAlb * (0.24 + 0.84 * diff) * ao + vec3(0.96, 0.94, 0.90) * spec * 0.22;\n  }\n\n  float sep = smoothstep(0.0035, 0.0008, abs(screenX - split));\n  col = mix(col, vec3(0.95, 0.97, 1.0), sep);\n\n  fragColor = vec4(pow(clamp(aces(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": "weathering-simulation",
     "runtime": "glsl-fragment",
     "checked_at": "2026-11-30T20:35:59.000Z",
     "renderer": "Headless EGL Tesla T4/PCIe/SSE2, OpenGL 3.30 Core, 512×512, iTime=1.5",
     "stats": {
      "mean": 0.6481,
      "std": 0.196,
      "min": 0.1851,
      "max": 0.9014
     },
     "image": "/specimens/weathering-simulation-live.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "procedural-noise-texturing",
  "image-quilting"
 ],
 "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/materials/weathering-simulation.json"
 },
 "solves": [
  "stone surfaces look too clean and new",
  "need realistic aging and water stains on buildings",
  "procedural dirt and erosion on materials",
  "make models look weathered over time"
 ],
 "authority": "Dorsey et al., 1999",
 "url": "https://texelatlas.vercel.app/t/weathering-simulation/",
 "execution_fidelity": "conceptual-diagram",
 "fidelity_label": "Visual Diagram",
 "benchmark_eligible": false,
 "gpu_weight": {
  "weight_x": 100.14,
  "tier": "extreme",
  "p50_ms": 3.2947,
  "p95_ms": 3.5439,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 32,
  "preset_id": "weathering-simulation-live",
  "execution_fidelity": "conceptual-diagram",
  "fidelity_label": "Visual Diagram",
  "benchmark_eligible": false,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 87.77,
   "tier": "extreme",
   "p50_ms": 1.3955,
   "p95_ms": 1.4057,
   "speedup_x": 2.36,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 70.93,
   "tier": "extreme",
   "p50_ms": 2.0429,
   "p95_ms": 2.0755,
   "speedup_x": 1.61,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}