Hi, Gianluca Natale
 
You can use simple 2pass osgFX effect with 1st pass writing only depth, and second pass writing only color with correct alpha value set to material and depth func set to equal. There could be problems with multiple layers of transparency in fading object.
 
Cheers, Sergey.
 
07.05.2011, 18:58, "Gianluca Natale" <nat...@europe.altair.com>:

Hi everybody,
I'm developing an osg based application
that needs to fade some objects out of the scene when it is destroyed.
So, instead of a sudden disappearing,
I would like to make it slowly disappear from the screen, let's say for example in 1 second.

I think that I could:
1) draw the final image (object completely removed) in a separate
   pixel buffer, then get that image and create a texture with it;
2) copy the content of the front buffer (the initial image) in another
   texture;
3) create a temporary scenegraph made only by a geode containing 2 drawables,
   each of which draws a rectangle with the same size of the screen.
   And attach the texture created at step 1 in one drawable, and the texture created
   at step 2 in the other one.
4) finally draw that simple geode in n steps, using at each step a different
   blending factor for plane 1 (copy of the front buffer) and 2 (final image).
   I mean, starting from alpha1 = 1.0 and alpha2 = 0.0 at step 1, till alpha1 = 0.0
   and alpha2 = 1.0 at step n.

It should give me the effect I want.
Or not?
Do you think it is doable?
Do you think it might be also fast?

Finally, do you have some example in osg about writing to a texture, copying the front
buffer into a texture, etc...?
I know that for sure there are things already implemented there.
Actually I'm also quite sure that osg is so powerful that I could accomplish what I
want with no more the 30-40 lines of code. But I don't know how to do that quickly.

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

Reply via email to