Generating mesh...

Description

This program populates a 4D voxel grid with random data, then uses the dual contouring method to create a 4D mesh to send to the GPU for rendering. A shader then creates a 3D mesh which is a slice of the 4D mesh, and renders that. The view slowly rotates in 4D.

Dual contouring is an algorithm which, like marching cubes, can convert voxel data to a mesh, but it has certain advantages such as generalizing more easily to other grids (including non-uniform sized grids) and being more able to preserve sharp corners.