Jump to content

  • Log In with Google      Sign In   
  • Create Account

Rendering Efficiency: Many matrices vs. resubmitting points


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 anstmich   Members   -  Reputation: 100

Like
0Likes
Like

Posted 16 January 2012 - 01:51 AM

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?

Sponsor:

#2 V-man   Members   -  Reputation: 805

Like
0Likes
Like

Posted 16 January 2012 - 04:34 AM

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 LorenzoGatti   Crossbones+   -  Reputation: 2705

Like
0Likes
Like

Posted 16 January 2012 - 05:01 AM

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).
Produci, consuma, crepa

#4 dpadam450   Members   -  Reputation: 928

Like
0Likes
Like

Posted 17 January 2012 - 02:24 AM

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.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS