I am working on a game with blocky graphics -- similar to Minecraft. My world generation algorithm is similar to the Diamond-Square algorithm. The terrain was initially too rough and uneven, so I created a smoothing algorithm and allowed for the generation of hills.

Before the smoothing algorithm does its job, there are about 900 (+/- 100) cubes. After the smoothing algorithm finishes its task, there are about 1200 cubes. The resulting terrain is satisfyingly smooth and even, but the FPS decreases.

At first I couldn't create a 10x10 world without crashing. I figured it was because I kept binding and unbinding the same VAO for every block, so I changed that because every block uses the same VAO. It continued to lag and eventually crashed, so I tried to see if it was a problem with the terrain generation.

I found out that there was an infinite loop in the generation process, so I fixed that. It worked, but not well enough. It generated a 10x10 world and doesn't crash, but it runs at only 5 FPS, sometimes less. I then enabled back-face culling. The FPS improved a little, but only by 1-2 FPS. I still haven't implemented frustum/occlusion culling.

Is there an amazingly helpful culling/optimization technique I should know about?


You can check every block if it is exposed to air (=no other block) on any side or completely enclosed. Those which are completely enclosed shouldn't be rendered as they are not visible anyways. This shouldn't be done during every render call, you should only perform such checks if they are necessery. A possibility is that every surrounding block is checked if a specific block gets changed in any form (in Minecraft this is referred to as block updates). If you perform frustum culling at any time, I would advise you to only check for chunks and not every single block, since it would probably be overkill and only result in a performance loss compaired to rendering a few blocks that might be outside of the view frustum but inside a chunk that touches the view frustum.

Also it is really bad performance-wise to render every block with a seperate draw call. There are various different methods depending on your target OpenGL version. There are other resources though that cover this, take a look at this.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.