Texel A field guide to 3D techniques

Meshlets (cluster rendering) × GPU-driven rendering × Compute-Shader Atomic Fixed-Point Sub-Pixel Point Rasterization

Meshlet foliage with compute-rasterized atomic spores. A split-path renderer for dense botanical worlds: macroscopic trunks and leaves flow through GPU-driven meshlets, while millions of sub-pixel drifting spores, pollen grains, and distant needle points bypass hardware triangle setup altogether via lock-free 64-bit compute atomics occluded against the meshlet depth buffer.

Open in StudioReproduced39.1× · 1.21 ms

Meshlets (cluster rendering)Performance · Real-timein: meshout: meshmeshGPU-driven renderingPerformance · Real-timein: meshout: gbuffer, depthdepthCompute-Shader Atomic Fixed-Point Sub-Pixel Point RasterizationPerformance · Real-timein: point-cloud, particles, depth, camera-posesout: hdr-image, depth

Verified proof

reproduced · 2026-12-01texel-lablicense MIT
Specimen render of Meshlet foliage + atomic spore raster (left: opaque meshlet canopy alone, right: depth-tested fixed-point luminous spores)
Cross-proof specimen. Meshlet foliage + atomic spore raster (left: opaque meshlet canopy alone, right: depth-tested fixed-point luminous spores). Verified WebGL2 proof · 2026-12-01

Split-screen WebGL2 proof comparing opaque GPU-driven meshlet forest canopy geometry alone (left, showing cleanly culled botanical frond clusters in an empty twilight glade) against the same opaque meshlet depth buffer composited with depth-tested sub-pixel compute-rasterized luminous spores swirling in curl-noise wind and accumulated additively via fixed-point point rasterization (right).

Chromium Headless ANGLE/SwiftShader WebGL2 · 512x512 · demonstrates depth-accurate compositing of dense curl-advected sub-pixel luminous spores against opaque GPU-driven meshlet foliage layers

Show GLSL proof (131 lines)
const float P_SPORE_DENS = 1.25; // P Spore Density [0.3, 2.2, 0.05]
const float P_WIND_CURL = 1.00; // P Curl Wind Speed [0.0, 2.0, 0.05]
const float P_BACKLIGHT = 1.35; // P Sun Backlight [0.3, 2.5, 0.05]
const float P_MESHLET_VIS = 0.35; // P Meshlet Cluster Tint [0.0, 1.0, 0.05]

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

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);
}

// Curl-noise 2D wind velocity for advecting drifting sub-pixel spores
vec2 curlWind(vec2 p, float t) {
  float a = sin(p.x * 3.2 + t * 0.55) * cos(p.y * 2.9 - t * 0.42);
  float b = cos(p.x * 4.7 - t * 0.38) * sin(p.y * 4.1 + t * 0.61);
  return vec2(cos(a * 2.4 + b), sin(b * 2.4 - a)) * 0.14 * P_WIND_CURL;
}

