{
 "id": "watercolor-rendering-curtis",
 "title": "Computer-generated watercolor (fluid simulation)",
 "aliases": [],
 "domain": "npr",
 "subdomain": "watercolor",
 "stage": "material",
 "realtime": "offline",
 "platforms": [
  "cpu",
  "python"
 ],
 "year_introduced": 1997,
 "inputs": [
  "ldr-image",
  "texture"
 ],
 "outputs": [
  "ldr-image"
 ],
 "style": "stylized",
 "dynamic": "static",
 "summary": "Simulates pigment advection and deposition in a shallow water layer over paper, a physical model that reproduces wet-in-wet blooms, edge darkening and granulation.",
 "how_it_works": "The model treats a painting as layers of glazes. For each layer, a shallow fluid simulation moves water over a paper height field, while pigment is carried by the water velocity, deposited onto the paper and lifted back off depending on pigment properties. Capillary action spreads water into dry paper and creates feathery backruns. Paper texture affects flow and granulation, and edge darkening arises because pigment accumulates at the boundary of wet regions. Pigments have per-colour optical properties combined with a Kubelka-Munk style composition between layers. Because it is a simulation, it handles strokes drawn interactively and automatic conversion of photographs.",
 "when_to_use": "Choose it when physical plausibility of paint behaviour matters and runtime is acceptable offline or in an interactive paint tool. Prefer `watercolor-bousseau-realtime` for filtering 3D renders at real-time rates, and `anisotropic-kuwahara` for a cheap generic painterly look.",
 "cost": {
  "class": "offline",
  "notes": "Iterative fluid simulation per layer; offline or interactive on small canvases."
 },
 "failure_modes": [
  "Needs many tuned parameters per pigment and paper type",
  "Simulation state is hard to keep coherent in animation",
  "Compositing many glazes is slow",
  "Reproduces 2D paintings, not 3D scenes, without extra work"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "doi:10.1145/258734.258896",
   "type": "paper",
   "title": "Computer-generated watercolor",
   "authors": [
    "Cassidy J. Curtis",
    "Sean E. Anderson",
    "Joshua E. Seims",
    "Kurt W. Fleischer",
    "David H. Salesin"
   ],
   "year": 1997,
   "venue": "Proceedings of the 24th annual conference on Computer graphics and interactive techniques  - SIGGRAPH '97",
   "url": "https://doi.org/10.1145/258734.258896",
   "ids": {
    "doi": "10.1145/258734.258896"
   },
   "license": null,
   "extra": {
    "csl_type": "proceedings-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/258734.258896",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/258734.258896",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/258734.258896",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/258734.258896",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/258734.258896",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "curtis1997computer"
  }
 ],
 "presets": [
  {
   "id": "watercolor-rendering-curtis-live",
   "title": "Curtis watercolor pigment model — wet-edge darkening, paper valley granulation and glazing",
   "runtime": "glsl-fragment",
   "params": {
    "EDGE_DARKEN": 0.78,
    "GRANULATION": 0.58,
    "PAPER_GRAIN": 0.48,
    "WET_BLEED": 0.34
   },
   "basis": "original",
   "license_note": "MIT — written for this index",
   "code": "const float EDGE_DARKEN = 0.78; // P\nconst float GRANULATION = 0.58; // P\nconst float PAPER_GRAIN = 0.48; // P\nconst float WET_BLEED = 0.34; // P\n\nfloat hash(vec2 p) {\n  vec3 q = fract(vec3(p.xyx) * vec3(0.1031, 0.1030, 0.0973));\n  q += dot(q, q.yzx + 33.33);\n  return fract((q.x + q.y) * q.z);\n}\n\nfloat vnoise(vec2 p) {\n  vec2 i = floor(p), f = fract(p);\n  vec2 u = f * f * (3.0 - 2.0 * f);\n  return mix(\n    mix(hash(i), hash(i + vec2(1.0, 0.0)), u.x),\n    mix(hash(i + vec2(0.0, 1.0)), hash(i + vec2(1.0, 1.0)), u.x),\n    u.y\n  );\n}\n\nfloat fbm(vec2 p) {\n  float v = 0.0, a = 0.5;\n  mat2 m = mat2(0.8, 0.6, -0.6, 0.8);\n  for (int i = 0; i < 4; i++) {\n    v += a * vnoise(p);\n    p = m * p * 2.03;\n    a *= 0.5;\n  }\n  return v;\n}\n\n// Cold-press cotton paper heightfield (valleys trap heavier pigment particles)\nfloat paperHeight(vec2 uv) {\n  float coarse = fbm(uv * 28.0);\n  float fine = vnoise(uv * 115.0);\n  float tooth = 0.5 + 0.5 * sin(uv.x * 160.0 + coarse * 5.0) * cos(uv.y * 160.0 + fine * 4.0);\n  return clamp(0.55 * coarse + 0.30 * fine + 0.15 * tooth, 0.0, 1.0);\n}\n\n// Curtis et al. (1997) subtractive glaze: pigment density + capillary wet-edge rim + valley granulation\nvec3 applyGlaze(vec3 canvas, float sdf, vec3 absorbRGB, float baseConc, float paperH, vec2 uv) {\n  float bleed = max(WET_BLEED, 0.02);\n  float feather = fbm(uv * 9.5 + vec2(3.1, 1.7)) - 0.5;\n  float d = sdf + feather * bleed * 0.22;\n  float inside = smoothstep(0.012, -0.018, d);\n  if (inside < 0.001) return canvas;\n\n  // Capillary backrun concentrates pigment right along the dry boundary\n  float edgeDist = abs(d);\n  float rimPeak = exp(-edgeDist * edgeDist / max(0.00055 * (1.0 + bleed * 1.4), 1e-5));\n  float edgeTerm = 1.0 + max(EDGE_DARKEN, 0.0) * 1.45 * rimPeak;\n\n  // Granulation: heavy pigments settle into low paper valleys\n  float gran = mix(1.0, 1.55 - 1.15 * paperH, clamp(GRANULATION, 0.0, 1.5));\n  // Soft internal wet-in-wet flow mottling\n  float flow = 0.72 + 0.56 * fbm(uv * 5.5 + vec2(0.0, iTime * 0.08));\n  float thickness = baseConc * inside * edgeTerm * gran * flow;\n\n  // Kubelka-Munk / Beer-Lambert optical absorption glaze over previous layers\n  vec3 transmittance = exp(-absorbRGB * thickness * 2.2);\n  return canvas * transmittance;\n}\n\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n  vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;\n  vec2 drift = vec2(0.025 * cos(iTime * 0.35), 0.02 * sin(iTime * 0.28));\n  if (iMouse.z > 0.5 || length(iMouse.xy) > 1.0) {\n    drift = ((iMouse.xy - 0.5 * iResolution.xy) / iResolution.y) * 0.18;\n  }\n\n  float paperH = paperHeight(uv);\n  // Warm textured rag paper substrate\n  vec3 paper = vec3(0.965, 0.945, 0.895) * (1.0 - max(PAPER_GRAIN, 0.0) * 0.14 * (1.0 - paperH));\n  vec3 col = paper;\n\n  // Glaze 1: Prussian blue sky/mountain wash\n  float dBlue = length((uv - vec2(-0.16, 0.14) - drift * 0.5) * vec2(0.85, 1.15)) - 0.30;\n  col = applyGlaze(col, dBlue, vec3(1.45, 0.62, 0.18), 0.68, paperH, uv + vec2(1.2, 0.4));\n\n  // Glaze 2: Warm burnt sienna / cadmium ochre sun wash overlapping the blue\n  float dOchre = length((uv - vec2(0.18, 0.12) + drift * 0.6) * vec2(1.05, 0.92)) - 0.26;\n  col = applyGlaze(col, dOchre, vec3(0.14, 0.68, 1.55), 0.64, paperH, uv + vec2(-2.4, 1.8));\n\n  // Glaze 3: Viridian botanical wash across the lower foreground\n  vec2 gUv = uv - vec2(-0.04, -0.20) + drift * 0.3;\n  float dGreen = length(gUv * vec2(0.68, 1.38)) - 0.26;\n  col = applyGlaze(col, dGreen, vec3(1.28, 0.28, 0.72), 0.62, paperH, uv + vec2(4.1, -3.2));\n\n  // Glaze 4: Deep alizarin crimson petal accent with crisp wet-edge backrun\n  float dCrim = length((uv - vec2(0.12, -0.10) - drift * 0.4) * vec2(1.15, 0.85)) - 0.18;\n  col = applyGlaze(col, dCrim, vec3(0.18, 1.38, 1.05), 0.75, paperH, uv + vec2(-1.7, -2.5));\n\n  // Subtle warm paper lighting relief\n  float dx = paperHeight(uv + vec2(0.003, 0.0)) - paperH;\n  col *= 1.0 + dx * max(PAPER_GRAIN, 0.0) * 0.35;\n  fragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n}",
   "execution_fidelity": "conceptual-diagram",
   "proof": {
    "kind": "rendered",
    "label": "rendered 2026-11-30",
    "ok": true,
    "proof": {
     "ok": true,
     "technique": "watercolor-rendering-curtis",
     "runtime": "glsl-fragment",
     "checked_at": "2026-11-30T16:15:34.232Z",
     "renderer": "Chromium 145.0.7632.6 headless, WebGL2 via ANGLE/SwiftShader, 512×512, iTime=1.5",
     "stats": {
      "mean": 0.5331,
      "std": 0.3306,
      "unique_colors": 564
     },
     "image": "/specimens/watercolor-rendering-curtis-live.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "watercolor-bousseau-realtime",
  "anisotropic-kuwahara",
  "stroke-based-rendering"
 ],
 "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/watercolor-rendering-curtis.json"
 },
 "solves": [
  "make rendering look like a watercolor painting",
  "pigment bleeding and paper texture effects",
  "stylize images with layered translucent washes",
  "physically inspired artistic paint simulation"
 ],
 "authority": "Curtis et al., 1997",
 "url": "https://texelatlas.vercel.app/t/watercolor-rendering-curtis/",
 "execution_fidelity": "conceptual-diagram",
 "fidelity_label": "Visual Diagram",
 "benchmark_eligible": false,
 "gpu_weight": {
  "weight_x": 56.33,
  "tier": "heavy",
  "p50_ms": 1.8534,
  "p95_ms": 2.1882,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 40,
  "preset_id": "watercolor-rendering-curtis-live",
  "execution_fidelity": "conceptual-diagram",
  "fidelity_label": "Visual Diagram",
  "benchmark_eligible": false,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 49.17,
   "tier": "heavy",
   "p50_ms": 0.7818,
   "p95_ms": 0.7906,
   "speedup_x": 2.37,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 37.74,
   "tier": "heavy",
   "p50_ms": 1.087,
   "p95_ms": 1.0887,
   "speedup_x": 1.71,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}