Anothercraft - visualisation of a procedurally generated voxel terrain
A master thesis project. Basically a Minecraft clone, I was focusing on accelerating things on GPU. There is a master thesis text in the repository, however it is in Czech. There's also a first few chapters of the english master thesis translated, then I lost the drive. I might eventually document some of the techniques on a blog or something.
Feel free to get inspired by the code. I'd be glad if you noticed me if you intend to use the code, no real limitations from my side, though. I probably won't be continuing on this project unless I get paid :D
Minecraft-like lighting system, but RGB and accelerated on GPU (light spread computing). Deferred shading. The way the model is designed results in a native ambient occlusion. (I'm sampling from a 3D light map texture, nodes are in centers of blocks, I offset the sampling position by half of the normal.
Block face aggergation. I am optimizing the rendered primitive count by aggregating neighbouring faces of blocks into one larger primitive. Calculation of this (together with calculation of which block faces are actually drawn) is done on GPU.
GPU-accelerated frustum culling.
Depth peeling (3 layers).
GPU-accelerated terrain generation. You program the generator on the CPU though (I have a wrapper for that). There are 2D/3D Perlin noise and Voronoi diagram thread cooperation shaders implemented. The generation is however quite slow, loading from a disc is like 10x faster and does not lag the game.
Even though a lot of stuff is accelerated on the GPU, you can still have custom block shapes and have practically a full control from CPU.
You can go to view distances up to 64 chunks and it still works quite well if you have a decent graphics card (you'll need 6 GB of VRAM for that though).
Memory requirements: 4 B per block on both RAM and VRAM. Chunk size is the same as in Minecraft.
I'm storing the save game in a SQLite database, which works quite well (compressed with zlib).
How to build
There are Windows x64 and x86 binaries in the repository. It should compile on Linux, however there seems to be some problems.
Install a D compiler (preferably dmd, http://dlang.org, sudo apt-get install dmd-compiler)
(Already done for you for Windows) Download appropriate CSFML binaries from https://www.sfml-dev.org/download/csfml/ (version 2.4; or build them, whatever makes you comfy).
(Already done for you for Windows) Put the shared libraries in the bin_XX folder & the static libraries in the lib_XX folder (the XX is for example x86, x86_64 or so depending on the architecture).
请发表评论