Rendering Efficiency: Many matrices vs. resubmitting points

Started by
2 comments, last by dpadam450 12 years, 3 months ago
Hi all,

I have a quick question regarding the computational costs of different methods of rendering a large set of points. Consider, for example, that you were trying to deform a solid on a per-point basis. I can think of two options for managing the deformation:

1) render each point one at a time, pushing and popping a new matrix containing the necessary translation information for each individual, pre-allocated point, or

2) calculate the new point positions, generate values locally, and then resubmit the vertex data to the gpu.

Which of these methods would ultimately yield the best performance? My gut feeling is that the second method is more likely to be "correct" however I fear that resubmitting a large number of points regularly could be bad. Are there any other methods for manipulating vertex data efficiently?
Advertisement
you have dynamic vertices
http://www.opengl.org/wiki/VBO_-_more#Dynamic_VBO

and general info
http://www.opengl.org/wiki/Vertex_Buffer_Object
http://www.opengl.org/wiki/VBO_-_just_examples
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
3) Send points in their baseline position once, keep them in a VBO, and deform the same points on the GPU in different ways every frame with a vertex shader that needs very little input (small textures to represent changing deformation shapes, low-dimension interpolation between key positions, and so on).

Omae Wa Mou Shindeiru

Your 3 point is exactly the same as his 2, because you still are sending new data to the GPU every frame.

Go with 2, but after updating make sure you stream the data into a VBO so that you aren't drawing 1 by 1. Do your updates and then send all the new positions once as one giant array of memory, and then draw it all at once (VBO). The exact implementation of his 3, would be to use some render to texture updates and keep all the updates and data strictly on the gpu by updating the points with texture that are calculated on the gpu with a couple textures.

NBA2K, Madden, Maneater, Killing Floor, Sims http://www.pawlowskipinball.com/pinballeternal

This topic is closed to new replies.

Advertisement