Multi-Lobe Small-Angle Forward-Scattering Optical PSF Convolution
Models underwater image blur and luminous halation by convolving the HDR scene with a depth-dependent multi-lobe point spread function derived from small-angle forward scattering theory.
Also known as underwater optical PSF, small-angle forward scattering glow, Wells-Jaffe underwater scattering
In the family Atmosphere, water & volumes, underwater optics & participating media
Where it runs
Built inOfficial add-onPluginNone foundNot researched
| Engine | Support | How |
|---|---|---|
| three.js r187 | None found | |
| Babylon.js 9.38.0 | None found | |
| 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
Underwater visibility degrades through three distinct radiative components (Jaffe 1990): exponentially attenuated direct radiance, ambient backscatter veiling light, and small-angle forward scattering of light leaving scene surfaces toward the camera. Because suspended marine particulates scatter strongly in the forward direction, photons deflected by small angles still reach nearby camera pixels, blurring distant edges and wrapping bright highlights in soft turquoise-gold haloes.
Following Wells' small-angle approximation, the medium's optical transfer function decays exponentially with optical depth b * z and spatial frequency, yielding a radial point spread function (PSF) whose width grows with range z and scattering coefficient b. Because a real-time spatially varying convolution over arbitrary radii is expensive, the PSF is decomposed into a weighted sum of concentric Gaussian lobes (narrow core plus progressively wider forward-scatter tails) evaluated on a hierarchical HDR mip pyramid.
During compositing, each pixel blends the sharp direct image with depth-weighted taps across pyramid levels—rejecting foreground bleed with bilateral depth weights—while applying wavelength-selective Beer-Lambert absorption (red fading first, then green, leaving blue-cyan) and in-scattered ambient veiling light.
When to choose it
Reach for it when
- exponential underwater fog looks flat and misses bright silhouette halation
- need realistic turbid water blur that grows with optical distance
- simulate forward scattering glow around underwater sunbeams and lights
- distant reef and kelp outlines stay unrealistically crisp in murky water
- apply physically grounded underwater point spread filtering in post
Choose it when rendering submerged scenes, kelp forests, reefs, or underwater ROV/camera optics where realistic range-dependent contrast loss and forward-scattered light haloes matter more than simple uniform fog.
Prefer Exponential Height Fog when cheap distance tinting alone is sufficient and edge blurring is unnecessary. Prefer Froxel Volumetric Fog or Ray-marched Participating Media when heterogeneous light shafts, local spotlights, and shadowed 3D turbidity plumes dominate over image-space forward blur.
Field marks
- Without bilateral depth weighting, bright foreground objects bleed halo energy onto dark backgrounds and distant bright highlights leak across sharp foreground silhouettes
- Screen-space convolution cannot scatter light from bright submerged objects or sunbeams located just outside the camera frustum
- Approximating the continuous range-dependent Wells PSF with too few discrete pyramid lobes creates visible depth banding across steep turbidity gradients
- Ignoring spectral absorption coupling causes forward-scattered haloes to keep unnaturally warm red tones at long distances
Presets
Underwater Small-Angle PSF Scattering — Beer-Lambert only (left) vs depth-dependent multi-lobe optical PSF halation (right)
{
"P_TURBIDITY": 0.72,
"P_PSF_WIDTH": 1.15,
"P_LAMP_POWER": 1.65,
"P_SPLIT": 0.48
}Show GLSL (117 lines)
const float P_TURBIDITY = 0.72; // P Water Turbidity [0.2, 1.6, 0.05]
const float P_PSF_WIDTH = 1.15; // P Forward PSF Spread [0.3, 2.2, 0.05]
const float P_LAMP_POWER = 1.65; // P Beacon Power [0.5, 3.0, 0.1]
const float P_SPLIT = 0.48; // P Sharp / PSF Split [0.0, 1.0, 0.02]
// Evaluate crisp HDR underwater scene (coral archway + 3 glowing diver beacon lamps at near, mid, and far depths!)
void evalUnderwaterScene(vec2 uv, float turb, float lampPow, out vec3 hdrCol, out float depthZ) {
// Deep ocean vertical caustic & veil gradient
float caustic = 0.5 + 0.5 * sin(uv.x * 16.0 + iTime * 1.4) * cos(uv.y * 12.0 - iTime * 1.1);
vec3 waterBg = mix(vec3(0.015, 0.09, 0.16), vec3(0.04, 0.28, 0.38), smoothstep(-0.5, 0.5, uv.y));
waterBg += vec3(0.03, 0.14, 0.18) * caustic * smoothstep(-0.1, 0.5, uv.y);
hdrCol = waterBg;
depthZ = 18.0;
// Seabed floor receding into distance
if (uv.y < -0.14) {
float z = 1.6 / max(-uv.y - 0.10, 0.04);
depthZ = min(z, 18.0);
float sandC = 0.5 + 0.5 * sin(uv.x * z * 4.5 + iTime * 1.6) * cos(z * 3.2 - iTime * 1.2);
vec3 sand = vec3(0.16, 0.24, 0.22) * (0.7 + 0.65 * sandC);
vec3 atten = exp(-vec3(0.45, 0.16, 0.11) * depthZ * turb * 0.45);
hdrCol = mix(waterBg, sand * atten, exp(-depthZ * turb * 0.08));
}
// Silhouetted sunken stone archway at mid depth (z = 7.5m)
vec2 ap = uv - vec2(0.0, -0.02);
float dArch = abs(length(ap * vec2(1.0, 1.15)) - 0.34) - 0.075;
if (dArch < 0.0 && ap.y > -0.28) {
depthZ = 7.5;
vec3 stone = vec3(0.06, 0.13, 0.16);
hdrCol = mix(waterBg, stone, exp(-depthZ * turb * 0.08));
}
// Three bright underwater beacon lamps at increasing depths: Near (z=2.5m), Mid (z=7.2m), Far (z=13.5m)!
vec2 lPos[3];
float lDepth[3];
vec3 lHue[3];
lPos[0] = vec2(-0.42 + 0.05 * sin(iTime * 0.7), -0.16); lDepth[0] = 2.6; lHue[0] = vec3(2.8, 2.2, 1.2);
lPos[1] = vec2(0.02 + 0.04 * cos(iTime * 0.6), 0.12); lDepth[1] = 7.2; lHue[1] = vec3(1.1, 2.8, 2.4);
lPos[2] = vec2(0.42 + 0.04 * sin(iTime * 0.5), 0.04); lDepth[2] = 13.5; lHue[2] = vec3(2.8, 1.3, 0.7);
for (int i = 0; i < 3; i++) {
float r = length(uv - lPos[i]);
float rad = 0.048 / sqrt(lDepth[i] * 0.35);
if (r < rad * 1.4) {
depthZ = min(depthZ, lDepth[i]);
float core = smoothstep(rad * 1.35, rad * 0.35, r);
vec3 atten = exp(-vec3(0.32, 0.11, 0.08) * lDepth[i] * turb * 0.32);
hdrCol += lHue[i] * atten * core * lampPow * 2.6;
}
}
}
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 usePSF = sx >= split;
float turb = clamp(P_TURBIDITY, 0.15, 2.0);
float psfW = clamp(P_PSF_WIDTH, 0.2, 2.5);
float lampPow = clamp(P_LAMP_POWER, 0.3, 3.5);
vec3 col;
float z;
evalUnderwaterScene(uv, turb, lampPow, col, z);
if (usePSF) {
// Right: Multi-lobe Small-Angle Forward-Scattering Optical PSF convolution (depth-dependent narrow + wide Gaussian lobes!)
vec2 lPos[3];
float lDepth[3];
vec3 lHue[3];
lPos[0] = vec2(-0.42 + 0.05 * sin(iTime * 0.7), -0.16); lDepth[0] = 2.6; lHue[0] = vec3(2.8, 2.2, 1.2);
lPos[1] = vec2(0.02 + 0.04 * cos(iTime * 0.6), 0.12); lDepth[1] = 7.2; lHue[1] = vec3(1.1, 2.8, 2.4);
lPos[2] = vec2(0.42 + 0.04 * sin(iTime * 0.5), 0.04); lDepth[2] = 13.5; lHue[2] = vec3(2.8, 1.3, 0.7);
// Subtle spatial small-angle PSF blur on background archway & seabed proportional to optical depth
vec3 blurAcc = col * 0.45;
float blurRad = clamp(z * turb * 0.0018 * psfW, 0.001, 0.028);
for (int k = 0; k < 6; k++) {
float ang = float(k) * 1.0471975;
vec3 cN; float zN;
evalUnderwaterScene(uv + vec2(cos(ang), sin(ang)) * blurRad, turb, lampPow, cN, zN);
blurAcc += cN * (0.55 / 6.0);
}
col = blurAcc;
// Analytical multi-lobe small-angle forward-scattering PSF halation around each underwater emitter:
// Lobe 1 (tight core), Lobe 2 (mid forward-scatter glow), Lobe 3 (broad multiple-scatter aureole)
// Spread grows with optical depth tau = turb * depth!
for (int i = 0; i < 3; i++) {
float r = length(uv - lPos[i]);
float tau = lDepth[i] * turb * 0.12;
float s1 = max(0.015 + 0.025 * tau * psfW, 0.01);
float s2 = max(0.045 + 0.085 * tau * psfW, 0.02);
float s3 = max(0.110 + 0.180 * tau * psfW, 0.05);
float psf = 0.55 * exp(-r * r / (2.0 * s1 * s1))
+ 0.32 * exp(-r * r / (2.0 * s2 * s2))
+ 0.16 * exp(-r / s3);
vec3 atten = exp(-vec3(0.32, 0.11, 0.08) * lDepth[i] * turb * 0.28);
// Forward scatter grows in relative energy as optical depth increases!
float scatFrac = 1.0 - exp(-tau * 1.85);
col += lHue[i] * atten * psf * scatFrac * lampPow * 0.88;
}
}
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 |
|---|---|---|---|
| small-angle-underwater-psf-scattering-live | Tesla T4 1920x1080 | 8.69× baseline (moderate) · 0.286 ms / 0.288 ms | opengl-timer-query · 32 frames · GPU Weight Atlas · Colab T4 sweep |
| small-angle-underwater-psf-scattering-live | NVIDIA L4 1920x1080 | 7.12× baseline (moderate) · 0.113 ms / 0.114 ms · 2.5× faster on L4 | opengl-timer-query · Cross-architecture validation |
| small-angle-underwater-psf-scattering-live | NVIDIA A100-SXM4-40GB 1920x1080 | 6.05× baseline (moderate) · 0.174 ms / 0.175 ms · 1.6× faster on A100 | opengl-timer-query · Cross-architecture validation |
Crosses
- Meshlet kelp forests through underwater PSF scattering: Dense swaying kelp forests rendered at millions of triangles without CPU draw-call overhead, then veiled in physically grounded underwater forward scattering. Caustic shafts light the blades while a depth-varying small-angle point-spread filter softens distant fronds into authentic oceanic haze instead of flat exponential fog.
- Dual-filter and progressive-downsample bloom: Provides fast hierarchical downsample/upsample mip levels whose radii map directly onto the concentric underwater PSF lobes.
- Screen-space Volumetric Light Scattering (God Rays): Supplies directional sun shafts and backscatter veiling light that complement the forward-scattered image blur.
Sources
- primaryWillard H. Wells (1969). Loss of Resolution in Water as a Result of Multiple Small-Angle Scattering. Journal of the Optical Society of America.Verified via doi.org · 2026-11-30doi:10.1364/josa.59.000686
- primaryJ.S. Jaffe (1990). Computer modeling and the design of optimal underwater imaging systems. IEEE Journal of Oceanic Engineering.Verified via crossref · 2026-11-30doi:10.1109/48.50695
- implementationmrdoob (2026). mrdoob/codevember-2026. Daily creative agentic coding experiments for November 2026.GitHub API · license MIT · 2026-11-30