Author: https://twitter.com/ldl19691031

For the global pipeline of Unreal Engine 5, please check this: https://www.notion.so/Brief-Analysis-of-UE5-Rendering-Pipeline-feedcb9174aa4af2af936fbb02a9e390

In this article, I will write my own analysis of Nanite's source code. I only want to touch on the basic progress but not try to analyze the ideas behind the Nanite. This much beyond my skill. For the ideas behind Nanite, I recommend waiting for the official SIGGRAPH presentation.

This is the offical page of Nanite : https://docs.unrealengine.com/5.0/en-US/RenderingFeatures/Nanite/

Also, this is also anther good analysis of Nanite: http://www.elopezr.com/a-macro-view-of-nanite/

And the official Inside Unreal talk: https://www.youtube.com/watch?v=TMorJX3Nj6U

WARNING: I'm not a developer of Epic, and this article may contains mistakes and mislead you. This article focus on the details of Nanite's source so I recommend you to at least watch the videos of Inside Unreal's Nanite talk.

Basic concepts

Nanite contains two parts: a pre-calculation system for preprocessing the meshes, generate mesh clusters and LODs; and a runtime system for loading and rendering.

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/aa573c70-58dc-44d3-abaa-80909ad5b370/Untitled.png

So, the clusters will be the basic elements of a Nanite mesh. During the rendering, Nanite needs to:

In order to explain the mini-map of Nanite, I created this image:

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/ceabc29f-5109-47ee-99c9-03ca4d4657c7/Untitled.png

First, Nanite generates a set of clusters based on the triangles, whichi becomes the leaf clusters.

Then, it will select a set of clusters as a new cluster group, and merge this group into a large cluster.(2 and 3)

Then, simplify this cluster, reduce the polygons but keep the boundary.(4)

Then, do a graph partition to split this large cluster into small parts. The parts are larger than the original clusters in (2)