Screen-space fluid rendering (curvature flow)
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.
Also known as particle fluid surface smoothing, screen-space surface reconstruction for fluids, curvature flow smoothing
In the family Atmosphere, water & volumes, particle fluid rendering
Where it runs
Built inOfficial add-onPluginNone foundNot researched
| Engine | Support | How |
|---|---|---|
| three.js r187 | None found | |
| Babylon.js 9.38.0 | Built in | new FluidRenderer(scene); fluidRenderer.addParticleSystem(...) docs |
| Godot 4.7 | None found | |
| Unity | None found | |
| Unreal 5.7 | None found | |
| Blender 5.2 | None found | |
| WebGPU W3C | None found | |
| Metal | None found |
How it works
Particles from Smoothed Particle Hydrodynamics (fluids), Position Based Fluids or 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.
To 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.
Normals 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 choose it
Reach for it when
- 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
Choose it for real-time rendering of large particle fluids in games and interactive tools, where meshing every frame is too expensive.
Prefer Marching Cubes or Surface Nets on a density grid when you need a real mesh for physics, caustics or offline rendering. Prefer Ray-marched Participating Media for smoke, foam-like or translucent media with interior variation. Prefer Shallow Water Equations (Height-field Water) or FFT Ocean (Tessendorf) for large open water surfaces rather than free particle volumes. Combine with Real-time Water Caustics for light patterns.
Field marks
- 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
Presets
Screen-space fluid starting parameters
{
"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
}Attribution: parameter preset, sensible defaults chosen for this index
Screen-Space Fluid Rendering — raw splatted particle spheres (left) vs curvature-flow smoothed refractive liquid (right)
{
"P_CURV_FLOW": 0.88,
"P_ABSORB_DEPTH": 1.25,
"P_FLOW_SPEED": 0.95,
"P_SPLIT": 0.48
}Show GLSL (124 lines)
const float P_CURV_FLOW = 0.88; // P Curvature Smoothing [0.0, 1.0, 0.05]
const float P_ABSORB_DEPTH = 1.25; // P Beer-Lambert Depth [0.3, 2.5, 0.1]
const float P_FLOW_SPEED = 0.95; // P Pour Speed [0.0, 2.0, 0.05]
const float P_SPLIT = 0.48; // P Particles / Fluid Split [0.0, 1.0, 0.02]
// Procedural pouring stream of 26 animated 3D fluid particles arcing into a swirling basin
vec3 getParticlePos(int i, float t) {
float fi = float(i);
if (i < 12) {
// Pouring stream arc from upper-left spout into basin center
float ph = fract(t * 0.32 + fi / 12.0);
float x = mix(-0.78, 0.08, ph) + 0.03 * sin(fi * 4.1 + t * 3.0);
float y = 0.48 - 0.86 * ph * ph + 0.03 * cos(fi * 3.3);
float z = 0.06 * sin(fi * 2.7 + t * 2.0);
return vec3(x, y, z);
}
// Swirling turbulent basin pool particles
float j = fi - 12.0;
float ang = j * 0.45 + t * 1.15;
float rad = 0.12 + 0.44 * fract(j * 0.37);
float x = cos(ang) * rad + 0.16;
float y = -0.36 + 0.065 * sin(ang * 2.0 + t * 2.5);
float z = sin(ang) * rad * 0.65;
return vec3(x, y, z);
}
float smin(float a, float b, float k) {
float h = clamp(0.5 + 0.5 * (b - a) / max(k, 1e-4), 0.0, 1.0);
return mix(b, a, h) - k * h * (1.0 - h);
}
// Evaluate either raw unsmoothed spheres (left) or curvature-flow smoothed liquid iso-surface (right)
float mapFluid(vec3 p, float t, float smoothK, bool smoothed) {
float d = 1e5;
float r = smoothed ? 0.145 : 0.115;
float k = smoothed ? (0.16 * smoothK + 0.03) : 0.001;
for (int i = 0; i < 26; i++) {
vec3 c = getParticlePos(i, t);
float ds = length(p - c) - r;
d = smoothed ? smin(d, ds, k) : min(d, ds);
}
return d;
}
vec3 calcNormal(vec3 p, float t, float smoothK, bool smoothed) {
vec2 e = vec2(0.003, 0.0);
return normalize(vec3(
mapFluid(p + e.xyy, t, smoothK, smoothed) - mapFluid(p - e.xyy, t, smoothK, smoothed),
mapFluid(p + e.yxy, t, smoothK, smoothed) - mapFluid(p - e.yxy, t, smoothK, smoothed),
mapFluid(p + e.yyx, t, smoothK, smoothed) - mapFluid(p - e.yyx, t, smoothK, smoothed)
));
}
vec3 evalPoolBackdrop(vec3 rd) {
vec2 g = floor(rd.xy * 11.0);
vec3 tile = mix(vec3(0.10, 0.14, 0.20), vec3(0.18, 0.24, 0.32), mod(g.x + g.y, 2.0));
return mix(tile, vec3(0.32, 0.52, 0.78), smoothstep(0.0, 0.75, rd.y));
}
vec3 aces(vec3 x) {
x = max(x, 0.0);
return (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
float sx = fragCoord.x / max(iResolution.x, 1.0);
float split = clamp(P_SPLIT, 0.0, 1.0);
bool showFluid = sx >= split;
float smoothK = clamp(P_CURV_FLOW, 0.0, 1.2);
float absorb = clamp(P_ABSORB_DEPTH, 0.2, 3.0);
float tAnim = iTime * max(P_FLOW_SPEED, 0.0);
vec3 ro = vec3(0.0, 0.18, 2.22);
vec3 rd = normalize(vec3(uv, -1.48));
vec3 col = evalPoolBackdrop(rd);
float t = 0.05;
bool hit = false;
for (int i = 0; i < 60; i++) {
float d = mapFluid(ro + rd * t, tAnim, smoothK, showFluid);
if (d < 0.0025) { hit = true; break; }
t += d * 0.85;
if (t > 5.5) break;
}
if (hit) {
vec3 p = ro + rd * t;
vec3 n = calcNormal(p, tAnim, smoothK, showFluid);
vec3 v = -rd;
vec3 L = normalize(vec3(0.55, 0.82, 0.58));
vec3 H = normalize(L + v);
if (!showFluid) {
// Left: Raw splatted particle spheres shaded directly (classic bumpy "ball pit" prior to curvature flow)
float ndl = max(dot(n, L), 0.0);
float spec = pow(max(dot(n, H), 0.0), 36.0);
col = vec3(0.16, 0.52, 0.84) * (0.28 + 0.82 * ndl) + vec3(0.95, 0.98, 1.0) * spec * 0.65;
} else {
// Right: Screen-space fluid rendering with reconstructed smooth normals, Beer-Lambert thickness absorption, refraction & crest foam!
// Estimate fluid optical thickness along view ray via 4-step interior march
float thick = 0.0;
for (int s = 1; s <= 4; s++) {
float ds = mapFluid(p + rd * (float(s) * 0.09), tAnim, smoothK, true);
thick += clamp(-ds * 4.2, 0.0, 1.0) * 0.25;
}
vec3 refrDir = refract(rd, n, 1.0 / 1.333);
vec3 reflDir = reflect(rd, n);
vec3 refrBg = evalPoolBackdrop(refrDir);
vec3 trans = exp(-vec3(0.75, 0.22, 0.08) * thick * absorb * 3.8);
vec3 reflCol = mix(vec3(0.28, 0.54, 0.84), vec3(0.95, 0.98, 1.0), smoothstep(-0.1, 0.7, reflDir.y));
float fres = 0.03 + 0.94 * pow(1.0 - max(dot(n, v), 0.0), 4.5);
float spec = pow(max(dot(n, H), 0.0), 96.0) * 2.4;
// Aerated foam along fast-moving upper crests
float foam = smoothstep(0.08, 0.42, p.y + 0.25 * n.y) * smoothstep(0.18, 0.02, thick) * 0.45;
col = mix(refrBg * trans + vec3(0.04, 0.24, 0.34) * (1.0 - trans), reflCol, fres) + vec3(1.0) * (spec + foam);
}
}
float sep = smoothstep(0.0035, 0.0008, abs(sx - split));
col = mix(col, vec3(0.95, 0.97, 1.0), sep);
fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);
}Attribution: MIT — written for this index.
Measured GPU weight & timing
| Preset | GPU | Weight / p50 / p95 | Method |
|---|---|---|---|
| screen-space-fluid-rendering-live | Tesla T4 1920x1080 | 205× baseline (extreme) · 6.75 ms / 6.84 ms | opengl-timer-query · 32 frames · GPU Weight Atlas · Colab T4 sweep |
| screen-space-fluid-rendering-live | NVIDIA L4 1920x1080 | 175× baseline (extreme) · 2.78 ms / 2.83 ms · 2.4× faster on L4 | opengl-timer-query · Cross-architecture validation |
| screen-space-fluid-rendering-live | NVIDIA A100-SXM4-40GB 1920x1080 | 150× baseline (extreme) · 4.33 ms / 4.39 ms · 1.6× faster on A100 | opengl-timer-query · Cross-architecture validation |
Lineage
From the citation graph (Crossref reference lists): its primary source cites Marching Cubes; cited by Position Based Fluids.
Crosses
- Position Based Fluids: Particle positions from the solver are splatted as the input depth and thickness images.
- Real-time Water Caustics: Reconstructed screen-space normals and thickness can drive projected caustics on receiving surfaces.
- Temporal Anti-Aliasing: Temporal accumulation hides the flicker of per-particle depth bumps.
Sources
- primaryWladimir J. van der Laan, Simon Green, Miguel Sainz (2009). Screen space fluid rendering with curvature flow. Proceedings of the 2009 symposium on Interactive 3D graphics and games.Verified via crossref · 2026-11-29doi:10.1145/1507149.1507164
- talkSimon Green. Direct3D 11 effects (includes screen-space fluid rendering). GDC 2010.Verified via live page · 2026-11-29