PDA

View Full Version : Real-time Large Dynamic Mesh Rendering



JackMarking
11-02-2010, 04:31 AM
Hi,

I have a live stream of data from which I'm extracting a 512x512 grid of (x, y, z) points at real-time video rates (~25 fps). (I actually have three such streams but I'll stick to one for now).

I've written some code to do the rendering (I'll post it here if anyone asks) but it's not fast enough. I've tried using vertex arrays and vertex buffer objects using both glBufferData and glMapBuffer but trying to render the data in real-time is causing my whole application to slow down.

It works well if I sub-sample to 256x256 but I'd rather not do this, as it it means I can't display as much detail as I'd like.

Does anyone have any tips on how I can speed up my rendering?

Thanks for your time,

Jack

tksuoran
11-02-2010, 04:48 AM
Are you using a single VBO? Try to have a few so that when you render VBO*1 you start updating VBO 2 and so on?

JackMarking
11-02-2010, 04:57 AM
Hi tksuoran,

Yes, I'm currently using a single VBO. So would you recommend splitting the mesh (vertices, colours, normals, tcoords etc) over a number of vbos, or would you use a vbo for vertices, another for normals etc?

Do you know if there are any code examples using multiple vbos?

Thanks,

Jack

tksuoran
11-02-2010, 06:18 AM
You can keep all attributes in the VBO, but do not update the same VBO that you just sent for rendering. You can try something like this:

Update VBO1
Render VBO1
SwapBuffers
Update VBO2
Render VBO2
SwapBuffers
Update VBO3
Render VBO3
SwapBuffers
Update VBO1
Render VBO1
SwapBuffers
...

This way your CPU can update VBO N+1 while your GPU is still rendering VBO N.

ZbuffeR
11-02-2010, 07:50 AM
even better, interleave the 3 :
Update VBO1
Render VBO3
SwapBuffers
Update VBO2
Render VBO1
SwapBuffers
Update VBO3
Render VBO2

tksuoran
11-02-2010, 08:14 AM
If the content is streamed like video and you know 'frames' in advance, then you can and should buffer ahead like this. If your content is updated in some interactive manner, buffering more will add latency.

JackMarking
11-02-2010, 08:24 AM
Hi,

Thanks for your suggestions. The data I am displaying is a live video stream. I'm displaying a surface extracted from the video using fourier fringe analysis, so I don't know any frames in advance. I'll give your suggestions a go and post the results when I'm done.

Thanks again.

Jack

ZbuffeR
11-02-2010, 09:09 AM
It would be interesting to post what is your 3D hardware.
512*512*2 triangles is not that big, should be fast.