Thanks Sergey,

actually my case is exactly the exception you mentioned.

I mean, I know exactly the object to redraw (so, its main node in the 
scene-graph),

it is opaque and doesn't change size and position (mine is a static scene).

When the mouse is moved over that object, I just need to change its color.

That's it.

 

Thanks,

Gianluca

 

 

Da: [email protected] 
[mailto:[email protected]] Per conto di Sergey 
Polischuk
Inviato: martedì 22 febbraio 2011 16:14
A: OpenSceneGraph Users
Oggetto: Re: [osg-users] about drawing only in the front buffer

 

Hi, Gianluca Natale

 

In order to get correct results you cant just go and draw changed object on top 
of previous frame (there are one exception that is if object in question dont 
change size and position and is completely opaque). You will get depth buffer 
issues and parts of old object position can still remain visible. To get it 
work you need to redraw all region where old object was + draw changed object 
on top of that.

 

If this exception applies - you can draw each frame to textures (storing color 
and depth), then in next frame if you need to redraw only some objects, then, 
considering you know what objects need redraw, you first draw previous frame 
textures with screen aligned quads to color and depth, and after that you draw 
objects on top of that with depth func set to equal. With transparent geometry 
you still need to redraw background as in previous case.

 

So in general case you can do the following:

Draw from previous frame textures with screen aligned quads to color and depth 
like in previous case.

Get screen coords of regions that needs to be redrawed with transforming 
changed objects bboxes to screen coords.

Draw quads with depth set to 1.0 and depth test set to always covering regions 
where changed objects were.

Search you graph for objects that after transforming to screen coords will 
overlap with that regions.

Draw them as usual along with changed objects.

 

I dont think that you will be able to gain sufficient speedup with that though.

 

Cheers, Sergey.

 

 

 

22.02.2011, 16:47, "Gianluca Natale" <[email protected]>:

        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
        [email protected]
        
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to