- Home /
Minecraft-Style Culling
Hey everyone!
So I've been working on a minecraft-style adventure game made entirely of cubes. It creates the environment in runtime so the built-in baked occlusion culling doesn't seem to be an option. I've been unable to render a single chunk without dropping below 20 FPS. I would like to know if there was an easy, free way to cull everything that the camera can't see.
I've looked all over the forums but I haven't found anything that actually works for free.
Answer by Bunny83 · Mar 08, 2018 at 12:57 AM
You should look up one of the countless tutorials on Minecraft-like voxel terrain. From your short descriptions it seems what you try to represent each cube by a gameobject. This will not work out at all. You have to create a single mesh for a whole chunk section. Minecraft is splitted into sections of 16x16x16 cubes. When meshing such a section you actually iterate through all voxels and determine which sides are actually visible. In MC each cube type has a boolean property if this cube type is actually solid or transparent. If the neighbor voxel is solid you don't need to add this side of the cube to the mesh. So a chunk section that is completely "filled" and covered by the neighboring chunks or completely empty do not contain any mesh at all.
The actual generation of the voxel data and the meshing of each chunk is usually done in a background thread. Whenever you add or remove a block that chunk section need to be remeshed.
If you don't want to create your own voxel terrain engine you can use any of the freely available. One of the first for Unity was the minepackage.
Your answer
Follow this Question
Related Questions
Mobile Game starts lagging after a while when playing on my phone!!!! Pls Help!!! 1 Answer
Practical solutions for lag reduction? 1 Answer
Sprite Background Lags with Camera Script 0 Answers
Android build very laggy 0 Answers
Semaphore.WaitForSignal is causing so much lag on Android!!! Help!!! 1 Answer