gfaster / clod

Cluster-based dynamic level of detail based on UE5's Nanite

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cluster Based Dynamic Level of Detail

This was my final project submission for Harvard CSCI E-72, Introduction to Computer Graphics. A good portion the OpenGL rendering code was provided as template code but object loading and the simplification work was written by myself.

A demonstration can be found at this YouTube video

The project is a basic implementation of Unreal Engine 5's Nanite level of detail system, which is detailed in this talk.

Technique

This level of detail method provides a way to render multiple different LODs simultaneously on the same object without any cracks forming. The steps to do so are as follows:

  1. Partition the mesh into triangle clusters, minimizing the edge-cut. I use a cluster size of 64.

  2. Partition the clusters into groups of no more than 4, minimizing edge-cut. The weights of the edges are the number of triangle edges shared between the two clusters.

  3. Within the groups, perform edge collapse while keeping edges on the boundary between clusters locked. I use a simple minimum edge length metric over the superior quadric error metric.

  4. Within the simplified groups, repartition the triangles into new clusters.

  5. Repeat steps 2 through 4 until sufficiently simplified.

The result is a DAG that represents hierarchical level of detail without introducing high-detail boundaries between subtrees that would form in a more naive algorithm.

Running it

Currently, due to an unknown reason when moving to using the Debian repositories, running always results in a crash related to METIS.

Requires libOpenGL, libSDL2, libMETIS, g++, and make. This was last tested on Debian 12.

make clod

About

Cluster-based dynamic level of detail based on UE5's Nanite


Languages

Language:C 49.8%Language:C++ 48.6%Language:Python 1.0%Language:GLSL 0.5%Language:Makefile 0.1%