Experimenting with Voxels

1 minute read

Boxels! Voxels rendered as boxes! There is a very popular boxel game in which you mine and craft. We all know it and love it.

So I wanted to make my own! I mostly wanted to learn how the rendering works, so that’s where most of the development of this project went. Not much gameplay at all. So I guess you could call it more of a tech demo than a game, but I’m still immensely happy with it! I learned a great deal and implemented some really cool features:

  • Partially optimized (but still naive) mesh generation
  • Voxel physics - specialized raycasting & player-voxel collider
  • 2d texture array shader
  • Transparent texture shader
  • Visual block highlighting (built into the shaders)
  • Visual block damage progression (built into the shaders)
  • Per-vertex lighting w/ natural sunlight propagation and support for additional light sources
  • Fluid blocks with propagation

This was my first time writing shaders for Unity, and my first time doing this particular kind of work in shaders. I gained a much deeper level of understanding of the graphics pipeline.

Here’s the GitHub repo: https://github.com/kotae4/VoxelPrototype
And here’s a little showcase of those features:

Foo
Image: Collage of 4 screenshots: 1. Per-vertex lighting on textured voxels 2. Block highlighting and damage progression 3. Fluid propagation 4. Transparent glass block rendering