Chunk Class for Unity Voxel Engine (Example)

Standard

Here’s an example of a Chunk class i use in some variants of the engine. This one is a bit experimental but working OK so far.

chunk

 

Creating a grid mesh programmatically in Unity 3D

Standard

Some old voxel lighting code

Standard

If you look at some of the previous posts you will see this code or a variant of it in use. It may be useful to some. It is very much a hack and i hope to revisit it perhaps in c++ or java.

LWJGL OpenGL VBO Issue on Linux

Standard

I struggled for a while with some code that generates 2 triangles using indices with more modern OpenGL methods. It worked fine when run on my windows boxes but not on my 2011 MBP running linux. There were no errors or anything i could see (i may not have configured the error checking correctly)

The issue was resolved by replacing the video driver. The xorg driver while it did support some OpenGL functions, did not apparently allow VBO. So if you notice issue with VBO/VBA code on linux where it runs fine on windows, try swapping out your graphics card drivers.

Below is the code used for the loader class thanks to ThinMatrix @ youtube who has some excellent tutorials for lwjgl.

Compressing Voxel Data

Standard

My first attempt at saving and loading voxel data seems to work reasonably well. It manages to save approx 4 million voxel points in about 64kb which seems reasonable. The compression ratio would decrease as the usefulness of RLE (Run Length Encoding) wanes due to excessive fragmentation. What remains to be done is to only save those blocks that have changed along with the seed. I’m not building never ending minecraft type worlds so i’m dealing with known quantities here. Currently it just savesĀ and loads everything, surprising quickly.