I am creating a game in Unity where the game is rendered while playing. The game is made in a voxel style, and has thousands upon thousands of objects rendered while playing. Of course, this causes a huge amount of lag. Therefor I need to use occlusion culling, to make sure only the objects needed are rendered.

For occlusion culling, you need to bake the area, but I'm planning on creating a huge world. So, any tips on how I could do this?


1 Answer 1


Ok, so, voxels. Are you using a game object for each voxel? If so, there's your problem.

Minecraft (and clones) don't actually hold an object in memory that represents each individual block. They have an object that describes the block and then an array of IDs--usually integers, aka Block IDs (Stone is 1, dirt is 3, water is 9...)--used tor represent which block is in each location (and then a lot of lookups are performed). From there it computes a single mesh for an entire chunk based on visible sides (this is why X-ray cheats work). That way your entire render distance out to 160 meters is made up of only 441 actual objects (for the ground) each with 16k verts (depending).

This is a much easier problem to solve when it comes to occlusion culling. Namely: is it in front of the camera...or behind? And basically say "fsk it" about the underground spaces because the savings are slim.

  • \$\begingroup\$ Could you give me a little example of the structure? It doesn't have to be valid code, just an example of what the could would look like. \$\endgroup\$
    – FlorisdG
    Oct 2, 2016 at 9:48
  • \$\begingroup\$ I have not set up a voxel system in Unity, so I can't really provide code. I am, however familiar with how Minecraft functions because I do a lot of modding. The closest thing I've done was to create my geometry as separate objects and then run CombineChildren. But I don't have a need for terrain modification (breaking and placing blocks). \$\endgroup\$ Oct 2, 2016 at 16:32
  • \$\begingroup\$ Well, thanks anyway. I will not set this as the answer, but I will leave the answer once I have it and share it here. Thanks though, your answer really helped me. \$\endgroup\$
    – FlorisdG
    Oct 2, 2016 at 21:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .