← Back to all chapters

Chapter 17Down the Rabbit Hole: How Nanite Draws a Billion Triangles Without Cracks

7 min read
rabbit-holegraphicsgpulevel-of-detail

Epic's docs gave me a number that stopped me: a 1.5-million-triangle mesh takes 19.64 MB as Nanite, against 148.95 MB as a standard static mesh with 4 LODs. That's 7.6x smaller, and more detail up close. About 14.4 bytes per input triangle.

  • Static mesh, 4 LODs148.95 MB
  • Nanite19.64 MB
Epic's numbers for a 1.5-million-triangle mesh

Nanite is Unreal Engine 5's "virtualized geometry": drop film-quality scans straight into a game, and the triangles drawn scale with screen pixels, not scene size. The answer turned out to be two small invariants in an offline data structure. Brian Karis's SIGGRAPH 2021 talk is the primary source (155 slides); the rest comes from Epic's docs and re-implementers, and I flag what's uncertain.

The budget#

A 1080p screen has about 2.07 million pixels. At roughly one triangle per pixel you never draw more than ~2 million triangles, about 16,000 clusters of 128, whether the asset has a million triangles or a billion.

Classic LOD can't use that: someone must author several versions, objects pop between levels, and the CPU submits a draw call per object.

There's also a hardware problem at the small end. GPUs shade 2x2 pixel quads (they need neighbours for texture derivatives), so a one-pixel triangle still launches at least four lanes and wastes at least 75% of that work.

one 2x2 quad1 lane: useful work(the covered pixel)3 lanes: wasted(needed for texture derivatives)at least 75% of the work thrown away
A one-pixel triangle still shades a whole 2x2 quad. Schematic, not to scale.

Tiles with pinned borders#

Think of a map app: it cuts the city into tiles, keeps cruder versions of each, and loads only what your screen can show. Nanite chops a mesh into clusters of up to 128 triangles and builds coarser stand-ins. Every frame, every cluster asks in parallel: if I used the coarser version, would anyone notice?

The catch: neighbours decide independently, and independently simplified patches don't line up, which means cracks. Nanite's fix is to pin the borders. When a group is simplified, every vertex on an edge shared with a different group is locked. Fine and coarse patches then share exact vertices along the seam, like jigsaw pieces. No stitching, no skirts.

Why it has to be a DAG#

A locked border can never be simplified, so with fixed tiles the seams would stay dense forever. The fix is to re-cut the tiles every level so last level's borders fall inside the new groups.

One level of the offline build. Click a box.

Repeat until one root cluster remains. Because a simplified group splits into several clusters that get regrouped with different neighbours, a cluster can have more than one parent: a directed acyclic graph, not a tree.

rootcutdrawnfiner than needed, skippeddrawnshaded = drawn this frame
Three levels of a cluster tree and one cut through it. Illustrative: a real DAG is much wider and about 23 levels deep.

Yang et al. Figure 6: on the left, pairs of clusters merge into coarser clusters across four levels; on the right, three thresholds select different cuts through the same hierarchy.

Figure 6 from Yang et al., "Virtualized 3D Gaussians: Flexible Cluster-based Level-of-Detail System for Real-Time Rendering of Composed Scenes", arXiv:2505.06523, licensed CC BY 4.0. Cropped and recompressed.

Each level keeps about half the triangles, so the whole structure holds about T(1 + 1/2 + 1/4 + ...) = 2T triangles. A billion triangles is about 23 levels deep.

The rule each cluster checks#

Each cluster stores its own geometric error and its parent's, plus bounding spheres. Project the error onto the screen:

proj(e, d) = e * H / (2 * d * tan(fov / 2))
 
d = max(|camera - center| - radius, epsilon)   # nearest point of the sphere
H = screen height in pixels
 
draw cluster  <=>  proj(e_self, d_self) <= tau < proj(e_parent, d_parent)

