Usually to render a large quantity of gird aligned cubes is to use a method known as "Marching cubes". ***Note**: the main alternative is to use ray casting and voxels ([point clode][1] data), which is less common in video games, however it is the standard in [medical imaging][2]. See also: [A Fast Voxel Traversal Algorithm for Ray Tracing](http://www.cse.yorku.ca/~amana/research/grid.pdf).* You will see "Marching cubes" come up often when people talk about improving the performance of "voxels". The idea is that you will be iterating over the array of cubes and merging them into a single mesh in such way that hidden faces are removed, and also merges co-planar adjacent faces. However, what I have described so far is simply [Meshing](https://0fps.net/2012/06/30/meshing-in-a-minecraft-game/). --- Marching cubes (no quotes this time) goes a step further. In a similar way to how you can [pick a tile from a tilemap based on its neighbors](https://web.archive.org/web/20150906102436/http://www.saltgames.com/2010/a-bitwise-method-for-applying-tilemaps/) (Autotiling), [Marching cubes][3] will pick polygons depending on the neighbor cubes. *See also [Combinations for tiling two textures together](https://gamedev.stackexchange.com/questions/148460/combinations-for-tiling-two-textures-together).* The original paper on Marching Cubes describes 15 configurations: [![Marching Cubes configurations][4]][4] You pick one with a lookup table (considering symmetries) based on where you had a cube and where not. *See also [Nvidia GPU Gems 3 - Chapter 1](https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch01.html).* You do not have to use the same set of cases as described here. Hopefully you can see how you could edit this to match what you want. --- Finally, if we do Marching cubes minus the Meshing, you would not be merging the cubes into a single mesh... instead you would simply identify what vertices are hidden and what vertices are visible and pick/modify the meshes depending on that. *Wait, that is what you are doing. Huh.* [1]: https://en.wikipedia.org/wiki/Point_cloud [2]: https://en.wikipedia.org/wiki/Medical_imaging [3]: https://en.wikipedia.org/wiki/Marching_cubes [4]: https://i.sstatic.net/rNw3T.png