Website powered by

GPU Procedural Terrain and Actors (VR)

Unity Compute Procedural Systems: I've built a voxel terrain and chunk loader using marching cubes with a noise inspired by Ryan Geiss' GPUGems submission. The actors are memory-efficient utilising bitonic merge sorting and append/consume buffers. Both the Player and the fish fully react to terrain in real-time generated distance fields.
This is a VR prototype and is runs around 240fps in desktop VR with a 3080, displayed on a Meta Quest 3.

Each chunk performs a density function at a given resolution; extracting precalculated noise from texture volumes. I am using the Marching Cubes algorithm to connect any points within a voxel and return us the valid triangles.

Realtime collisions possible by testing the player's distance to the voxels within a given radius. I perform Bresenham's Line algorithm to filter out obscured meshes in a line of voxels as we dont need to apply their forces.

Realtime collisions possible by testing the player's distance to the voxels within a given radius. I perform Bresenham's Line algorithm to filter out obscured meshes in a line of voxels as we dont need to apply their forces.

Biome specific actor generation possible by testing each voxel in a given chunk for a valid actor. Valid actors are added to an append buffer and sorted with Bitonic Merge Sort algorithm. They are rendered with Graphics.RenderMeshIndirect.

Biome specific actor generation possible by testing each voxel in a given chunk for a valid actor. Valid actors are added to an append buffer and sorted with Bitonic Merge Sort algorithm. They are rendered with Graphics.RenderMeshIndirect.

10k fish are generated per chunk on the underwater biomes. There are 4 fish species. They follow the Boids algorithm and each perform a distance check to the terrain. Spatial Binning where 1 bin = 1 voxel helped with performance.

10k fish are generated per chunk on the underwater biomes. There are 4 fish species. They follow the Boids algorithm and each perform a distance check to the terrain. Spatial Binning where 1 bin = 1 voxel helped with performance.