[osg-users] [osgPPU] osgPPU HDR problem with cycles

Art Tevs art at tevs.eu
Thu Nov 5 07:32:14 PST 2009

Hi Sebastian,

sorry, it seems I had some permission problems on the forum, so that
your post get removed somehow. So to your question:

> In this example, you are using a cycle dependancy (between adaptedLuminance and adaptedLuminance child) to get the previous frame average luminance scene.
> When I use your application, it works well.
> But in my application, I have got stack overflow assert in the recursiv osg function group::SetThreadSafeRefUnref(...) because (I guess) it is looping on the cycle without any chance of exit
> Code:
> void Group::setThreadSafeRefUnref(bool threadSafe)
> {
>    Node::setThreadSafeRefUnref(threadSafe);
>    for(NodeList::const_iterator itr=_children.begin();
>        itr!=_children.end();
>        ++itr)
>    {
>        (*itr)->setThreadSafeRefUnref(threadSafe);
>    }
> }
> I did deeply have a look on your sample but I do not understand why it is working in your example ...
> What did I forget ?

Yes, in deed, I am using cycle dependency. This is per default not
supported in osg. However, I've have written my own visitor which
looks for cycles and replaces them with special BarrierNode. This node
makes sure, that cycles are resolved.

In order to solve that issue for your application, you can add a
BarrierNode manually, between the both cycled frames. The same war as
osgPPU::ResolveCyclesVisitor (look into Visitor.h) will do it. This
should help.
You could also think on changing the unit graph to remove cycle
dependency. This can be achieved with using UnitTexture and specifying
the output texture of adaptedLuminance as input texture for it.
However, with this solution, your luminance values will be one frame
behind the actual luminance. For the HDR example this might be not
problematic, however for the motion-blur example, this could produce
artifacts when moving the camera. (I am using cycle dependency also in
motion blur example).


More information about the osg-users mailing list