// Renders 4 depth-ordered opaque GPU-driven meshlet foliage clusters; returns (rgb, linearDepth)
vec4 evalMeshletCanopy(vec2 p, float t) {
  // Sunlit twilight forest glade sky backdrop
  vec2 sunPos = vec2(0.04, 0.24);
  float sunD = length(p - sunPos);
  vec3 col = mix(vec3(0.025, 0.055, 0.068), vec3(0.14, 0.24, 0.22), clamp(p.y + 0.55, 0.0, 1.0));
  col += vec3(1.15, 0.82, 0.38) * exp(-sunD * 3.8) * P_BACKLIGHT * 0.72;
  col += vec3(1.4, 1.15, 0.72) * exp(-sunD * 14.0) * P_BACKLIGHT;
  float depth = 10.0;

  // 4 layered botanical fern/canopy boughs (back to front, depth = 6.5 down to 1.6)
  for (int layer = 3; layer >= 0; layer--) {
    float fl = float(layer);
    float zL = 1.6 + fl * 1.65;
    float sway = 0.03 * sin(t * 1.2 + fl * 1.7 + p.y * 3.0) * (0.4 + 0.6 * P_WIND_CURL);
    vec2 q = p + vec2(sway, 0.0);
    // Arching branch spine entering from left/right alternating by layer
    float side = (mod(fl, 2.0) < 0.5) ? -1.0 : 1.0;
    float bx = (q.x * side + 0.48);
    float archY = -0.32 + fl * 0.18 + 0.36 * sin(bx * 2.4 + fl * 0.5) - 0.24 * bx * bx;
    float dy = q.y - archY;

    // Cluster of segmented meshlet leaflets along the arching bough
    float seg = bx * (10.0 + fl * 2.5);
    float segId = floor(seg);
    float segF = fract(seg) - 0.5;
    float leafSide = sign(dy + 1e-4);
    float leafLen = (0.14 - 0.015 * fl) * smoothstep(0.0, 0.15, bx) * smoothstep(1.05, 0.65, bx);
    float ady = abs(dy);
    float leafMask = step(0.0, bx) * step(bx, 0.98) * smoothstep(leafLen, leafLen * 0.2, ady)
                   * smoothstep(0.42 * (1.0 - ady / max(leafLen, 0.02)), 0.05, abs(segF - ady * 0.8));
    float stemMask = step(0.0, bx) * step(bx, 0.96) * smoothstep(0.016, 0.004, ady);
    float mask = clamp(leafMask + stemMask, 0.0, 1.0);

    if (mask > 0.15) {
      // Subtle meshlet cluster ID tint (demonstrating 64-vert leaf clusters) + backlit subsurface glow
      float mId = mod(segId + fl * 2.0, 4.0) / 3.0;
      vec3 meshTint = mix(vec3(0.11, 0.28, 0.14), vec3(0.22, 0.42, 0.18), mId);
      vec3 baseLeaf = mix(vec3(0.13, 0.30, 0.15), meshTint, 0.35 + 0.65 * P_MESHLET_VIS);
      float sss = exp(-sunD * 2.6) * (0.35 + 0.65 * leafMask) * P_BACKLIGHT;
      vec3 lit = baseLeaf * (0.28 + 0.65 * exp(-zL * 0.18)) + vec3(0.46, 0.68, 0.18) * sss * 0.85;
      lit = mix(vec3(0.04, 0.09, 0.10), lit, exp(-zL * 0.14));
      col = mix(col, lit, mask);
      depth = zL;
    }
  }
  return vec4(col, depth);
}

