天天看點

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