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

Art Tevs arti_tevs at yahoo.de
Thu Nov 5 09:13:27 PST 2009


In a cycle examples (HDR, motion blur, ...) you have usually this structure:

processor->addChild(unitA);
unitA->addChild(unitB);
unitB->addChild(unitA);

unitB->addChild(unitOutput);

So, now this is resolved automagically by osgPPU. So any visitor running affter the cycles are resolved, should not crash, because a BarrierNode inserted between unitA and unitB should prevent traversion. So, however in the example, you posted before, it seems to be that a simple recursion is used. In such cases, I would propose to rewrite osg code and to submit a patch, which do the same thing, however using visitors, because, this is the way how osg works.

OK, however if one do want to solve the issue without chaning anything, but the unit graph one could do following:


UnitTexture* unitTa = new UnitTexture;
UnitTexture* unitTb = new UnitTexture;

unitTa->setTexture(unitA->getOrCreateOutputTexture(0));
unitTb->setTexture(unitB->getOrCreateOutputTexture(0));

processor->addChild(unitA);
processor->addChild(unitTa);

unitTa->addChild(unitB);
unitTb->addChild(unitA);

unitB->addChild(unitOutput);


This is a way, how I would solve that. So in other words, we first create  UnitTextures which uses an external texture and puts it into the unit pipeline. In this case we are using unitB's and unitA's output. Now both textures are passed to according unitA and unitB, so that it is in the similar way, how it was with a cycle structure.
And at the result of unitB is submitted to unitOutput.

This scenario, however introduces a one frame lag into the pipeline, which might create problems.

So, it is up to you. Either write a visitor which will call setThreadSafeRefUnref() and hence can run over cycled unit's graph. Or rewrite the unit graph, in the way, I have proposed.

I hope, this helps.
art


seb wrote:
> Hi, thx a lot for your answer
> 
> Can you be more explicit on how to remove the cycle dependancies for a HDR example ? How can we specify an output texture as a input texture for a single unit ? 
> I tried many cases (like using switch node) but I didn't manage to do it
> 
> Thank you!
> 
> Cheers,
> Sebastien


------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=19251#19251







More information about the osg-users mailing list