top of page

Procedural Terrain Generator

2021

Key Words:

Coursework, DirectX, C++, CUDA, ProcGen

This study set out to investigate and evaluate performance of a tool enabling real-time alteration and generation of procedural terrain with a research question of “How can the GPU be used to improve performance of procedural generation techniques?”. The aim of this study was to create a tool enabling real-time alteration and procedural generation of realistic terrain with the goal of evaluating GPU usage in the enhancement of procedural generation techniques.


The developed solution used an existing DirectX framework with a base voxel project as a guide. An existing OpenGL Marching Cubes implementation was ported to this solution as a basic CPU implementation then recreated to enable parallelism with CUDA. Timers were placed in key areas of the CPU and GPU implementations, with more timers being placed throughout the GPU version due to it requiring parsing and allocation of device memory.


It was found that because the GPU implementation did not have any optimisations, despite its kernel function outperforming CPU marching cubes at voxel stack sizes of 20+ voxels cubed, the additional sections required to enable parallelism meant that GPU marching cubes was outperformed its CPU counterpart. Future research using CUDA should be careful to minimise transfers between device and host memory as well as consider a data-oriented programming approach to classes.


The application could be further improved with the addition of erosion algorithms such as Hydraulic and Thermal which would provide realistic details. The addition of triplanar texturing is another aspect that would enhance the realism aspect of the terrain. Further customisation of the terrain could also be enabled with the addition of controls such as modelling using the cursor, or the use of splines to define crests and ridges.

bottom of page