Simple Miner
![](https://static.wixstatic.com/media/bd49bc_d700d10490944374bdfb2d1f3620444bf000.jpg/v1/fill/w_812,h_487,al_c,q_85,usm_0.66_1.00_0.01,enc_avif,quality_auto/bd49bc_d700d10490944374bdfb2d1f3620444bf000.jpg)
Project Overview
Procedual Generation
Procedural map generation based on Perlin Noise, featuring grasslands, dirt, beaches, snowfields, rivers, oceans, and various vegetation according to different kinds of terrain,
![](https://static.wixstatic.com/media/bd49bc_c95b3f12cc9b4450a8a20a4e964a9058f000.jpg/v1/fill/w_475,h_267,al_c,q_80,usm_0.66_1.00_0.01,enc_avif,quality_auto/bd49bc_c95b3f12cc9b4450a8a20a4e964a9058f000.jpg)
Pocedual Generation
Code of Procedual Generation for Each Chunk
Hidden Surface Removal
Maintains around 600 FPS even with 100 million blocks by culling 99% of faces using backface culling to optimize performance. For each block, I only put verts in vertex buffer when the neighbor block is air.
![](https://static.wixstatic.com/media/bd49bc_9e07eefc692d4d73854372d9d4203206f000.jpg/v1/fill/w_475,h_267,al_c,q_80,usm_0.66_1.00_0.01,enc_avif,quality_auto/bd49bc_9e07eefc692d4d73854372d9d4203206f000.jpg)
Hidden Surface Removal
Code of Hidden Surface Removal for Each Block
Voxel Based Light
Every time when the player place a chunk, the block will use block iterator to check all the nearby blocks (16x16), and rebuild the chunk with light attenuation (16 initial intensity, -1 when iterate each block), and set the brightness in shader according to the light intensity.
![](https://static.wixstatic.com/media/bd49bc_fb7a8d6ea7b94e8a97b6044a528db069f000.jpg/v1/fill/w_373,h_210,al_c,q_80,usm_0.66_1.00_0.01,enc_avif,quality_auto/bd49bc_fb7a8d6ea7b94e8a97b6044a528db069f000.jpg)
Place GlowStone to the World
![](https://static.wixstatic.com/media/bd49bc_af8e21039ffc47979dc04e700eb0d284f000.jpg/v1/fill/w_373,h_210,al_c,q_80,usm_0.66_1.00_0.01,enc_avif,quality_auto/bd49bc_af8e21039ffc47979dc04e700eb0d284f000.jpg)
Voxel Light propagation
Process Light When Chunk is Dirty (Place/Remove Blocks)
Place / Dig Block
I used super fast raycast vs 3D block, and based on that, to improve the performance, I also used block iterator to acceleration the intersection process.
![](https://static.wixstatic.com/media/bd49bc_ced7df7311ec4652bfe19a87c14d840ef000.jpg/v1/fill/w_357,h_201,al_c,q_80,usm_0.66_1.00_0.01,enc_avif,quality_auto/bd49bc_ced7df7311ec4652bfe19a87c14d840ef000.jpg)
Place Block to the World
Code of Block Iterator Class
Raycast by using Block Iterator
Map Streaming
I used multithread to load only one chunk (32768) blocks every frame according to the players world position, and deactivate the chunk out of the max radius of the player.
I also used distance fog to cover the loading of new chunks.
![](https://static.wixstatic.com/media/bd49bc_8fef28283b3649a09a8d9187cafbc731f000.jpg/v1/fill/w_421,h_237,al_c,q_80,usm_0.66_1.00_0.01,enc_avif,quality_auto/bd49bc_8fef28283b3649a09a8d9187cafbc731f000.jpg)
Map Streaming and Fog
Code for Map Streaming
Screenshots
![sm1](https://static.wixstatic.com/media/bd49bc_5f1c94fe291f4728aab2eea6e52e8cb8~mv2.png/v1/fill/w_980,h_487,al_c,q_90,usm_0.66_1.00_0.01,enc_avif,quality_auto/bd49bc_5f1c94fe291f4728aab2eea6e52e8cb8~mv2.png)
![sm3](https://static.wixstatic.com/media/bd49bc_a9925f523d8d4ff78d57fdbddc23b745~mv2.png/v1/fill/w_980,h_493,al_c,q_90,usm_0.66_1.00_0.01,enc_avif,quality_auto/bd49bc_a9925f523d8d4ff78d57fdbddc23b745~mv2.png)
![sm4](https://static.wixstatic.com/media/bd49bc_15c3fae6053b4836a6e89dc1cd4e31f3~mv2.png/v1/fill/w_980,h_489,al_c,q_90,usm_0.66_1.00_0.01,enc_avif,quality_auto/bd49bc_15c3fae6053b4836a6e89dc1cd4e31f3~mv2.png)
![sm1](https://static.wixstatic.com/media/bd49bc_5f1c94fe291f4728aab2eea6e52e8cb8~mv2.png/v1/fill/w_980,h_487,al_c,q_90,usm_0.66_1.00_0.01,enc_avif,quality_auto/bd49bc_5f1c94fe291f4728aab2eea6e52e8cb8~mv2.png)