---
id: "meshlets"
title: "Meshlets (cluster rendering)"
aliases: [clusters, mesh clusters]
domain: "performance"
stage: "performance"
realtime: "realtime"
platforms: [webgpu, desktop-gpu, unreal]
year_introduced: 2018
inputs: [mesh]
outputs: [mesh]
style: "both"
dynamic: "both"
cost: "cheap"
authority: "zeux, 2016"
url: "https://texelatlas.vercel.app/t/meshlets/"
sources_verified_at: "2026-11-29"
---
# Meshlets (cluster rendering) (zeux, 2016)

> Partition a mesh into small clusters of up to a few dozen vertices and about a hundred triangles, each with bounds and a normal cone, so the GPU can cull and draw them as independent units.

## Reach for it when

- cull geometry at finer level than whole objects
- split large meshes for gpu processing in small clusters
- need data layout for cluster lod
- back-face cull groups of triangles together
- prepare meshes for mesh shaders

## How it works

An offline builder walks the triangle list and greedily grows clusters that stay within a vertex and triangle limit, preferring triangles that share vertices and are spatially close. Each meshlet gets a local vertex list referencing the global buffer, a micro index buffer with byte-sized indices, a bounding sphere, and a normal cone describing the range of facing directions.

At runtime a compute or task shader tests every meshlet against the frustum, the cone against the view direction, and optionally a depth pyramid. Survivors are drawn through a mesh shader or by software expansion into an index buffer. Because clusters are small and uniform, they also serve as the unit of LOD selection and streaming.

## When to use it

