#Unity #C# #C++

Overview

The Idea

In 2023, myself and a friend set out to build a highly ambitious video game where a player could seamlessly traverse and dynamically reshape entire planets. Our philosophy was simple: there is a real chance this won't work, but let's see how far we can push it. The answer turned out to be "remarkably far." We built a system capable of procedurally generating full-scale planets composed of dynamic volumetric data, stored as voxels (3D pixels) — or in simpler terms, cubes.

Scale & Architecture

Achieving the scale we envisioned required rendering massive portions of each planet simultaneously. This demanded extensive work on level-of-detail (LOD) systems backed by octree data structures, building on techniques from my earlier MSc project. The result was a system that could handle planet-scale worlds while maintaining interactive frame rates.

GPU & Systems Programming

This project pushed me far deeper into GPU programming than I had ventured before — I gained hands-on experience with vertex, fragment, and compute shaders, applying them extensively throughout the project. It also marked my first deep dive into Unity ECS (Entity Component System), which I adopted to build a performant physics system tailored to voxel data.

Art & Community

Beyond programming, the project expanded my skills in Blender, where I animated tools, items, a player model, and monsters. I also explored Blender's Geometry Nodes system for the first time, building a custom "voxelizer" modifier that could be applied to any 3D model to give it a cubic aesthetic. The project gained traction on social media, accumulating roughly 100,000 views combined.

Technical Details

Rendering Approach

We initially explored a raymarching approach, a common technique for rendering octree data. After implementing a rudimentary yet functional version, its limitations became clear. Integrating lighting with Unity's native rendering pipeline proved difficult due to limited documentation, and the critical bottleneck stemmed from needing to upload the entire octree to the GPU every frame. This led us to pivot to a mesh-based rendering approach that worked within Unity's standard pipeline.

Key Features

  • Highly optimized rendering — each triangle is encoded into a single integer on the CPU and decoded on the GPU using bit shifting.
  • Multi-threaded architecture leveraging a custom thread pool system.
  • Native C++ plugins for performance-critical operations.
  • Compute shaders for sorting voxel data directly on the GPU.
  • Custom voxel physics built on a modified Unity ECS physics system with Unity Burst compilation.