PDA

View Full Version : Shaders or VBOs for point clouds?



metalac
12-17-2010, 11:42 PM
Hey guys,

So I have a code that plots a bunch of points on the screen. They all have position and color associated with them. Currently I'm using VBOs to display them and it works fine. Points are static and all I do is rotate the view around them, zoom in/out and such. What I notice is that when I hit around 3-4 million points I see a big performance hit, so I wanted to see if shaders would be of any benefit.

I never did any work with shaders so I'm not sure if they would help in this situation. Any clues?

Thanks.

ZbuffeR
12-18-2010, 02:31 AM
Shaders are instructions applied to data.
On the vertex side or the fragment side, you might apply less instructions that fixed path, and gain some speed.

How do you draw your points currently ? STATIC_DRAW ? Blending ? Alpha testing ? Please show some code.
And your hardware is ?

metalac
12-19-2010, 11:21 AM
So I assume I'm doing a STATIC_DRAW. The points are always stationary and don't move in space all that moves is the camera around them. Here is the code on how I draw the points.



glBindBufferARB(GL_ARRAY_BUFFER_ARB, vboPointCloudID);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glColorPointer(3, GL_FLOAT, 0, BUFFER_OFFSET(12));
glVertexPointer(3, GL_FLOAT, 0, BUFFER_OFFSET(0));
glDrawArrays(GL_POINTS, 0, 2*numPoints);
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);


As far as the hardware on the laptop I'm running it I have a Nvidia Quadro NVS 135M

mhagain
12-19-2010, 05:09 PM
Try breaking your draw into smaller batches. The exact size of each smaller batch is something you'll need to experiment with, but start at maybe 50,000 per batch and go up from there.

M//Hax
12-20-2010, 08:50 AM
Hey guys,

So I have a code that plots a bunch of points on the screen. They all have position and color associated with them. Currently I'm using VBOs to display them and it works fine. Points are static and all I do is rotate the view around them, zoom in/out and such. What I notice is that when I hit around 3-4 million points I see a big performance hit, so I wanted to see if shaders would be of any benefit.

I never did any work with shaders so I'm not sure if they would help in this situation. Any clues?

Thanks.

I can draw easily 4 Millions of points with a fps over 30 using vbo's and points. What graphic card are you using?

metalac
12-20-2010, 01:15 PM
So I just tried drawing 50k at a time and it didn't seem all that impressive. I'd say slightly better, but nothing spectacular. Might go from 1.5fps to maybe 2fps.

M//Hax: I got a Quadro NVS 135M. I hope that it should be enough to do what I want it to do. I'm hoping that it will be able to draw 20-30 million points at some time.

M//Hax
12-20-2010, 02:20 PM
So I just tried drawing 50k at a time and it didn't seem all that impressive. I'd say slightly better, but nothing spectacular. Might go from 1.5fps to maybe 2fps.

M//Hax: I got a Quadro NVS 135M. I hope that it should be enough to do what I want it to do. I'm hoping that it will be able to draw 20-30 million points at some time.

That's a mobile quadro...I don't know if it's going to be able to do it. I'm using a Quadro FX 580, and i can easily draw 10Mils points. I never tried over that, but it would probably work. Maybe something is wrong in your VBO as well! I used my program on a pc with an onboard graphic card and it could run at 11 fps with 2 Mils points.