So many vertices!

Hi there!

In my project i have too much vertices. When i used VBO with indices buffer … after calculations i would need almost 1 GB memory in graphic card to store all of that.

Is there a better way to implement it, so it will be working fast ?

Thx for help :slight_smile:

There are quite a few solutions, but it depends on your hardware and your exact implementation…

  1. Try to reduce the size of your data. Use smaller elements for colour and indices.

  2. Move one portion out of the VBO and split the data across client and server space.

  3. Look very carefully at your indexing and see if there is any way to reuse more vertices.

  4. Put the vertex data into fenced memory that is almost as fast as GPU RAM.
    In all honesty I have found that properly allocated memory that the GPU has access to is almost always the same speed as having vertices in VBOs.

  1. store only mandatory data f.e. tangent, normal, binormal results in simple cross product (12 bytes per vertex saved) also if you dont need 4 floats for a data set use 3.

  2. GL_TRIANGLE_FAN / GL_TRIANGLE_STRIP to reuse as many vertices as possible.

  3. GL_UNSIGNED_SHORT for indices instead of GL_UNSIGNED_INT if possible (cuts memory usage in half for index buffers)

  4. last resort to keep data on CPU memory and render from there keeping the video ram untouched, alternatively in a compressed form. this one isn’t fast!

  1. This may also apply to other kinds of data e.g. a normal as 3 unsigned bytes (aligned to 4). Consider using ARB_half_float_vertex.

  2. I would be careful here. The TBN matrix is not always orthogonal on curved surfaces. However, it’s better than nothing.

  3. Have you considered simplifying your geometry? There are tools and algorithms for that eg. surface simplification using quadric error metrics.

  4. Streaming your data on-the-fly from disk may help too.

It’s hard to advise you something particular without knowing your data representation and its use…