---
id: "soft-particles"
title: "Soft particles (depth-fade billboards)"
aliases: [depth fade, depth-blended sprites]
domain: "simulation"
stage: "volume"
realtime: "realtime"
platforms: [webgl2, webgpu, desktop-gpu, mobile-gpu, unity, unreal, godot]
year_introduced: 2007
inputs: [particles, depth]
outputs: [hdr-image]
style: "both"
dynamic: "dynamic"
cost: "cheap"
authority: "Lorach"
url: "https://texelatlas.vercel.app/t/soft-particles/"
sources_verified_at: "2026-11-29"
---
# Soft particles (depth-fade billboards) (Lorach)

> Fade a particle sprite's opacity by how far it sits in front of the opaque scene depth, so smoke and fire blend into surfaces instead of cutting a hard line.

## Reach for it when

- smoke sprites show a hard line where they hit the floor
- billboard fire cuts visibly through nearby walls
- particle quads need to fade out against scene geometry
- want sprites to blend softly into surfaces behind them

## How it works

While drawing the quad, the fragment shader samples the scene depth buffer at its screen position and converts both that depth and the particle's own fragment depth to the same linear view-space measure. The difference is the thickness of empty space between the sprite and the surface behind it. The alpha is multiplied by a saturating function of that difference divided by a fade distance, often a smoothstep or a contrast curve. Where the sprite touches geometry the difference approaches zero and alpha goes to zero, hiding the intersection seam. The effect needs the opaque depth available as a texture while writing to a colour target with depth test off or read-only, so renderers copy depth or bind the depth attachment read-only. Refinements add a near-camera fade to avoid sprites clipping the near plane, and scale the fade distance by sprite size or density.

## When to use it

