[osg-users] about drawing only in the front buffer

2011-02-22 Thread Gianluca Natale
Hi there,
I hope someone of you can help me on this issue.
I have a very complicated scene graph, that takes a very long time to be
completely redrawn (200 ms).

But the most frequent use case I have is to redraw only a very small
part of the model at a time
(suppose for example that I would need to redraw only the object under
the mouse).

So, I could increase performances a lot by simply redrawing that object
in the front buffer without clearing the depth buffer,
in order to keep it in the right position WRT the other object of the
model. And without swapping front and
back buffers at the end of drawing.

Is this possible?

 

If I'm not wrong, sometimes ago I received an email from you saying that
the drawing traversal of OSG

always clean the depth and back buffers, redraws the complete scene
graph and then swap the buffers.
This works pretty well when the scene changes dynamically, but in my
case where there is a static drawing for

a long time, I would need a way to tell the drawing traversal to draw in
the front buffer, and not to perform the swapping
of buffers at the end.

Is there a way to do that?

 

Thanks in advance

Gianluca Natale

 

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] about drawing only in the front buffer

2011-02-22 Thread Robert Osfield
Hi Gianluca,

If you new exactly what objects needed updating then you could compute
combined bounding volume of the modified objects in the current and
the previous frame and then project these combined bounding volume
into screen space to find out the region of the screen that will need
to be redrawn.

Once you know the region of the screen that needs redraw then you
could adjust the viewer's Camera so that it has a smaller viewport and
adjust projection matrix to just render the area of interest.  This
approach would also have to render to the front buffer rather than the
back buffer, and with it would have a small flicker when the region is
redrawn.

To get around the flicker you could draw the full screen twice and
then draw the updated region on each new frame.  You'll need to update
the region between the objects position two frames ago and the current
position rather than the just the region covered by the two adjacent
frames.

As you'll gather all this is doable, but rather convoluted, just
rendering the whole frame when needed will certainly lead to an easier
life and lower application complexity.

Robert.

On Tue, Feb 22, 2011 at 1:47 PM, Gianluca Natale
nat...@europe.altair.com wrote:
 Hi there,
 I hope someone of you can help me on this issue.
 I have a very complicated scene graph, that takes a very long time to be
 completely redrawn (200 ms).

 But the most frequent use case I have is to redraw only a very small part of
 the model at a time
 (suppose for example that I would need to redraw only the object under the
 mouse).

 So, I could increase performances a lot by simply redrawing that object in
 the front buffer without clearing the depth buffer,
 in order to keep it in the right position WRT the other object of the model.
 And without swapping front and
 back buffers at the end of drawing.

 Is this possible?



 If I’m not wrong, sometimes ago I received an email from you saying that the
 drawing traversal of OSG

 always clean the depth and back buffers, redraws the complete scene graph
 and then swap the buffers.
 This works pretty well when the scene changes dynamically, but in my case
 where there is a static drawing for

 a long time, I would need a way to tell the drawing traversal to draw in the
 front buffer, and not to perform the swapping
 of buffers at the end.

 Is there a way to do that?



 Thanks in advance

 Gianluca Natale



 ___
 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