"Culling" in the world of voxels

I have a world full of voxels, let's say that my world is 320 * 320 * 96 voxels. My idea is to load the whole world into the ram of my video card so that it will not be lost in transferring new "pieces" to the GPU. The number of persons generated to represent that voxelworld should fit easily into the memory of modern graphics cards.

However, the problem that I now face, how not to display parts of this world, I want to limit the representation of this world (for example) to 128 * 128 * 96 and move the world or camera around to show different parts.

To demonstrate my problem, look at a (simple) scene consisting of land with a white "visible" area, I am looking for the correct WebGL / three.js functions to restrict the presentation to the white part only.

the voxelworld

+4
source share
1 answer

You can remove voxels that you do not want to display from the scene.

scene.remove( mesh )

And add them to the scene when you want to display them.

scene.add( mesh )

I recommend dividing the voxel world into pieces (e.g. Minecraft) and making these pieces into grids individually. Add the pieces of cells that you want to see on the stage and delete them when you want to hide them.

+3
source

Source: https://habr.com/ru/post/1537419/


All Articles