Hello everyone, I am trying to code my first voxel game. So far, I have the 3d camera and cubes loading to the screen. However, when I try to expand the terrain, there is a lot of lag because Processing has to render a lot more vertices. If I would try loading 10,000 cubes to the screen, the game would freeze. How would I cut down on the number of vertices being rendered and still load the same image as when I don’t cut any of them?
I dont know much about P3D but maybe you could create a PShape?
Not sure this is voxel specific, but you’ll want to consider your viewing angle and then manage the order of the vertices and therefore cull the non visible vertices. Ray tracing, marching cubes, octrees come to mind.
Sebastian Lague has an implementation in c# along with an in depth tutorial of the marching cubes algorithm.
Thanks for the suggestion, how would I order the vertices to get rid of the non-visible ones? Also, if this may help, the way that I make cubes are by making a face class so that I can get data from each face of the cube, and take 6 of those faces to make a cube.
Unfortunately this is not currently my area of expertise. But again if you search for Sebastian Lague’s channel on youtube he’s got a great channel on terrain generation. He goes through the whole process, with an short overview first so you can know which section in particular can help.
Also don’t be worried about the fact he is coding in unity. It is so similar that one can convert to java without too much difficulty.