// Sub-pixel fixed-point compute point rasterization of curl-advected luminous spores depth-tested against canopy
vec3 evalAtomicSpores(vec2 p, float sceneDepth, float t) {
  vec3 accum = vec3(0.0);
  // 5 depth slabs of dense stochastic micro-spores (depths 1.1 to 7.2)
  for (int slab = 0; slab < 5; slab++) {
    float fs = float(slab);
    float zSpore = 1.1 + fs * 1.45;
    // Strict depth test against opaque meshlet canopy depth buffer
    if (zSpore > sceneDepth) continue;
    float gridN = (22.0 + fs * 11.0) * (0.75 + 0.25 * P_SPORE_DENS);
    vec2 wind = curlWind(p * (0.8 + fs * 0.2), t * (0.7 + fs * 0.15));
    vec2 drift = vec2(t * (0.045 + 0.015 * fs) * P_WIND_CURL, t * 0.028) + wind;
    vec2 gp = (p - drift) * gridN;
    vec2 cell = floor(gp);
    vec2 f = fract(gp) - 0.5;
    // Check 3x3 neighborhood so drifting sub-pixel points never clip at cell boundaries
    for (int dy = -1; dy <= 1; dy++) {
      for (int dx = -1; dx <= 1; dx++) {
        vec2 cId = cell + vec2(float(dx), float(dy));
        float spawn = hash21(cId + fs * 31.7);
        if (spawn > clamp(0.42 * P_SPORE_DENS, 0.05, 0.92)) continue;
        vec2 rnd = hash22(cId + fs * 19.3);
        vec2 ptPos = vec2(float(dx), float(dy)) + (rnd - 0.5) * 0.78;
        float d = length(f - ptPos);
        // Sub-pixel sharp core + additive fixed-point halo
        float core = exp(-d * d * (62.0 + fs * 18.0));
        float halo = exp(-d * d * 12.0) * 0.24;
        float pulse = 0.55 + 0.45 * sin(t * (2.4 + rnd.x * 3.0) + rnd.y * 6.283);
        // Sunlit warm amber spores + bioluminescent mint pollen
        vec3 spCol = mix(vec3(1.15, 0.88, 0.36), vec3(0.42, 1.05, 0.78), smoothstep(0.65, 0.95, rnd.y));
        float depthFade = exp(-zSpore * 0.14);
        accum += spCol * (core * 1.85 + halo) * pulse * depthFade * P_BACKLIGHT;
      }
    }
  }
  return accum;
}

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 useSpores = uv.x > 0.0;
  vec2 p = vec2(useSpores ? (uv.x - 0.25) : (uv.x + 0.25), uv.y);
  p.x *= 1.85;

  vec4 canopy = evalMeshletCanopy(p, iTime);
  vec3 col = canopy.rgb;
  if (useSpores) {
    col += evalAtomicSpores(p, canopy.a, iTime);
  }

  col = acesTone(col);
  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

Meshlets (cluster rendering) clusters branches, ferns, and broad leaves into compact triangle packets for per-cluster culling. GPU-driven rendering culls visible clusters on the GPU, renders opaque foliage in a single indirect draw pass, and outputs the scene depth buffer and shaded canopy color. Compute-Shader Atomic Fixed-Point Sub-Pixel Point Rasterization reads that depth buffer for early occlusion rejection, simulates and projects millions of sub-pixel spores and fine micro-foliage particles in compute, and splats surviving points directly into a packed screen buffer using fixed-point depth+color atomic min (or additive fixed-point accumulation for glowing spores) before resolving over the opaque frame.

How to build it

In WebGPU (using 32-bit atomicMax/atomicAdd pairs) or Vulkan/D3D12 (native 64-bit image/buffer atomics), first run GPU-driven frustum and Hi-Z culling over meshlet-packed foliage and draw the opaque pass to populate color and linear/reverse-Z depth. Next, dispatch a compute shader over a million+ particle/spore buffer updated by curl-noise wind; transform each point to clip space, discard if outside the frustum or behind the opaque depth texture, and either commit a packed (quantizedDepth << 32) | packedRGB via atomicMin for opaque sub-pixel dust/needles or accumulate fixed-point RGB energy via atomicAdd for translucent sunlit spores. Finally, run a full-screen resolve pass that unpacks the atomic visibility/accumulation buffer and composites it with the opaque foliage frame.

Field marks

  1. Heavy atomic contention on densely overlapping spore clouds stalls GPU L2 caches unless particles are spatially pre-culled or early-rejected against a coarse depth value.
  2. Single-pixel compute points shimmer severely under camera motion without temporal anti-aliasing or sub-pixel bilinear splatting.
  3. WebGPU lacks native 64-bit buffer atomics on many devices, forcing either split 32-bit depth-then-color passes or additive-only accumulation.
  4. Hard handoffs between meshlet leaves and point-rasterized distant needles pop visually if screen-size hysteresis is missing.

Prior art

  1. mrdoob/codevember-2026. Open-source botanical demo combining GPU-driven meshlet foliage with atomic fixed-point compute point rasterization for drifting spores; listed here as an untested Arena cross awaiting a standalone WebGL2 reproduction.