Choose it whenever billboard smoke, fire, dust or mist touches the ground or walls. Prefer [Ray-marched Participating Media](https://texelatlas.vercel.app/t/volume-ray-marching.md) or [Froxel Volumetric Fog](https://texelatlas.vercel.app/t/froxel-volumetric-fog.md) when you need genuine thickness-based extinction and lighting, which soft particles only imitate at the edges. Prefer [Particle systems](https://texelatlas.vercel.app/t/particle-systems.md) plain rendering for effects that never meet geometry. It is a final shading step in [GPU particle systems](https://texelatlas.vercel.app/t/gpu-particle-systems.md), and works with depth available from deferred or forward depth prepasses.

## Cost

cheap — One depth texture fetch per particle fragment; the main cost is overdraw you already pay for and a possible depth copy.
Measured GPU Weight: 27.45× baseline (heavy) — 0.851 ms median / 0.9075 ms p95 on Tesla T4/PCIe/SSE2 @ 1920x1080 (opengl-timer-query).
Ada L4 scaling: 25.74× baseline (heavy) — 0.4093 ms median (2.08× faster on L4).
Ampere A100 scaling: 17.92× baseline (moderate) — 0.5162 ms median (1.65× faster on A100).

## Failure modes

- Particles inside large nearby volumes fade out entirely when the fade distance is too large relative to sprite size
- MSAA depth must be resolved or sampled per sample, otherwise edges show halos
- Reading and writing the same depth buffer without a copy is undefined on some platforms
- Only fades along the view ray, so sprite edges seen at grazing angles still intersect visibly
- Near-plane clipping hard-cuts big sprites unless a camera-distance fade is added

## Engine support

- godot: builtin — `BaseMaterial3D.proximity_fade_enabled = true` (evidence: https://github.com/godotengine/godot/blob/4.7.2-stable/doc/classes/BaseMaterial3D.xml, checked 2026-12-01) — Depth-based fade against opaque geometry.
- threejs: official — `import { softParticles } from 'three/addons/tsl/utils/SoftParticles.js'` (evidence: https://github.com/mrdoob/three.js/blob/r187/examples/jsm/tsl/utils/SoftParticles.js, checked 2026-12-01)
- unity: official — `VFX Graph output > Use Soft Particle` (evidence: https://github.com/Unity-Technologies/Graphics/blob/557f6ac22b948284f57ffae6a789751fd1f63620/Packages/com.unity.visualeffectgraph/Documentation~/Context-OutputSharedSettings.md, checked 2026-12-01) — VFX Graph package.
- unreal: builtin — `Material graph: DepthFade expression on translucent particle materials` (evidence: https://dev.epicgames.com/documentation/en-us/unreal-engine/utility-material-expressions-in-unreal-engine, checked 2026-12-01)

## Dataflow

- Inputs: particles, depth
- Outputs: hdr-image
- Platforms: webgl2, webgpu, desktop-gpu, mobile-gpu, unity, unreal, godot

## Presets

### Soft Particles — hard billboard intersection clip (left) vs smooth depth-fade alpha (right) (glsl-fragment; rendered 2026-11-30)

```json
{
  "P_FADE_DIST": 0.48,
  "P_SMOKE_DENS": 1.05,
  "P_TURB_SPEED": 0.85,
  "P_SPLIT": 0.48
}
```

```glsl
const float P_FADE_DIST = 0.48; // P Depth Fade Range [0.05, 1.2, 0.02]
const float P_SMOKE_DENS = 1.05; // P Plume Opacity [0.3, 1.8, 0.05]
const float P_TURB_SPEED = 0.85; // P Rise Speed [0.0, 2.2, 0.05]
const float P_SPLIT = 0.48; // P Hard / Soft Split [0.0, 1.0, 0.02]

float hash21(vec2 p) {
  p = fract(p * vec2(127.1, 311.7));
  p += dot(p, p + 34.5);
  return fract(p.x * p.y);
}

float noise2(vec2 p) {
  vec2 i = floor(p);
  vec2 f = fract(p);
  f = f * f * (3.0 - 2.0 * f);
  return mix(
    mix(hash21(i), hash21(i + vec2(1.0, 0.0)), f.x),
    mix(hash21(i + vec2(0.0, 1.0)), hash21(i + vec2(1.0, 1.0)), f.x),
    f.y
  );
}

float fbm(vec2 p) {
  float s = 0.0;
  float a = 0.5;
  for (int i = 0; i < 4; i++) {
    s += a * noise2(p);
    p = p * 2.04 + vec2(13.1, 7.7);
    a *= 0.5;
  }
  return s;
}

float sdBox(vec3 p, vec3 b) {
  vec3 q = abs(p) - b;
  return length(max(q, 0.0)) + min(max(q.x, max(q.y, q.z)), 0.0);
}

// Solid opaque scene: tiled floor, angled concrete wall, and central pillar intersecting smoke sprites
vec2 mapOpaque(vec3 p) {
  vec2 res = vec2(p.y + 0.62, 1.0); // floor
  float dWall = sdBox(p - vec3(0.0, 0.2, -0.78), vec3(2.4, 1.2, 0.14));
  if (dWall < res.x) res = vec2(dWall, 2.0);
  float dPillar = sdBox(p - vec3(-0.02, -0.05, 0.08), vec3(0.22, 0.72, 0.22)) - 0.02;
  if (dPillar < res.x) res = vec2(dPillar, 3.0);
  float dCrate = sdBox(p - vec3(0.68, -0.34, 0.22), vec3(0.28, 0.28, 0.28)) - 0.02;
  if (dCrate < res.x) res = vec2(dCrate, 3.0);
  return res;
}

vec3 calcNormal(vec3 p) {
  vec2 e = vec2(0.0025, 0.0);
  return normalize(vec3(
    mapOpaque(p + e.xyy).x - mapOpaque(p - e.xyy).x,
    mapOpaque(p + e.yxy).x - mapOpaque(p - e.yxy).x,
    mapOpaque(p + e.yyx).x - mapOpaque(p - e.yyx).x
  ));
}

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 screenX = fragCoord.x / max(iResolution.x, 1.0);
  float split = clamp(P_SPLIT, 0.0, 1.0);
  bool isSoft = screenX >= split;
  float fadeDist = max(P_FADE_DIST, 0.02);
  float smokeDens = clamp(P_SMOKE_DENS, 0.2, 2.0);
  float tAnim = iTime * max(P_TURB_SPEED, 0.0);

  vec3 ro = vec3(0.0, 0.24, 2.35);
  vec3 rd = normalize(vec3(uv - vec2(0.0, 0.06), -1.55));

  // 1. Render opaque scene depth buffer (zScene) and lit shading
  float tScene = 0.0;
  float matId = 0.0;
  bool hit = false;
  for (int i = 0; i < 64; i++) {
    vec2 h = mapOpaque(ro + rd * tScene);
    if (h.x < 0.002) { hit = true; matId = h.y; break; }
    tScene += h.x;
    if (tScene > 9.0) break;
  }

  vec3 col = mix(vec3(0.04, 0.06, 0.10), vec3(0.11, 0.15, 0.22), smoothstep(-0.4, 0.6, uv.y));
  if (hit) {
    vec3 p = ro + rd * tScene;
    vec3 n = calcNormal(p);
    vec3 lDir = normalize(vec3(0.52, 0.84, 0.45));
    float diff = max(dot(n, lDir), 0.0);
    float ao = clamp(0.42 + 0.58 * mapOpaque(p + n * 0.22).x / 0.22, 0.2, 1.0);
    vec3 alb = vec3(0.32, 0.36, 0.42);
    if (matId < 1.5) {
      float chk = mod(floor(p.x * 2.5) + floor(p.z * 2.5), 2.0);
      alb = mix(vec3(0.16, 0.19, 0.24), vec3(0.28, 0.32, 0.38), chk);
    } else if (matId > 2.5) {
      alb = vec3(0.42, 0.46, 0.52);
    }
    col = alb * (0.25 + 0.85 * diff) * ao;
  } else {
    tScene = 9.0;
  }

  // 2. Composite 10 back-to-front camera-facing smoke billboard sprites that cut through the floor & pillar
  for (int i = 0; i < 10; i++) {
    float fi = float(i);
    float zPlane = -0.35 + fi * 0.11;
    float tSprite = (zPlane - ro.z) / rd.z;
    if (tSprite <= 0.05) continue;

    // Depth difference between opaque scene and particle sprite
    float deltaZ = tScene - tSprite;
    if (deltaZ <= 0.0) continue; // behind opaque geometry

    vec3 pHit = ro + rd * tSprite;
    vec2 center = vec2(-0.55 + mod(fi * 0.37, 1.18), -0.44 + mod(fi * 0.19 + tAnim * 0.16, 0.72));
    float rad = 0.44 + 0.06 * sin(fi * 2.1);
    vec2 local = (pHit.xy - center) / rad;
    float r2 = dot(local, local);
    if (r2 >= 1.0) continue;

    float puffNoise = fbm(local * 2.6 + vec2(fi * 3.1, -tAnim * 0.55));
    float radial = pow(max(1.0 - r2, 0.0), 1.35);
    float baseAlpha = clamp(radial * (0.45 + 0.95 * puffNoise) * 0.62 * smokeDens, 0.0, 0.92);

    // Core technique: Hard depth-test clip (left) vs Soft Particle depth fade (right)
    float depthFade = isSoft ? smoothstep(0.0, fadeDist, deltaZ) : 1.0;
    float alpha = baseAlpha * depthFade;

    // Subtle warm backlit smoke shading
    float topLit = clamp(local.y * 0.5 + 0.55 + puffNoise * 0.25, 0.0, 1.0);
    vec3 smokeCol = mix(vec3(0.28, 0.34, 0.44), vec3(0.98, 0.84, 0.68), topLit);
    // Highlight the ugly hard intersection seam on left so the failure mode is crystal clear
    if (!isSoft && deltaZ < 0.045) {
      smokeCol = mix(smokeCol, vec3(1.0, 0.42, 0.28), 0.35);
    }
    col = mix(col, smokeCol, alpha);
  }

  // Split divider
  float sep = smoothstep(0.0035, 0.0008, abs(screenX - 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.

## Combines with

- [GPU particle systems](https://texelatlas.vercel.app/t/gpu-particle-systems.md): The instanced sprite fragment shader reads scene depth and fades alpha at intersections.
- [Froxel Volumetric Fog](https://texelatlas.vercel.app/t/froxel-volumetric-fog.md): Soft-faded sprites sit inside the fog, and fog light scattering is applied on top for consistent atmosphere.

## Combination ideas

- [Depth-feathered soft-particle mist emitted from PBF splash crests](https://texelatlas.vercel.app/ideas/pbf-crest-soft-particle-spray/)
- [Depth-feathered soft-particle smoke wrapping live visual-hull silhouettes](https://texelatlas.vercel.app/ideas/visual-hull-soft-particle-shroud/)

## Sources

1. [primary] Tristan Lorach Soft Particles (NVIDIA SDK 10 white paper). developer.download.nvidia.com. https://developer.download.nvidia.com/whitepapers/2007/SDK10/SoftParticles_hi.pdf (verified via http on 2026-11-29)

## Cite this entry

Texel. "Soft particles (depth-fade billboards)." https://texelatlas.vercel.app/t/soft-particles/ (accessed 2026-12-01).
