[osg-users] osgOcean also rendering with osgParticle?

Kim Bale kcbale at googlemail.com
Mon Nov 16 02:19:26 PST 2009

Hi Erik,

Unfortunately there aren't any tricks for this. Getting transparencies
and glare to work together is quite an involved problem and would
require quite a few changes to OceanScene.

The problem is that the glare should only really affect the sea,
otherwise everything glimmers and it all looks a bit naff. So I
override the alpha component of all other objects in the scene to 0 so
that the glare pass ignores their luminance values, and then set it to
1 when rendering back to the main frame buffer.

The easiest way to rectify this would be use multiple render targets,
one to store the luminance values and one to store the normal pixel
color and alpha values. Then use the separate luminance buffer for the
glare effect. I'm not sure if Ogls multiple render target
implementation is any more efficient than using a completely separate
pass but rendering the ocean twice would be very costly.

It's on my list of things to do, I find the problem quite interesting.
But with limited free time, progress on osgOcean is quite slow I'm



2009/11/15 Erik Johnson <r.erik.johnson at gmail.com>:
> Kim,
> You are correct.  Turning off the glare and the underwater depth of field
> lets osgParticle render on through.
> I don't suppose you have any tricks up your sleeve to allow for both alpha
> textures *and* ocean glare to work?
> Thanks much - things are looking much better now.
> -Erik
>> Date: Fri, 13 Nov 2009 21:02:07 +0000
>> From: Kim Bale <kcbale at googlemail.com>
>> To: OpenSceneGraph Users <osg-users at lists.openscenegraph.org>
>> Subject: Re: [osg-users] osgOcean also rendering with osgParticle?
>> Message-ID:
>>        <a17930f30911131302v235e9e48qfbea076ba7df0c41 at mail.gmail.com>
>> Content-Type: text/plain; charset=ISO-8859-1
>> Hi Erik,
>> I suspect this is a problem with the default shader that is applied to
>> all objects that are children of OceanScene. Part of this shader
>> overwrites the alpha component of the frame buffer which will cause
>> problems with transparent objects, in your case the particles. This is
>> required for the glare and depth of field effects that use the alpha
>> component to store the luminance and depth information rather than
>> making an additional (and costly) pass to a separate frame buffer
>> object.
>> Could you try disabling the glare and depth of field effect and see if
>> the problem remains?
>> Cheers.
>> Kim.
>> 2009/11/13 Erik Johnson <r.erik.johnson at gmail.com>:
>> > Hi all,
>> > I've been playing around with osgOcean recently (nice work, btw!) and
>> > realized my fantastic particle effects were not being rendered in the
>> > scene.
>> > ?I tried to add them in various places in the scene graph with limited
>> > results.
>> > For example I added?osgParticle::FireEffect as a child of the "boat" in
>> > the
>> > oceanExample. ?This kind of works, but you can only see some of particle
>> > effect from under the water.
>> > Any suggestions? ?It's no good having a motor boat splashing through the
>> > water without the splashes!
>> >
>> > thanks,
>> > Erik
>> >
>> > _______________________________________________
>> > osg-users mailing list
>> > osg-users at lists.openscenegraph.org
>> >
>> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>> >
>> >
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

More information about the osg-users mailing list