Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am creating a terrain system using voxels in a somewhat minecraft-like style and I was wondering if there was anything I could do to increase the number of vertices I am able to store (and therefore render).

Based on different suggestions I have read I created a number of "chunks" of size 32x32x32 cubes and all of the vertices for these cubes are pre-calculated and stored in a VertexBuffer. I then have 7x7x7 of these creating a larger map. Therefore this is around 11 million cubes.

I was unable to render all 11 million cubes, so I removed any vertex in the buffer which would be completely hidden by an adjacent block (this removes all the interior/invisible surfaces/vertices). Overall this reduced the number of vertices by a factor of 36 in the simplified terrain example I am using!

However, this appears to be the absolute limit on the number of blocks I can render. This already takes about 1 GB of RAM according to the task manager (although the vertices themselves are closer to half of this - GC and all).

Do I have to simplify my terrain and/or accept this limit, or is there a better way to do this? I previously tried using instancing but that slowed down after only 20,000 cubes or so.

Thanks.

share|improve this question
    
Now that you have the chunks, you want to load and unload them based on their distance to the camera. Like a conveyor belt, unload them as they go out of range while loading the chunks coming into range. –  Byte56 Apr 7 '13 at 5:06
    
11 million cubes, what is your application? why so many voxels? I suppose not all voxels are used/visible at the same time, and there must be lots of them invisible at some instance. –  David Apr 7 '13 at 10:33
    
Have a look at this answer which may help you reduce the number of vertices you are rendering. –  Alex Apr 7 '13 at 11:46
    
Also here and here –  Byte56 Apr 7 '13 at 15:46
    
11mil cubes is 90mil vertexes, which at 16 bytes each is your 1.2GB amount. If you remove occluded vertices, or combine faces, you drop this figure gigantically. In a perfect, fully filled block, you would only ever need 8 vertices, or 128bytes. –  Phil Apr 8 '13 at 1:38
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.