Procedural Voxel Generation
Another minecraft "copy"...

Skills

Java OpenGL Programmable Pipeline Procedural Mesh Generation Perlin Noise GLSL Phong Shading

Software Used

IntelliJ IDEA

About

I developed this project in 2017 to study low level graphical programming, and to learn how to generate 3d models procedurally. in this case the voxels.


Performance

7+ million vertices at 200fps on a GTX 1050Ti


Smart Ambient Occlusion

What you see in the folds is not ambient occlusion, but darker vertex colors multiplying the texels.
What I did to calculate procedurally which vertices would be darker was:

  • Before starting to create the meshes, I have my voxel matrix already completely filled, so I know exactly where a voxel exists or not
  • For each voxel I drew the faces separately
  • My matrix starts at [0,0,0] -x, -y, -z
  • When I draw the top face of voxel [1, 1, 1], I look at the relative position +y-z [1, 2, 0], if I have a voxel in that position, it means that my two back vertices (-z) of the face I'm drawing will be dark
  • And I use the same logic for the four sides of the top face
  • And for each face I do these four checks
Img 01 Img 02 Img 03 Img 04 Img 05