<div dir="ltr"><div><div><div>Hi Matt,<br><br></div>The osgscreencapture example has code use setting up multiple pixel buffer objects to help improve the speed of reading images.  The key is double buffering the PBO's so you read asynchronously.<br><br></div></div>Robert.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On 15 April 2015 at 04:37, Matt Donahoe <span dir="ltr"><<a href="mailto:matt@skyd.io" target="_blank">matt@skyd.io</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I am looking to use OpenSceneGraph to simulate multi-camera images in real time, but my frame rates are not great with the number of cameras I need. I currently have 6 cameras rendering to 640x480 images and I see ~8fps max, with a lot of jitter.<br>
<br>
The osg examples have been a great help, but I wanted to ask for general advice before I dig too much deeper. Everything I have read indicates that GPU->CPU is a very slow operation, but I am wondering if I am actually maxed out or just doing something dumb.<br>
<br>
Here is my setup for N cameras:<br>
<br>
0. Populate the scene with objects<br>
1. Create the N osg::Cameras with RenderTargetImplementation of FRAME_BUFFER_OBJECT (PIXEL_BUFFER doesn't work for me yet)<br>
2. Create N rgb 640x480 osg::Images and attach to the cameras<br>
3. Add my scene to each camera<br>
4. Add draw callbacks to each camera.<br>
5. Add each camera to a root scene.<br>
6. Create a viewer with the root scene.<br>
<br>
Now in a custom main loop, I do the following:<br>
<br>
0. Read the requested camera poses from a message queue<br>
1. Adjust the pose of each camera<br>
2. Viewer.frame()<br>
3. Each camera callback will fire<br>
4. When all camera callbacks have fired, I read .data() from each Image.<br>
5. Publish the N images in a single message, which gets serialized and sent over UDP to other processes.<br>
<br>
I still need to profile this to see where the bottleneck is, but my hunch is that I can speed up by rendering and reading the data from each camera independently instead of simultaneously. I am not sure how to do it yet, but I assume "Pixel Buffer Objects" will be part of the answer.<br>
<br>
Any suggestions on where to start would be appreciated!<br>
<br>
Cheers,<br>
Matt<br>
<br>
------------------<br>
Read this topic online here:<br>
<a href="http://forum.openscenegraph.org/viewtopic.php?p=63398#63398" target="_blank">http://forum.openscenegraph.org/viewtopic.php?p=63398#63398</a><br>
<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
</blockquote></div><br></div>