Dzung Nguyen

Back

Japanese-ink Minecraft

Posted on Dec 30, 2018

C++
OpenGL
QT Creator


I worked with Jake Lem and Thy Tran to apply the knowledge that we have learned in Computer Graphics course to create our personal take on the classic Minecraft game. Major concepts include GPU-CPU communication (vbos) with OpenGL, C++ code organization and optimization, game engine and game design. We used Git to manage and share our code.

Our theme is Japanese painting, so we went for a ink color scheme with bamboo trees. My roles in the project were creating the terrain with Fractal Brownian Motion noise algorithm. I also worked on multithreading for quicker terrain expansion, player swimming motion, sound effect, and setting up the pipeline for post-process effect like the Worley Noise water shader.

Minecraft
Terrain that expands infinitely in all directions generated with Fractal Brownian Motion.

For removing blocks, I just marched along the look vector of the ray from the camera point and if at any point there's a non-empty block (I used floor to find the bottom left corner coordinates), then I just set it to empty. Similarly for adding block, I also casted a ray, but this time I had to check for face intersections since simple checking if box is empty does not tell me where I need to place the new block.

I implemented an OpenGL shader first to test my FBM. At first I had a lot of difficulty trying to get it to be smooth and not as noisy, but all it took as dividing by a large number before inputting into the noise function. I also added cosine interpolation for smoother result instead of using mix.

Minecraft
Worley Noise underwater post-process shader.
Minecraft
Japanese-ink overlay shader. This can be easily toggled on and off thanks to Jake!

The post-process effect depended on a frame buffer handle. The scene view is rendered to a frame buffer, which is rendered as a texture on a screen-space quadrangle with a post-process fragment shader applied to it. When the player enters water, the screen is filled with a Worley Noise shader. Jake, one of my teammates, also added a feature in which if player can turn on a 2-pass post-process shader to make the world looks more Japanese-painting like. We did not make this the default shader since it slows down the gameplay.

I moved FBM calculations and creation of chunks to a different thread for faster gameplay. Integrating the river generation into the new thread was tricky since rivers are generated based on a L-System method in which it carves out the landscape, which means that parallel manipulation of data may happen very frequently and if not careful, can lead to lots of problem.

Here are some cool views of the landscape!

1 / 3
Rocky Mountains.
2 / 3
Night has fallen and time to stargaze...
3 / 3
And Snow!