1
\$\begingroup\$

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.

\$\endgroup\$
6
  • \$\begingroup\$ 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. \$\endgroup\$
    – House
    Apr 7, 2013 at 5:06
  • \$\begingroup\$ 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. \$\endgroup\$
    – David
    Apr 7, 2013 at 10:33
  • \$\begingroup\$ Have a look at this answer which may help you reduce the number of vertices you are rendering. \$\endgroup\$
    – Alex
    Apr 7, 2013 at 11:46
  • \$\begingroup\$ Also here and here \$\endgroup\$
    – House
    Apr 7, 2013 at 15:46
  • \$\begingroup\$ 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. \$\endgroup\$
    – Phil
    Apr 8, 2013 at 1:38

1 Answer 1

1
\$\begingroup\$

I know this is an old post but I will send my reply for others to see. What you can do is possibly save ALL the chunks in their OWN chunk files on your computer. Have like two float/into variables

//disable the unseen chunks
float m_maxRenderDistance =100.0f; 

// Load the necessary chunk files into your game BUT have them disabled unless player distance is near the m_maxRenderDistance
float m_maxStartLoadDistance =150.0f; 

Of course since this post is old, you may have found a much better way of solving this. Just wanted to share what I have learned recently.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .