{
 "id": "screen-space-fluid-rendering",
 "title": "Screen-space fluid rendering (curvature flow)",
 "aliases": [
  "particle fluid surface smoothing",
  "screen-space surface reconstruction for fluids",
  "curvature flow smoothing"
 ],
 "domain": "volumes",
 "subdomain": "particle fluid rendering",
 "stage": "volume",
 "realtime": "realtime",
 "platforms": [
  "webgl2",
  "webgpu",
  "desktop-gpu",
  "unity",
  "unreal"
 ],
 "year_introduced": 2009,
 "inputs": [
  "particles",
  "depth"
 ],
 "outputs": [
  "ldr-image",
  "normals"
 ],
 "style": "photoreal",
 "dynamic": "dynamic",
 "summary": "Render particle fluids without building a mesh: splat particles as spheres into a depth image, smooth that depth with curvature flow, reconstruct normals and shade it as a refractive liquid with thickness and foam.",
 "how_it_works": "Particles from [sph-fluids](sph-fluids), [position-based-fluids](position-based-fluids) or [flip-pic-fluids](flip-pic-fluids) are drawn as point sprites that write the depth of a sphere surface (not a flat disc) into a depth texture. The result is bumpy, one bump per particle.\n\nTo make it look like a continuous surface, the depth buffer is smoothed in screen space. Curvature flow evolves depth in the direction of mean curvature, which smooths bumps while preserving silhouettes, and it takes a few iterations. Simple alternatives are a bilateral or narrow-range blur that avoids blurring across depth discontinuities.\n\nNormals are reconstructed from the smoothed depth. A second pass accumulates particle thickness additively. Shading then uses these buffers: Fresnel reflection of the environment, refraction offset by normal, Beer–Lambert absorption from thickness, plus specular highlights and optional foam from velocity or density. Only the front surface is represented.",
 "when_to_use": "Choose it for real-time rendering of large particle fluids in games and interactive tools, where meshing every frame is too expensive.\n\nPrefer [marching-cubes](marching-cubes) or [surface-nets](surface-nets) on a density grid when you need a real mesh for physics, caustics or offline rendering. Prefer [volume-ray-marching](volume-ray-marching) for smoke, foam-like or translucent media with interior variation. Prefer [shallow-water-equations](shallow-water-equations) or [fft-ocean](fft-ocean) for large open water surfaces rather than free particle volumes. Combine with [water-caustics-realtime](water-caustics-realtime) for light patterns.",
 "cost": {
  "class": "medium",
  "notes": "Cost is dominated by the number of smoothing iterations and the splat fill rate; roughly independent of scene geometry."
 },
 "failure_modes": [
  "Only the nearest surface exists, so back faces, internal bubbles and refraction of other fluid layers are missing",
  "Blur across silhouettes makes thin streams merge or lose the gap between droplets",
  "Over-smoothing flattens splash detail, while under-smoothing shows individual particle beads",
  "Particle size must match spacing; large gaps produce sparse speckled surfaces",
  "Thickness-based absorption fails for non-convex volumes where thick regions are not along the view ray",
  "Screen-space result changes with camera distance since the filter radius is in pixels unless depth-scaled"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "doi:10.1145/1507149.1507164",
   "type": "paper",
   "title": "Screen space fluid rendering with curvature flow",
   "authors": [
    "Wladimir J. van der Laan",
    "Simon Green",
    "Miguel Sainz"
   ],
   "year": 2009,
   "venue": "Proceedings of the 2009 symposium on Interactive 3D graphics and games",
   "url": "https://doi.org/10.1145/1507149.1507164",
   "ids": {
    "doi": "10.1145/1507149.1507164"
   },
   "license": null,
   "extra": {
    "csl_type": "proceedings-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1507149.1507164",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1507149.1507164",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1507149.1507164",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1507149.1507164",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1507149.1507164",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "laan2009screen"
  },
  {
   "role": "talk",
   "key": "url:https://developer.download.nvidia.com/presentations/2010/gdc/Direct3D_Effects.pdf",
   "type": "talk",
   "title": "Direct3D 11 effects (includes screen-space fluid rendering)",
   "authors": [
    "Simon Green"
   ],
   "year": null,
   "venue": "GDC 2010",
   "url": "https://developer.download.nvidia.com/presentations/2010/gdc/Direct3D_Effects.pdf",
   "ids": {},
   "license": null,
   "extra": {
    "http_status": 200,
    "live": true,
    "archive": {
     "url": "http://web.archive.org/web/20260827064751/https://developer.download.nvidia.com/presentations/2010/gdc/Direct3D_Effects.pdf",
     "timestamp": "20260827064751"
    },
    "page_title": null,
    "host": "developer.download.nvidia.com",
    "title_confirmed_by_page": false,
    "title_unconfirmed": false
   },
   "provenance": {
    "title": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "http",
     "endpoint": "GET https://developer.download.nvidia.com/presentations/2010/gdc/Direct3D_Effects.pdf → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": null,
   "__bib": "greendirect3d"
  }
 ],
 "presets": [
  {
   "id": "ssfr-starting-params",
   "title": "Screen-space fluid starting parameters",
   "runtime": "json-params",
   "params": {
    "particle_radius_to_spacing": 1,
    "smoothing_iterations": 40,
    "curvature_flow_dt": 0.0005,
    "depth_clamp_max_pixels": 8,
    "thickness_absorption_rgb": [
     0.4,
     0.1,
     0.05
    ],
    "fresnel_f0": 0.02,
    "refraction_scale": 0.05
   },
   "basis": "original",
   "license_note": "parameter preset, sensible defaults chosen for this index",
   "execution_fidelity": "parameter-only",
   "proof": {
    "kind": "parameter",
    "label": "parameter preset",
    "ok": true,
    "proof": null
   }
  },
  {
   "id": "screen-space-fluid-rendering-live",
   "title": "Screen-Space Fluid Rendering — raw splatted particle spheres (left) vs curvature-flow smoothed refractive liquid (right)",
   "runtime": "glsl-fragment",
   "params": {
    "P_CURV_FLOW": 0.88,
    "P_ABSORB_DEPTH": 1.25,
    "P_FLOW_SPEED": 0.95,
    "P_SPLIT": 0.48
   },
   "basis": "original",
   "license_note": "MIT — written for this index.",
   "code": "const float P_CURV_FLOW = 0.88; // P Curvature Smoothing [0.0, 1.0, 0.05]\nconst float P_ABSORB_DEPTH = 1.25; // P Beer-Lambert Depth [0.3, 2.5, 0.1]\nconst float P_FLOW_SPEED = 0.95; // P Pour Speed [0.0, 2.0, 0.05]\nconst float P_SPLIT = 0.48; // P Particles / Fluid Split [0.0, 1.0, 0.02]\n\n// Procedural pouring stream of 26 animated 3D fluid particles arcing into a swirling basin\nvec3 getParticlePos(int i, float t) {\n  float fi = float(i);\n  if (i < 12) {\n    // Pouring stream arc from upper-left spout into basin center\n    float ph = fract(t * 0.32 + fi / 12.0);\n    float x = mix(-0.78, 0.08, ph) + 0.03 * sin(fi * 4.1 + t * 3.0);\n    float y = 0.48 - 0.86 * ph * ph + 0.03 * cos(fi * 3.3);\n    float z = 0.06 * sin(fi * 2.7 + t * 2.0);\n    return vec3(x, y, z);\n  }\n  // Swirling turbulent basin pool particles\n  float j = fi - 12.0;\n  float ang = j * 0.45 + t * 1.15;\n  float rad = 0.12 + 0.44 * fract(j * 0.37);\n  float x = cos(ang) * rad + 0.16;\n  float y = -0.36 + 0.065 * sin(ang * 2.0 + t * 2.5);\n  float z = sin(ang) * rad * 0.65;\n  return vec3(x, y, z);\n}\n\nfloat smin(float a, float b, float k) {\n  float h = clamp(0.5 + 0.5 * (b - a) / max(k, 1e-4), 0.0, 1.0);\n  return mix(b, a, h) - k * h * (1.0 - h);\n}\n\n// Evaluate either raw unsmoothed spheres (left) or curvature-flow smoothed liquid iso-surface (right)\nfloat mapFluid(vec3 p, float t, float smoothK, bool smoothed) {\n  float d = 1e5;\n  float r = smoothed ? 0.145 : 0.115;\n  float k = smoothed ? (0.16 * smoothK + 0.03) : 0.001;\n  for (int i = 0; i < 26; i++) {\n    vec3 c = getParticlePos(i, t);\n    float ds = length(p - c) - r;\n    d = smoothed ? smin(d, ds, k) : min(d, ds);\n  }\n  return d;\n}\n\nvec3 calcNormal(vec3 p, float t, float smoothK, bool smoothed) {\n  vec2 e = vec2(0.003, 0.0);\n  return normalize(vec3(\n    mapFluid(p + e.xyy, t, smoothK, smoothed) - mapFluid(p - e.xyy, t, smoothK, smoothed),\n    mapFluid(p + e.yxy, t, smoothK, smoothed) - mapFluid(p - e.yxy, t, smoothK, smoothed),\n    mapFluid(p + e.yyx, t, smoothK, smoothed) - mapFluid(p - e.yyx, t, smoothK, smoothed)\n  ));\n}\n\nvec3 evalPoolBackdrop(vec3 rd) {\n  vec2 g = floor(rd.xy * 11.0);\n  vec3 tile = mix(vec3(0.10, 0.14, 0.20), vec3(0.18, 0.24, 0.32), mod(g.x + g.y, 2.0));\n  return mix(tile, vec3(0.32, 0.52, 0.78), smoothstep(0.0, 0.75, rd.y));\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 sx = fragCoord.x / max(iResolution.x, 1.0);\n  float split = clamp(P_SPLIT, 0.0, 1.0);\n  bool showFluid = sx >= split;\n\n  float smoothK = clamp(P_CURV_FLOW, 0.0, 1.2);\n  float absorb = clamp(P_ABSORB_DEPTH, 0.2, 3.0);\n  float tAnim = iTime * max(P_FLOW_SPEED, 0.0);\n\n  vec3 ro = vec3(0.0, 0.18, 2.22);\n  vec3 rd = normalize(vec3(uv, -1.48));\n  vec3 col = evalPoolBackdrop(rd);\n\n  float t = 0.05;\n  bool hit = false;\n  for (int i = 0; i < 60; i++) {\n    float d = mapFluid(ro + rd * t, tAnim, smoothK, showFluid);\n    if (d < 0.0025) { hit = true; break; }\n    t += d * 0.85;\n    if (t > 5.5) break;\n  }\n\n  if (hit) {\n    vec3 p = ro + rd * t;\n    vec3 n = calcNormal(p, tAnim, smoothK, showFluid);\n    vec3 v = -rd;\n    vec3 L = normalize(vec3(0.55, 0.82, 0.58));\n    vec3 H = normalize(L + v);\n\n    if (!showFluid) {\n      // Left: Raw splatted particle spheres shaded directly (classic bumpy \"ball pit\" prior to curvature flow)\n      float ndl = max(dot(n, L), 0.0);\n      float spec = pow(max(dot(n, H), 0.0), 36.0);\n      col = vec3(0.16, 0.52, 0.84) * (0.28 + 0.82 * ndl) + vec3(0.95, 0.98, 1.0) * spec * 0.65;\n    } else {\n      // Right: Screen-space fluid rendering with reconstructed smooth normals, Beer-Lambert thickness absorption, refraction & crest foam!\n      // Estimate fluid optical thickness along view ray via 4-step interior march\n      float thick = 0.0;\n      for (int s = 1; s <= 4; s++) {\n        float ds = mapFluid(p + rd * (float(s) * 0.09), tAnim, smoothK, true);\n        thick += clamp(-ds * 4.2, 0.0, 1.0) * 0.25;\n      }\n      vec3 refrDir = refract(rd, n, 1.0 / 1.333);\n      vec3 reflDir = reflect(rd, n);\n      vec3 refrBg = evalPoolBackdrop(refrDir);\n      vec3 trans = exp(-vec3(0.75, 0.22, 0.08) * thick * absorb * 3.8);\n      vec3 reflCol = mix(vec3(0.28, 0.54, 0.84), vec3(0.95, 0.98, 1.0), smoothstep(-0.1, 0.7, reflDir.y));\n      float fres = 0.03 + 0.94 * pow(1.0 - max(dot(n, v), 0.0), 4.5);\n      float spec = pow(max(dot(n, H), 0.0), 96.0) * 2.4;\n      // Aerated foam along fast-moving upper crests\n      float foam = smoothstep(0.08, 0.42, p.y + 0.25 * n.y) * smoothstep(0.18, 0.02, thick) * 0.45;\n      col = mix(refrBg * trans + vec3(0.04, 0.24, 0.34) * (1.0 - trans), reflCol, fres) + vec3(1.0) * (spec + foam);\n    }\n  }\n\n  float sep = smoothstep(0.0035, 0.0008, abs(sx - split));\n  col = mix(col, vec3(0.95, 0.97, 1.0), sep);\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": "screen-space-fluid-rendering",
     "runtime": "glsl-fragment",
     "checked_at": "2026-11-30T21:07:24.000Z",
     "renderer": "Headless EGL Tesla T4/PCIe/SSE2, OpenGL 3.30 Core, 512×512, iTime=1.5",
     "stats": {
      "mean": 0.596,
      "std": 0.0977,
      "min": 0.4431,
      "max": 0.9728
     },
     "image": "/specimens/screen-space-fluid-rendering-live.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "sph-fluids",
  "position-based-fluids",
  "flip-pic-fluids",
  "marching-cubes",
  "water-caustics-realtime",
  "volume-ray-marching"
 ],
 "extends": [],
 "supersedes": [],
 "combines_with": [
  {
   "id": "position-based-fluids",
   "why": "Particle positions from the solver are splatted as the input depth and thickness images."
  },
  {
   "id": "water-caustics-realtime",
   "why": "Reconstructed screen-space normals and thickness can drive projected caustics on receiving surfaces."
  },
  {
   "id": "temporal-anti-aliasing",
   "why": "Temporal accumulation hides the flicker of per-particle depth bumps."
  }
 ],
 "provenance": {
  "prose": "original text written for this index (research draft, editorially reviewed)",
  "sources_verified_at": "2026-11-29T15:51:27.588Z",
  "draft": "data/drafts/volumes/screen-space-fluid-rendering.json"
 },
 "solves": [
  "rendering thousands of fluid particles without meshing",
  "particles look like beads instead of a smooth liquid",
  "need a real time water look for sph particles",
  "want refraction and thickness absorption on particle fluid"
 ],
 "authority": "Laan et al., 2009",
 "url": "https://texelatlas.vercel.app/t/screen-space-fluid-rendering/",
 "execution_fidelity": "conceptual-diagram",
 "fidelity_label": "Visual Diagram",
 "benchmark_eligible": false,
 "gpu_weight": {
  "weight_x": 205.08,
  "tier": "extreme",
  "p50_ms": 6.747,
  "p95_ms": 6.8411,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 32,
  "preset_id": "screen-space-fluid-rendering-live",
  "execution_fidelity": "conceptual-diagram",
  "fidelity_label": "Visual Diagram",
  "benchmark_eligible": false,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 174.89,
   "tier": "extreme",
   "p50_ms": 2.7807,
   "p95_ms": 2.8319,
   "speedup_x": 2.43,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 150.43,
   "tier": "extreme",
   "p50_ms": 4.3325,
   "p95_ms": 4.3883,
   "speedup_x": 1.56,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}