Cloth Simulation Filter (CSF) for LiDAR Ground Filtering
Separates ground from non-ground points in an airborne LiDAR cloud by inverting the cloud and draping a simulated cloth over it; points near the cloth are ground.
Also known as CSF
In the family Capture, reconstruction & splatting, LiDAR processing
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 | Not applicable | Offline reconstruction/generative method, not an engine feature. |
| Unity | None found | No built-in airborne LiDAR ground-filtering CSF solver. |
| Unreal 5.7 | None found | No built-in LiDAR CSF ground-point classifier. |
| Blender 5.2 | None found | |
| WebGPU W3C | None found | |
| Metal | None found |
How it works
The point cloud is flipped upside down, and a regular grid of cloth particles, connected by springs, is dropped onto it. Each particle moves under gravity until it would touch a LiDAR point beneath it, at which point it stops. Neighbouring particles are pulled toward each other by internal forces that depend on the cloth rigidness, which stops the cloth from falling into small gaps or following buildings and trees. After a fixed number of iterations the cloth approximates the terrain surface. Original points are classified as ground when their distance to the cloth is below a threshold. Only a few parameters are needed: grid resolution, rigidness, time step and the distance threshold.
When to choose it
Reach for it when
- separate ground points from trees and buildings in lidar
- need a terrain model from an airborne point cloud
- remove objects to get bare earth from scan data
- classify ground versus non-ground in photogrammetry points
- ground extraction with few parameters to tune
Choose it when you need a ground/non-ground split of airborne or terrestrial LiDAR or photogrammetric point clouds, for DTM extraction or object removal. Prefer progressive morphological or TIN-densification filters for dense, steep, urban terrain with hand-tuned parameters, and learned segmenters when labels exist.
Field marks
- Steep slopes and terraces get classified as non-ground if rigidness is too high
- Low vegetation and cars are retained as ground when the distance threshold is too loose
- Large flat roofs may be partly absorbed as ground with a soft cloth
- Grid resolution too coarse smooths away small terrain features like ditches
Presets
CSF default parameters
{
"cloth_resolution": 0.5,
"rigidness": 3,
"time_step": 0.65,
"class_threshold": 0.5,
"iterations": 500,
"slope_smooth": true
}Attribution: Parameter names follow jianboqi/CSF (Apache-2.0); values are the library's commonly used defaults, written for this index.
Cloth Simulation Filter (CSF) — inverted LiDAR cloth drape (left) vs classified ground & objects (right)
{
"P_RIGIDNESS": 0.72,
"P_CLASS_THRESH": 0.07,
"P_SWEEP": 0.45,
"P_SPLIT": 0.48
}Show GLSL (129 lines)
const float P_RIGIDNESS = 0.72; // P Cloth Rigidness [0.1, 1.0, 0.02]
const float P_CLASS_THRESH = 0.07; // P Ground Threshold [0.02, 0.16, 0.005]
const float P_SWEEP = 0.45; // P Scan Pan [0.0, 2.0, 0.05]
const float P_SPLIT = 0.48; // P Inverted CSF / Class [0.0, 1.0, 0.02]
float hash11(float x) {
x = fract(x * 0.1031);
x *= x + 33.33;
x *= x + x;
return fract(x);
}
// True rolling ground elevation y_ground(x)
float groundY(float x) {
return -0.18 + 0.09 * sin(x * 3.2) + 0.045 * cos(x * 6.5 + 0.7);
}
// Airborne LiDAR surface height including buildings & tree crowns above the ground
float lidarTopY(float x) {
float g = groundY(x);
// Building 1
if (abs(x + 0.42) < 0.13) return g + 0.28;
// Building 2 (stepped roof)
if (abs(x - 0.36) < 0.15) return g + 0.24 + 0.06 * step(0.32, x);
// Tree canopy 1
float t1 = abs(x + 0.08);
if (t1 < 0.11) return g + 0.22 * sqrt(max(1.0 - (t1 / 0.11) * (t1 / 0.11), 0.0)) + 0.05 * sin(x * 80.0);
// Tree canopy 2
float t2 = abs(x - 0.66);
if (t2 < 0.09) return g + 0.19 * sqrt(max(1.0 - (t2 / 0.09) * (t2 / 0.09), 0.0));
return g;
}
// Simulated draped cloth height over inverted LiDAR (stiff cloth bridges over inverted buildings/trees!)
float clothY(float x, float rigid) {
float g = groundY(x);
// Low rigidness lets cloth sag slightly into building/tree pits; high rigidness stays tightly bridged on ground
float sag = (1.0 - rigid) * 0.12;
float b1 = smoothstep(0.14, 0.0, abs(x + 0.42)) * sag;
float b2 = smoothstep(0.16, 0.0, abs(x - 0.36)) * sag;
float tr = smoothstep(0.12, 0.0, abs(x + 0.08)) * sag * 0.8;
return g + (b1 + b2 + tr);
}
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 isInverted = screenX < split;
float rigid = clamp(P_RIGIDNESS, 0.05, 1.0);
float thresh = clamp(P_CLASS_THRESH, 0.015, 0.20);
float pan = sin(iTime * 0.45 * max(P_SWEEP, 0.0)) * 0.16;
// Blueprint engineering grid backdrop
vec3 col = mix(vec3(0.024, 0.034, 0.056), vec3(0.054, 0.072, 0.112), smoothstep(-0.5, 0.5, uv.y));
vec2 g1 = abs(fract(uv * 10.0 - 0.5) - 0.5);
col += vec3(0.018, 0.028, 0.044) * smoothstep(0.035, 0.008, min(g1.x, g1.y));
// Left half shows the INVERTED LiDAR cloud (y -> -y) with gravity cloth draping down from above!
// Right half shows the UPRIGHT classified point cloud (cyan = ground, amber/green = non-ground)
float xWorld = uv.x + pan;
float yEval = isInverted ? -uv.y : uv.y;
float cY = clothY(xWorld, rigid);
float dCloth = abs(yEval - cY);
// Draw threshold tolerance band around the simulated cloth surface
float inBand = smoothstep(thresh + 0.004, thresh - 0.004, abs(yEval - cY));
col = mix(col, vec3(0.12, 0.52, 0.68), inBand * 0.22);
// Draw the cloth curve + cloth particle nodes
float clothLine = smoothstep(0.008, 0.002, dCloth);
float nodeX = fract(xWorld * 18.0 + 0.5) - 0.5;
float dNode = length(vec2(nodeX / 18.0, yEval - cY));
float clothNode = smoothstep(0.012, 0.005, dNode);
vec3 clothCol = isInverted ? vec3(0.98, 0.78, 0.24) : vec3(0.24, 0.88, 0.96);
col = mix(col, clothCol, max(clothLine * 0.9, clothNode));
// Render discrete airborne LiDAR return points sampled along x
float stepX = 0.022;
float ix = floor(xWorld / stepX);
for (int k = -1; k <= 1; k++) {
float cx = (ix + float(k) + 0.5) * stepX;
float topY = lidarTopY(cx);
float gY = groundY(cx);
float clY = clothY(cx, rigid);
// Primary LiDAR top return point
float jit = (hash11(ix + float(k) * 1.7) - 0.5) * 0.012;
float py = topY + jit;
float distPt = length(vec2(xWorld - cx, yEval - py));
float ptMask = smoothstep(0.012, 0.004, distPt);
bool isGroundPt = abs(py - clY) < thresh;
vec3 ptCol = isGroundPt
? vec3(0.18, 0.90, 0.86) // Ground point
: (py - gY > 0.23 ? vec3(0.98, 0.44, 0.22) : vec3(0.42, 0.92, 0.34)); // Building vs tree
col = mix(col, ptCol * 1.15, ptMask);
// Vertical wall / trunk returns for buildings & canopies
if (topY - gY > 0.08) {
for (int r = 1; r <= 3; r++) {
float ry = mix(gY + 0.03, topY - 0.02, float(r) / 4.0) + (hash11(cx * 31.0 + float(r)) - 0.5) * 0.015;
float dR = length(vec2(xWorld - cx, yEval - ry));
float mR = smoothstep(0.009, 0.003, dR);
bool rGrd = abs(ry - clY) < thresh;
vec3 rCol = rGrd ? vec3(0.18, 0.90, 0.86) : vec3(0.95, 0.58, 0.22);
col = mix(col, rCol, mR * 0.85);
}
}
}
// Gravity arrow indicator on left inverted side
if (isInverted) {
vec2 aP = uv - vec2(-0.34, 0.30);
float shaft = smoothstep(0.005, 0.001, abs(aP.x)) * smoothstep(0.07, 0.06, abs(aP.y));
float head = smoothstep(0.006, 0.001, abs(abs(aP.x) - (aP.y + 0.075) * 0.65)) * step(aP.y, -0.02) * step(-0.08, aP.y);
col += vec3(0.98, 0.78, 0.24) * max(shaft, head) * 0.85;
}
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.
Measured GPU weight & timing
| Preset | GPU | Weight / p50 / p95 | Method |
|---|---|---|---|
| cloth-simulation-filter-live | Tesla T4 1920x1080 | 10.2× baseline (moderate) · 0.334 ms / 0.336 ms | opengl-timer-query · 32 frames · GPU Weight Atlas · Colab T4 sweep |
| cloth-simulation-filter-live | NVIDIA L4 1920x1080 | 8.32× baseline (moderate) · 0.132 ms / 0.133 ms · 2.5× faster on L4 | opengl-timer-query · Cross-architecture validation |
| cloth-simulation-filter-live | NVIDIA A100-SXM4-40GB 1920x1080 | 7.57× baseline (moderate) · 0.218 ms / 0.218 ms · 1.5× faster on A100 | opengl-timer-query · Cross-architecture validation |
Crosses
- Regrow a photographed site: Photograph a real site, strip the messy captured vegetation off, and regrow it procedurally: true topography with clean, editable, LOD-friendly plants that still stand where the real canopy was.
- Multi-View Stereo (PatchMatch, COLMAP): Dense photogrammetric point clouds are filtered by CSF to extract a terrain model.
Sources
- primaryWuming Zhang, Jianbo Qi, Peng Wan, Hongtao Wang, Donghui Xie, Xiaoyan Wang et al. (2016). An Easy-to-Use Airborne LiDAR Data Filtering Method Based on Cloth Simulation. Remote Sensing.Verified via crossref · 2026-11-29doi:10.3390/rs8060501
- implementationjianboqi (2016). jianboqi/CSF. LiDAR point cloud ground filtering / segmentation (bare earth extraction) method based on cloth simulationGitHub API · license Apache-2.0 · 2026-11-29