天天看点

osg渲染至纹理(rtt),不同几何体由于blend导致相交处“黑边”

“黑边”截图:

osg渲染至纹理(rtt),不同几何体由于blend导致相交处“黑边”

正常截图:

osg渲染至纹理(rtt),不同几何体由于blend导致相交处“黑边”

部分源码:

pStateSet->setMode(GL_BLEND, osg::StateAttribute::ON);
//pStateSet->setRenderBinDetails(1000, "RenderBin");
pStateSet->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
           

osg::StateSet::TRANSPARENT_BIN设置后黑边消失,但深层次原因待查。

setRenderingHint参数osg::StateSet::TRANSPARENT_BIN、OPAQUE_BIN将场景节点粗略的划分为透明和不透明两个层次,某种程度上上可以解决blend的问题,但当两个透明物体非常相近时可能就会失效,这时setRenderBinDetails就可以发挥作用了,实际上setRenderingHint(osg::StateSet::TRANSPARENT_BIN) 等价于 setRenderBinDetails(10, “DepthSortedBin”),所以可以用setRenderBinDetails对深度进行细分。

扩展阅读:https://blog.csdn.net/kasteluo/article/details/80807099

osg