4

I have a world full of voxels, lets say that my world is 320*320*96 voxels. My idea is to load that entire world into the ram of my videocard so that no peformance is lost in transferring new "chunks" to the GPU. The amount of faces generated to display that voxelworld should easyly fit into the memory of modern graphic cards.

However, the problem I am facing now it how to not display parts of that world, I want to limit the view of this world to (for example) 128*128*96 and shift the world or the camera around to show different parts.

To demonstrate my problem, have a look at a (simple) scene consisting of a ground with in white the "viewable" area, I am looking for the right WebGL/three.js functions to restrict the view to just the white part.

the voxelworld

windwarrior
  • 456
  • 2
  • 11

1 Answers1

3

You could remove voxels you don't want to display from the scene.

scene.remove( mesh )

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

scene.add( mesh )

I recommend splitting your voxel world into chunks (like Minecraft) and making those chunks into meshes individually. Add the chunk meshes that you want visible to the scene and remove them when you want to hide them.

Alex Mund
  • 431
  • 3
  • 9
  • That only partly solves my problem, I actually want to show/hide single strips of voxels at a time, and my chunks are 16*16*16 – windwarrior Apr 25 '14 at 13:13
  • @windwarrior Then what's the point in using chunks to organise your voxels? – Alex Mund Apr 29 '14 at 17:44
  • So that changing a single block does not invalidate the entire voxel world ;) – windwarrior Apr 30 '14 at 11:53
  • Do you want like a scene (in the white square) in a scene ? you may take a look at [this topic](http://stackoverflow.com/questions/18670724/three-js-multiple-views-to-multiple-canvasses-by-object-cloning-pitfalls) then – user3241019 Apr 30 '14 at 12:51