Voxel shader

HLSL shader

Introduction

An algorithm for the geometry shader stage in the graphics rendering pipeline that 'voxelizes' any 3D model from input. The shader essentially recreates the given 3D model with cubes, placing those at specific positions to match the original model as much as possible.
The size of the cubes is configurable, and decides the amount of cubes visible and thus the amount of detail in the voxel version of the mesh.
The color of the cube is mapped from the diffuse texture of the base mesh.

What I learned

I thoroughly studied the entire graphics rendering pipeline, and learned about each facet.
I got acquainted with the High-Level Shading Language and with FX Composer to test and debug my code.

Media