Compositor: Difference between revisions

Jump to navigation Jump to search
619 bytes added ,  25 October 2019
no edit summary
No edit summary
No edit summary
Line 259: Line 259:


* Using RenderBins. After a single scene cull traversal, surfaces which belong to a special RenderBin type (DepthSortedBin) are removed or moved to another camera. This is how Rembrandt does it and it is the most backwards compatible approach since RenderBins can be changed directly inside Effects.
* Using RenderBins. After a single scene cull traversal, surfaces which belong to a special RenderBin type (DepthSortedBin) are removed or moved to another camera. This is how Rembrandt does it and it is the most backwards compatible approach since RenderBins can be changed directly inside Effects.
<syntaxhighlight lang="cpp">
void removeTransparentBins(simgear::EffectCullVisitor *cv,
                          osgUtil::RenderBin::RenderBinList &transparent_bins)
{
    osgUtil::RenderStage *stage = cv->getRenderStage();
    osgUtil::RenderBin::RenderBinList &rbl = stage->getRenderBinList();
    for (auto rbi = rbl.begin(); rbi != rbl.end(); ) {
        if (rbi->second->getSortMode() == osgUtil::RenderBin::SORT_BACK_TO_FRONT) {
            transparent_bins.insert(std::make_pair(rbi->first, rbi->second));
            rbl.erase(rbi++);
        } else {
            ++rbi;
        }
    }
}
</syntaxhighlight>
* Using cull masks. Two separate traversals are done: one for opaque objects and another for translucent objects. This requires offering aircraft developers another way of tagging a surface as transparent. A trivial approach would be to add a new <animation> type called 'transparent', but that wouldn't be backwards compatible. Maybe we can add some kind of system where we can change cull masks inside Effects? Would that be too hacky or out of place?
* Using cull masks. Two separate traversals are done: one for opaque objects and another for translucent objects. This requires offering aircraft developers another way of tagging a surface as transparent. A trivial approach would be to add a new <animation> type called 'transparent', but that wouldn't be backwards compatible. Maybe we can add some kind of system where we can change cull masks inside Effects? Would that be too hacky or out of place?


342

edits

Navigation menu