With tau around 1 pixel: draw me if I'm fine enough and my parent isn't. Using the sphere's nearest point keeps the estimate conservative.

A worked example

Take a cluster with 0.8 cm of error whose parent has 1.9 cm, at 1080p with a 60 degree field of view. At 25 m the cluster projects to about 0.30 px and its parent to about 0.71 px. Both are under a pixel, so something coarser gets drawn and this cluster is skipped. Walk to 12 m and the parent grows to about 1.48 px while the cluster is about 0.62 px. Now the condition holds, and this cluster is the one drawn.

Two boring rules do all the work#

The rule runs on thousands of GPU threads with no communication. Why is the cut consistent, with no cluster drawn twice and no gap? It comes down to the record step.

  • Error is monotone: a parent's error is at least any child's.
  • Bounds are nested: a parent's sphere contains its children's, so the parent is never further from the camera.

Together, projected error never decreases walking up any path. So every leaf-to-root path crosses tau exactly once, and since siblings share the same parent numbers, the whole group switches together.

My 1-D toy tests this: a polyline as the mesh, clusters of 8 segments, groups of 4, each simplified to half with endpoints locked. It picks cuts for random cameras and checks the clusters tile the curve exactly.

1/3The DAG
DAG: 511 clusters, root err 60.817
3000 random cameras
The toy's result, with and without the two rules

Then rasterize, mostly in software#

Selected clusters go through frustum culling and a two-pass occlusion test. Pass 1 draws against last frame's hierarchical depth buffer and builds a fresh one. Pass 2 re-tests everything pass 1 rejected and draws what was wrongly culled. No CPU readback.

 survivors ──▶ big triangles  ──▶ hardware rasterizer ──┐
           └─▶ tiny triangles ──▶ compute rasterizer ───┤
                (a cluster per wave, atomic max          ▼
                 on a 64-bit value per pixel)     visibility buffer
                                                  depth | cluster+tri IDs
                                                         │
                                                         ▼
                                              shade once per pixel
Survivors are binned by triangle size.

Depth sits in the high bits so the nearest sample wins; the low bits carry cluster and triangle IDs, so the winning value is the visible triangle. Sources disagree on the exact bit layout and I couldn't confirm it against the slides.

The idea is alive in research: CuRast (2026), a CUDA software rasterizer, reports 2 to 5x the speed of Vulkan's hardware path on hundreds of millions of unique triangles, while Vulkan stays an order of magnitude faster on low-poly meshes.

Where it breaks#

The story assumes solid, opaque, rigid geometry.

Weak spotWhy
FoliageDisconnected leaves, grass and hair can't be merged without changing coverage: they vanish or stay dense. UE 5.8 docs answer with Nanite Foliage (instanced assemblies, voxels, bone-driven skinning); a 41M-triangle tree went from 3.5 GB to 29 MB.
AnimationBounds are computed offline, so a wind shader can push vertices outside them and the cluster is culled while visible.
Translucency, forward/mobileNot supported; needs the deferred pipeline.
Ray tracingAcceleration structures weren't built for per-frame cluster LOD. NVIDIA's RTX Mega Geometry (2025) is the hardware-side response.
CostMoves into material shading, shadows and memory. One community claim says Nanite loses below ~2M triangles per mesh; I'd treat that as blog-grade evidence.

The open question#

Aggregates. Pinned borders work because meshes have shared vertices to pin; foliage, hair and Gaussian splats don't. LODGE (NeurIPS 2025) hides seams by opacity blending instead, precisely because splats have no borders to lock. Epic's voxels are one production answer for trees.

Nobody seems to have a principled way to coarsen a canopy while keeping its silhouette, average colour and shadow at once. The cluster DAG made LOD for solid surfaces nearly solved. The fuzzy stuff is still open.

Sources#

© 2026 Bharat Kaurav. Built with Next.js & Tailwind.

>_ bk@netherwatcheresc to close

Welcome, reader. Type help to see what this shell can do.