Re: [osg-users] Incremental Draw?
Hi Michael, On Thu, Nov 18, 2010 at 6:41 PM, Michael Platings mplati...@gmail.com wrote: The scenes are rendered to FBOs so they're not tied to any particular window/context or display method. The scenario is that a user will set one scene to be rendered and sent to an external display system at 60fps. Once the first scene is rendering the user can request a preview of a second scene. When the preview is ready the user can seamlessly switch the system to rendering and sending the second scene at 60fps. As far as I can see to implement a solution I'll have to duplicate a lot of code from RenderStage/RenderBin, unless you can see a more elegant solution? I think it'd be rather awkward to implement as you'd need to traverse the RenderStage/RenderBin's till a desired point then store the position that you'd go to, then on the next frame start at the same point. You can subclass from RenderBin so I guess you could probably implement it, but it wouldn't be straight forward. The way I'd be inclined to go would be to pre-process the original scene graph analysising it for how it might be rendered in sections. This partitioning could be done volumetrically, or just on number of and sizes of objects. Once you've got the leaves of the scene graph partitioned you could then build a series of scene graphs that will be able to render that part of the scene. If you do just do the partitioning volumetrically then you could probably cut a lot of the faff and just use multiple Camera's with different view frustum to cull the scene. For instance you could just render the scene in a series of depth partitioned chunks from back to front. This approach would certainly be the easiest to implement as you wouldn't need to modify the scene graph, just the projection matrix settings of the RTT Camera. You'd need to make sure you enabled culling on the near and far planes, and disabled the compute of near/far, but this is all pretty simple. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Incremental Draw?
Thanks J-S, I had the same idea myself but unfortunately OpenGL drivers don't take thread or process priority into account. I made a simple test app that just renders thousands of quads, ran two instances simultaneously, set the process priority of one to high, and the priority of the other to idle, and they both ran at exactly the same frame rate - half the rate of one instance on its own. Thanks for the suggestions Robert. I can't use spacial partitioning in my particular case as there's often a lot of overlapping geometry, but simply splitting the scene graph into many scene graphs with one bit of geometry in each sounds like it could be the way forward. Cheers! On 18 November 2010 19:04, Jean-Sébastien Guay jean-sebastien.g...@cm-labs.com wrote: Hi Michael, As far as I can see to implement a solution I'll have to duplicate a lot of code from RenderStage/RenderBin, unless you can see a more elegant solution? A simple way could be to run two viewers, each one from a loop running in a different thread? If there is a need to use textures or share resources between the two contexts you can set up sharing between two contexts running in two viewers just as easily as from two contexts running in the same viewer, it's just that you'll have to do synchronization yourself when you need to, because the two viewers will run in their threads independently. Then you could set your principal viewer thread at a normal priority and the other viewer thread at a lower priority, so in theory the secondary rendering should not steal cycles from your main one, but would get the leftovers each frame (if any), so its rendering might go slower (if you're CPU-bound) but that seems OK for you as long as the main rendering goes at 60hz. I don't know enough about your goal to be sure this will work for you, but it's one way to render two scene graphs at different rates. J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Incremental Draw?
Hi Robert, is there an equivalent of IncrementalCompileOperation for drawing a scene graph? My precise problem is as follows: In my application I have 2 scene graphs to be drawn concurrently - the primary scene graph must be drawn at a fixed frame rate of 60fps, the secondary scene graph can take a couple of seconds to draw. The problem is that drawing the secondary scene graph interferes with the frame rate of the primary scene graph. Is there something like IncrementalDrawOperation to draw subsections of a scene graph until an allotted amount of time has been consumed, or do you know of a better solution? Thanks in advance, -Michael ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Incremental Draw?
Hi Michael, On Thu, Nov 18, 2010 at 5:08 PM, Michael Platings mplati...@gmail.com wrote: Hi Robert, is there an equivalent of IncrementalCompileOperation for drawing a scene graph? No. My precise problem is as follows: In my application I have 2 scene graphs to be drawn concurrently - the primary scene graph must be drawn at a fixed frame rate of 60fps, the secondary scene graph can take a couple of seconds to draw. The problem is that drawing the secondary scene graph interferes with the frame rate of the primary scene graph. Is there something like IncrementalDrawOperation to draw subsections of a scene graph until an allotted amount of time has been consumed, or do you know of a better solution? You are the first person in the whole history of the OSG to ask for incremental rendering ;-) Do these two scenes get rendered on two separate windows? Does the scene scene get rendered to a texture? I'm curious on just how you see these two scenes working. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Incremental Draw?
I guess I'd better get started on making it then :) The scenes are rendered to FBOs so they're not tied to any particular window/context or display method. The scenario is that a user will set one scene to be rendered and sent to an external display system at 60fps. Once the first scene is rendering the user can request a preview of a second scene. When the preview is ready the user can seamlessly switch the system to rendering and sending the second scene at 60fps. As far as I can see to implement a solution I'll have to duplicate a lot of code from RenderStage/RenderBin, unless you can see a more elegant solution? Thanks for your help On 18 November 2010 17:33, Robert Osfield robert.osfi...@gmail.com wrote: Hi Michael, On Thu, Nov 18, 2010 at 5:08 PM, Michael Platings mplati...@gmail.com wrote: Hi Robert, is there an equivalent of IncrementalCompileOperation for drawing a scene graph? No. My precise problem is as follows: In my application I have 2 scene graphs to be drawn concurrently - the primary scene graph must be drawn at a fixed frame rate of 60fps, the secondary scene graph can take a couple of seconds to draw. The problem is that drawing the secondary scene graph interferes with the frame rate of the primary scene graph. Is there something like IncrementalDrawOperation to draw subsections of a scene graph until an allotted amount of time has been consumed, or do you know of a better solution? You are the first person in the whole history of the OSG to ask for incremental rendering ;-) Do these two scenes get rendered on two separate windows? Does the scene scene get rendered to a texture? I'm curious on just how you see these two scenes working. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Incremental Draw?
Hi Michael, As far as I can see to implement a solution I'll have to duplicate a lot of code from RenderStage/RenderBin, unless you can see a more elegant solution? A simple way could be to run two viewers, each one from a loop running in a different thread? If there is a need to use textures or share resources between the two contexts you can set up sharing between two contexts running in two viewers just as easily as from two contexts running in the same viewer, it's just that you'll have to do synchronization yourself when you need to, because the two viewers will run in their threads independently. Then you could set your principal viewer thread at a normal priority and the other viewer thread at a lower priority, so in theory the secondary rendering should not steal cycles from your main one, but would get the leftovers each frame (if any), so its rendering might go slower (if you're CPU-bound) but that seems OK for you as long as the main rendering goes at 60hz. I don't know enough about your goal to be sure this will work for you, but it's one way to render two scene graphs at different rates. J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org