Choose it as the data layout for GPU-driven culling at sub-object granularity or as input to a cluster LOD scheme. Prefer [Mesh shaders](https://texelatlas.vercel.app/t/mesh-shaders.md) for the hardware path that consumes meshlets directly. Prefer whole-object culling in [GPU-driven rendering](https://texelatlas.vercel.app/t/gpu-driven-rendering.md) when meshes are small or few, since meshlet overhead then buys nothing.

## Cost

cheap — Culling cost scales with meshlet count, not triangles; extra memory for bounds and micro indices.
Measured GPU Weight: 35.62× baseline (heavy) — 1.1186 ms median / 1.1418 ms p95 on Tesla T4/PCIe/SSE2 @ 1920x1080 (opengl-timer-query).
Ada L4 scaling: 30.14× baseline (heavy) — 0.4762 ms median (2.35× faster on L4).
Ampere A100 scaling: 21.87× baseline (heavy) — 0.6299 ms median (1.78× faster on A100).

## Failure modes

- Poorly sized meshlets waste lanes on some GPUs, since optimal limits differ between vendors
- Normal cone culling is weak on curved or noisy meshes and can reject nothing
- Rebuilt clusters of skinned or deforming meshes have stale bounds unless inflated
- Thin or scattered geometry produces many tiny underfilled meshlets

## Engine support

- metal: builtin — `MTLMeshRenderPipelineDescriptor (objectFunction + meshFunction cluster shading pipeline)` (evidence: https://developer.apple.com/tutorials/data/documentation/metal/mtlmeshrenderpipelinedescriptor.json, checked 2026-12-01)
- threejs: official — `import { createMeshlets } from 'three/addons/utils/MeshletGeometryUtils.js'` (evidence: https://github.com/mrdoob/three.js/blob/r187/examples/jsm/utils/MeshletGeometryUtils.js, checked 2026-12-01) — WebGPU meshlet examples built on meshoptimizer.
- unreal: builtin — `Nanite encodes Static Meshes into hierarchical triangle clusters (meshlets) for per-cluster culling and LOD` (evidence: https://dev.epicgames.com/documentation/en-us/unreal-engine/nanite-virtualized-geometry-in-unreal-engine, checked 2026-12-01)

## Dataflow

- Inputs: mesh
- Outputs: mesh
- Platforms: webgpu, desktop-gpu, unreal

## Presets

### meshoptimizer meshlet build limits (json-params; parameter preset)

```json
{
  "max_vertices": 64,
  "max_triangles": 126,
  "cone_weight": 0
}
```

Attribution: Values from the meshoptimizer README for NVIDIA GPUs (MIT license); raise cone_weight toward 0.25 if cone culling is used.; basis: 0

### Meshlets — 3D cluster partitioning & normal-cone backface culling visualization (glsl-fragment; rendered 2026-11-30)

```json
{
  "P_CLUSTER_SIZE": 6,
  "P_CONE_CULL": 0.75,
  "P_WIRE_ALPHA": 0.75,
  "P_ROT_SPEED": 1
}
```

```glsl
const float P_CLUSTER_SIZE = 6.0; // P Meshlet Scale [3.0, 12.0, 0.25]
const float P_CONE_CULL = 0.75; // P Normal-Cone Cull [0.0, 1.0, 0.02]
const float P_WIRE_ALPHA = 0.75; // P Cluster Seams [0.0, 1.5, 0.05]
const float P_ROT_SPEED = 1.0; // P Orbit Speed [0.0, 2.5, 0.05]

mat2 rot2(float a) { float c = cos(a), s = sin(a); return mat2(c, -s, s, c); }

vec3 hash33(vec3 p) {
  p = fract(p * vec3(0.1031, 0.1030, 0.0973));
  p += dot(p, p.yxz + 33.33);
  return fract((p.xxy + p.yxx) * p.zyx);
}

// Sculpted organic-mechanical knot for meshlet clustering
float mapMesh(vec3 p, float spin) {
  vec3 q = p;
  q.xz = rot2(spin * 0.42) * q.xz;
  q.yz = rot2(0.32 + 0.15 * sin(spin * 0.5)) * q.yz;
  float ang = atan(q.z, q.x);
  float rMaj = 0.72 + 0.10 * cos(ang * 3.0);
  vec2 tq = vec2(length(q.xz) - rMaj, q.y + 0.10 * sin(ang * 3.0));
  float dT = length(tq) - 0.30;
  float dS = length(q) - 0.34;
  // Smooth union between core and trefoil ring
  float k = 0.16;
  float h = clamp(0.5 + 0.5 * (dS - dT) / k, 0.0, 1.0);
  return (mix(dS, dT, h) - k * h * (1.0 - h)) * 0.85;
}

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

// 3D Voronoi meshlet assignment returning (clusterCenterObjSpace, seamDist, clusterHash)
void evalMeshlet(vec3 objP, float scale, out vec3 centerObj, out float seam, out vec3 mCol) {
  vec3 sp = objP * scale;
  vec3 n = floor(sp);
  vec3 f = fract(sp);
  float d1 = 8.0, d2 = 8.0;
  vec3 bestCell = vec3(0.0);
  vec3 bestSite = vec3(0.0);
  for (int z = -1; z <= 1; z++) {
    for (int y = -1; y <= 1; y++) {
      for (int x = -1; x <= 1; x++) {
        vec3 g = vec3(float(x), float(y), float(z));
        vec3 o = hash33(n + g);
        vec3 r = g + o - f;
        float d = dot(r, r);
        if (d < d1) {
          d2 = d1;
          d1 = d;
          bestCell = n + g;
          bestSite = (n + g + o) / scale;
        } else if (d < d2) {
          d2 = d;
        }
      }
    }
  }
  centerObj = bestSite;
  seam = sqrt(d2) - sqrt(d1);
  vec3 h = hash33(bestCell * 1.9 + 7.3);
  // Crisp categorical meshlet palette
  mCol = 0.24 + 0.72 * h;
}

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 spin = iTime * max(P_ROT_SPEED, 0.0);
  float scale = clamp(P_CLUSTER_SIZE, 2.5, 14.0);
  float cullDemo = clamp(P_CONE_CULL, 0.0, 1.0);
  float wireAmt = clamp(P_WIRE_ALPHA, 0.0, 1.5);

  vec3 ro = vec3(0.0, 0.15, 2.55);
  vec3 rd = normalize(vec3(uv, -1.5));

  vec3 col = mix(vec3(0.035, 0.045, 0.07), vec3(0.095, 0.115, 0.16), smoothstep(-0.55, 0.55, uv.y));
  vec2 bgG = abs(fract(uv * 10.0 - 0.5) - 0.5);
  col += vec3(0.02, 0.03, 0.045) * smoothstep(0.03, 0.0, min(bgG.x, bgG.y));

  float t = 0.0;
  bool hit = false;
  for (int i = 0; i < 64; i++) {
    float d = mapMesh(ro + rd * t, spin);
    if (d < 0.002) { hit = true; break; }
    t += d;
    if (t > 9.0) break;
  }

  if (hit) {
    vec3 p = ro + rd * t;
    vec3 n = calcNormal(p, spin);

    // Transform into object space so meshlet IDs stay rigidly attached to the mesh
    vec3 objP = p;
    objP.xz = rot2(spin * 0.42) * objP.xz;
    objP.yz = rot2(0.32 + 0.15 * sin(spin * 0.5)) * objP.yz;

    vec3 centerObj;
    float seam;
    vec3 mCol;
    evalMeshlet(objP, scale, centerObj, seam, mCol);

    // Compute meshlet bounding normal-cone test against a side-mounted "main camera" frustum
    // so the viewer can see which meshlets are front-facing vs backface-culled by the cone test!
    vec3 virtualView = normalize(vec3(0.75 * cos(spin * 0.25), 0.22, 0.72));
    // Transform cluster center back to approximate world normal direction
    vec3 cWorld = centerObj;
    cWorld.yz = rot2(-(0.32 + 0.15 * sin(spin * 0.5))) * cWorld.yz;
    cWorld.xz = rot2(-spin * 0.42) * cWorld.xz;
    vec3 coneAxis = calcNormal(cWorld, spin);
    float coneDot = dot(coneAxis, virtualView);
    // Meshlet normal cone cutoff (-sin(halfAngle))
    float coneCulled = smoothstep(0.18, -0.05, coneDot) * cullDemo;

    vec3 l1 = normalize(vec3(0.65, 0.85, 0.55));
    float diff = max(dot(n, l1), 0.0);
    vec3 hVec = normalize(l1 - rd);
    float spec = pow(max(dot(n, hVec), 0.0), 32.0) * 0.38;
    float rim = pow(1.0 - max(dot(n, -rd), 0.0), 3.0) * 0.30;

    // Active surviving meshlet shading
    vec3 activeCol = mCol * (0.28 + 0.80 * diff) + vec3(spec) + vec3(0.45, 0.68, 1.0) * rim;
    float seamEdge = smoothstep(0.085, 0.015, seam);
    activeCol = mix(activeCol, vec3(0.04, 0.05, 0.08), seamEdge * 0.78 * min(wireAmt, 1.2));

    // Normal-cone culled meshlet appearance: translucent hatched crimson wireframe
    float hatch = smoothstep(0.4, 0.8, sin((uv.x + uv.y) * 90.0));
    vec3 culledCol = mix(vec3(0.14, 0.05, 0.08), vec3(0.95, 0.22, 0.36), max(seamEdge * 0.9, hatch * 0.22));
    culledCol += vec3(0.95, 0.25, 0.42) * rim * 0.65;

    col = mix(activeCol, culledCol, coneCulled);
  }

  fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);
}
```

Attribution: Original interactive WebGL2 fragment shader written for Texel Atlas (MIT).

## Lineage

- extends [GPU-driven rendering](https://texelatlas.vercel.app/t/gpu-driven-rendering.md)
- extended by [Mesh shaders](https://texelatlas.vercel.app/t/mesh-shaders.md)
- extended by [Nanite virtualized geometry](https://texelatlas.vercel.app/t/nanite-virtualized-geometry.md)

## Combines with

- [Hierarchical-Z occlusion culling](https://texelatlas.vercel.app/t/hierarchical-z-occlusion-culling.md): Per-meshlet bounding spheres are tested against the depth pyramid to skip hidden clusters before rasterization.

## Combination ideas

- [Meshlet foliage with compute-rasterized atomic spores](https://texelatlas.vercel.app/ideas/meshlet-foliage-atomic-spore-raster/)
- [Meshlet kelp forests through underwater PSF scattering](https://texelatlas.vercel.app/ideas/meshlet-kelp-small-angle-underwater-psf/)

## Sources

1. [primary] zeux (2016) zeux/meshoptimizer. https://github.com/zeux/meshoptimizer License: MIT. (verified via github on 2026-11-29)
2. [tutorial] Arseny Kapoulkine Meshlet size tradeoffs. zeux.io. https://zeux.io/2023/01/16/meshlet-size-tradeoffs (verified via http on 2026-11-29)

## Cite this entry

Texel. "Meshlets (cluster rendering)." https://texelatlas.vercel.app/t/meshlets/ (accessed 2026-12-01).
