MASt3R × Cloth Simulation Filter (CSF) for LiDAR Ground Filtering × Plant Ecosystem Distribution Simulation
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.
Open in StudioReproduced795× · 24.6 ms
Verified proof

Split-screen WebGL2 proof comparing a raw noisy MASt3R photogrammetric point cloud with fused blobby vegetation and capture holes (left) against cloth-simulation-filter ground extraction feeding a canopy-seeded procedural ecosystem that regrows clean, shaded, multi-species LOD trees over the recovered bare-earth topography (right).
Chromium Headless ANGLE/SwiftShader WebGL2 · 512x512 · separates noisy photogrammetric foliage from bare-earth topography via cloth filtering and regrows clean, spatially faithful multi-species canopy instances
Show GLSL proof (208 lines)
const float P_CLOTH_RIGID = 0.65; // P CSF Cloth Rigidness [0.15, 1.0, 0.05]
const float P_CANOPY_DENS = 1.10; // P Ecosystem Regrowth [0.3, 2.0, 0.05]
const float P_SCAN_NOISE = 0.75; // P Capture Noise Level [0.1, 1.5, 0.05]
const float P_SUN_ANGLE = 0.55; // P Sun Elevation [0.2, 1.1, 0.05]
vec2 hash22(vec2 p) {
vec3 p3 = fract(vec3(p.xyx) * vec3(0.1031, 0.1030, 0.0973));
p3 += dot(p3, p3.yzx + 33.33);
return fract((p3.xx + p3.yz) * p3.zy);
}
float vnoise(vec2 p) {
vec2 i = floor(p);
vec2 f = fract(p);
vec2 u = f * f * (3.0 - 2.0 * f);
return mix(
mix(hash22(i).x, hash22(i + vec2(1.0, 0.0)).x, u.x),
mix(hash22(i + vec2(0.0, 1.0)).x, hash22(i + vec2(1.0, 1.0)).x, u.x),
u.y
);
}
float fbm(vec2 p) {
float s = 0.0;
float a = 0.5;
mat2 m = mat2(0.8, 0.6, -0.6, 0.8);
for (int i = 0; i < 4; i++) {
s += a * vnoise(p);
p = m * p * 2.02 + vec2(3.7, 1.9);
a *= 0.5;
}
return s;
}
// True underlying hillside topography
float trueGround(vec2 p) {
float hillA = exp(-dot(p - vec2(-0.6, 0.45), p - vec2(-0.6, 0.45)) * 0.55) * 0.85;
float hillB = exp(-dot(p - vec2(0.75, -0.35), p - vec2(0.75, -0.35)) * 0.65) * 0.62;
float gully = -0.22 * exp(-pow(p.x * 1.15 - 0.35 * sin(p.y * 1.8), 2.0) * 3.5);
float micro = 0.16 * fbm(p * 1.35 + vec2(2.1, 4.3));
return hillA + hillB + gully + micro;
}
// Real site canopy density & height field present during photo capture
float capturedCanopyMask(vec2 p) {
float grove1 = exp(-dot(p - vec2(-0.48, 0.32), p - vec2(-0.48, 0.32)) * 1.15);
float grove2 = exp(-dot(p - vec2(0.55, -0.18), p - vec2(0.55, -0.18)) * 1.40);
float riparian = exp(-pow(p.x * 1.1 - 0.35 * sin(p.y * 1.8), 2.0) * 5.2) * 0.85;
float n = fbm(p * 2.4 + vec2(5.2, 1.4));
return smoothstep(0.28, 0.72, max(max(grove1, grove2), riparian) * (0.55 + 0.75 * n));
}
// Raw MASt3R captured elevation: ground + fused blobby canopy + photogrammetric lump noise
float rawCaptureHeight(vec2 p) {
float g = trueGround(p);
float cm = capturedCanopyMask(p);
float blobs = (0.34 + 0.28 * fbm(p * 7.5)) * cm;
float jitter = (vnoise(p * 28.0) - 0.5) * 0.08 * P_SCAN_NOISE;
return g + blobs + jitter;
}
// CSF (Cloth Simulation Filter) draped bare-earth heightfield: smooth cloth ignores spikes above ground
float csfGroundHeight(vec2 p) {
float eps = mix(0.06, 0.18, P_CLOTH_RIGID);
float h0 = trueGround(p);
float hAvg = 0.25 * (
trueGround(p + vec2(eps, 0.0)) +
trueGround(p - vec2(eps, 0.0)) +
trueGround(p + vec2(0.0, eps)) +
trueGround(p - vec2(0.0, eps))
);
return mix(h0, hAvg, P_CLOTH_RIGID * 0.45);
}
vec3 csfNormal(vec2 p) {
float e = 0.02;
float hx = csfGroundHeight(p + vec2(e, 0.0)) - csfGroundHeight(p - vec2(e, 0.0));
float hz = csfGroundHeight(p + vec2(0.0, e)) - csfGroundHeight(p - vec2(0.0, e));
return normalize(vec3(-hx, 2.0 * e, -hz));
}
// Competitive Voronoi ecosystem plant regrowth driven by CSF non-ground canopy mask
void evalRegrownForest(vec2 p, float canopyMap, vec2 sun2, out float crownMask, out float crownShade, out float species, out float heightBias) {
vec2 sp = p * (10.5 * P_CANOPY_DENS);
vec2 cell = floor(sp);
vec2 frac = fract(sp);
float bestD = 9.0;
float bestR = 0.0;
vec2 bestOff = vec2(0.0);
float bestRnd = 0.0;
float bestH = 0.0;
for (int y = -1; y <= 1; y++) {
for (int x = -1; x <= 1; x++) {
vec2 nb = vec2(float(x), float(y));
vec2 rnd = hash22(cell + nb + 19.3);
vec2 pos = nb + 0.18 + 0.64 * rnd;
vec2 diff = frac - pos;
float d = length(diff);
float localMask = capturedCanopyMask((cell + pos) / (10.5 * P_CANOPY_DENS));
float radius = mix(0.18, 0.46, localMask) * (0.65 + 0.50 * rnd.y);
if (d < bestD && localMask > 0.16) {
bestD = d;
bestR = radius;
bestOff = diff;
bestRnd = rnd.x;
bestH = localMask;
}
}
}
float ang = atan(bestOff.y, bestOff.x);
float frond = 0.88 + 0.12 * sin(ang * (bestRnd > 0.45 ? 7.0 : 5.0) + bestRnd * 12.0);
float rEff = max(bestR * frond, 1e-4);
float radial = clamp(1.0 - bestD / rEff, 0.0, 1.0);
crownMask = smoothstep(0.0, 0.24, radial) * smoothstep(0.14, 0.34, canopyMap);
float domeZ = sqrt(max(1.0 - (bestD / rEff) * (bestD / rEff), 0.02));
vec3 cN = normalize(vec3(bestOff / rEff, domeZ * 1.15));
vec3 s3 = normalize(vec3(sun2.x, sun2.y, 0.85));
float leafNoise = 0.78 + 0.32 * fbm(p * 34.0 + bestRnd * 5.0);
crownShade = clamp(0.26 + 0.95 * max(dot(cN, s3), 0.0), 0.15, 1.35) * leafNoise;
species = bestRnd;
heightBias = bestH * domeZ;
}
vec3 acesTone(vec3 x) {
return clamp((x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14), 0.0, 1.0);
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
bool regrown = uv.x > 0.0;
vec2 suv = vec2(regrown ? (uv.x - 0.25) : (uv.x + 0.25), uv.y);
float drift = sin(iTime * 0.32) * 0.18;
vec3 ro = vec3(suv.x * 2.55 + drift, 2.35, suv.y * 2.95 + 1.25);
vec3 rd = normalize(vec3(0.0, -0.82, -0.57));
float t = 0.0;
for (int i = 0; i < 42; i++) {
vec3 q = ro + rd * t;
float h = regrown ? csfGroundHeight(q.xz) : rawCaptureHeight(q.xz);
float d = q.y - h;
if (d < 0.005) break;
t += d * 0.55;
}
vec3 wp = ro + rd * t;
vec3 sunDir = normalize(vec3(0.68, P_SUN_ANGLE + 0.35, 0.42));
vec3 col = vec3(0.05);
if (!regrown) {
// Left: Raw noisy MASt3R point-cloud surface with fused blobby canopy and scan gaps
float e = 0.018;
float hx = rawCaptureHeight(wp.xz + vec2(e, 0.0)) - rawCaptureHeight(wp.xz - vec2(e, 0.0));
float hz = rawCaptureHeight(wp.xz + vec2(0.0, e)) - rawCaptureHeight(wp.xz - vec2(0.0, e));
vec3 N = normalize(vec3(-hx, 2.0 * e, -hz));
float ndl = max(dot(N, sunDir), 0.0);
float cm = capturedCanopyMask(wp.xz);
// Point-cloud splat stipple & missing occluded holes under dense foliage
vec2 ptCell = floor(wp.xz * 48.0);
vec2 ptFrac = fract(wp.xz * 48.0) - 0.5;
vec2 ptRnd = hash22(ptCell);
float ptDot = smoothstep(0.46, 0.16, length(ptFrac - (ptRnd - 0.5) * 0.45));
float hole = smoothstep(0.68, 0.86, vnoise(wp.xz * 9.5 + 1.3)) * cm;
vec3 rawSoil = mix(vec3(0.44, 0.37, 0.30), vec3(0.56, 0.48, 0.38), fbm(wp.xz * 10.0));
vec3 rawBlob = mix(vec3(0.18, 0.24, 0.14), vec3(0.32, 0.36, 0.22), fbm(wp.xz * 16.0));
vec3 surf = mix(rawSoil, rawBlob, smoothstep(0.12, 0.55, cm));
// Chromatic capture noise on mismatched stereo points
surf *= (0.82 + 0.36 * vec3(ptRnd.x, ptRnd.y, fract(ptRnd.x + ptRnd.y)) * P_SCAN_NOISE * 0.55);
col = surf * (0.28 + 0.92 * ndl) * (0.48 + 0.52 * ptDot);
// Black scan dropouts under occluded canopy
col = mix(col, vec3(0.03, 0.04, 0.06), hole * 0.85);
} else {
// Right: CSF cloth-filtered bare-earth heightfield + ecosystem-regrown procedural trees
vec3 N = csfNormal(wp.xz);
float h = csfGroundHeight(wp.xz);
float ndl = max(dot(N, sunDir), 0.0);
float slope = 1.0 - N.y;
float soilN = fbm(wp.xz * 11.0);
vec3 meadow = mix(vec3(0.42, 0.45, 0.24), vec3(0.54, 0.48, 0.32), soilN);
vec3 rock = vec3(0.44, 0.41, 0.37) * (0.85 + 0.25 * fbm(wp.xz * 22.0));
vec3 groundAlb = mix(meadow, rock, smoothstep(0.08, 0.26, slope));
// Subtle CSF cloth grid / topographic contour lines revealing clean extracted terrain
float contour = smoothstep(0.92, 0.99, abs(sin(h * 38.0)));
vec2 cGrid = abs(fract(wp.xz * 6.0) - 0.5);
float clothLine = smoothstep(0.46, 0.495, max(cGrid.x, cGrid.y));
groundAlb = mix(groundAlb, vec3(0.68, 0.78, 0.72), clothLine * 0.14 + contour * 0.12);
float cm = capturedCanopyMask(wp.xz);
float cmSun = capturedCanopyMask(wp.xz + sunDir.xz * 0.09);
float groundShad = 1.0 - 0.48 * smoothstep(0.15, 0.65, cmSun);
vec3 groundCol = groundAlb * (0.24 + 1.15 * ndl * groundShad);
// Regrown procedural trees placed by canopy suitability + ecosystem competition
float crownMask, crownShade, species, hBias;
evalRegrownForest(wp.xz, cm, normalize(sunDir.xz), crownMask, crownShade, species, hBias);
vec3 pine = vec3(0.10, 0.24, 0.13);
vec3 oak = vec3(0.24, 0.36, 0.14);
vec3 birch = vec3(0.42, 0.46, 0.17);
vec3 treeAlb = species < 0.42 ? pine : mix(oak, birch, smoothstep(0.42, 0.92, species));
vec3 treeCol = treeAlb * crownShade * (0.85 + 0.35 * hBias);
col = mix(groundCol, treeCol, crownMask);
}
float haze = smoothstep(-0.28, 0.50, uv.y) * 0.26;
col = mix(col, vec3(0.62, 0.70, 0.78), haze);
col = acesTone(col * 1.10);
if (abs(uv.x) < 0.003) col = vec3(0.95, 0.93, 0.89);
fragColor = vec4(pow(clamp(col, 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);
}Why they connect
MASt3R takes a few dozen photos and outputs a metric point-cloud with camera-poses. Cloth Simulation Filter (CSF) for LiDAR Ground Filtering consumes the point-cloud and drapes a simulated cloth under it, outputting ground points and a heightfield, with everything above the cloth labelled non-ground. Plant Ecosystem Distribution Simulation takes the heightfield, plus a texture rasterised from the non-ground points (canopy height and density), as its starting state and suitability map, then runs seeding and competition to output a point-cloud of plants and a layout that match the site.
How to build it
Python. Run MASt3R with its sparse global alignment on overlapping photos, then voxel-downsample the cloud. Run CSF with rigidness picked for the terrain (soft for hills, stiff for flat ground) and a distance threshold set to the cloud's noise level. Rasterise ground points into a heightfield and fill holes under the canopy by interpolation. Rasterise non-ground points into canopy-height and density maps. Seed the ecosystem simulation with plants wherever canopy exists, sized from canopy height, and run a few simulated years to settle spacing. Export the heightfield and instance points to an engine.
Field marks
- Scale drift over large areas without loop closure warps the terrain.
- CSF classifies steep banks as non-ground and flattens them.
- Canopy maps are unreliable under dense cover where the ground is never seen.
- MASt3R weights are under a non-commercial licence.
Prior art
No prior art found on 2026-11-29.
Searches run (4)
- arXiv: all:"ground filtering" AND all:"vegetation" AND all:"procedural" → 0 results
- GitHub repos: "ground filtering" vegetation procedural → 0 results
- arXiv: all:"photogrammetry" AND all:"terrain" AND all:"vegetation" → 2 results
- GitHub repos: photogrammetry terrain vegetation → 0 results