Ogre Compositor使用盲點

  • 1584
  • 0

摘要:Ogre Compositor使用盲點

Ogre 的一個奇怪的Bug?
 
背景:
用兩個viewport 各自加上一個 compositor
 
發現:
notifyMaterialSetup 一直被呼叫,而不是只呼叫一次而且
一直在產生新的內部Material, 雖然效能沒有明顯差別
 
CompositorChain::preViewportUpdate

if (pass->getClearBuffers() != mViewport->getClearBuffers() ||
pass->getClearColour() != mViewport->getBackgroundColour() ||
pass->getClearDepth() != mViewport->getDepthClear() ||
passParent->getVisibilityMask() != mViewport->getVisibilityMask() ||
passParent->getMaterialScheme() != mViewport->getMaterialScheme() ||
passParent->getShadowsEnabled() != mViewport->getShadowsEnabled())
{
    // recompile if viewport settings are different
    pass->setClearBuffers(mViewport->getClearBuffers());
    pass->setClearColour(mViewport->getBackgroundColour());
    pass->setClearDepth(mViewport->getDepthClear());
    passParent->setVisibilityMask(mViewport->getVisibilityMask());
    passParent->setMaterialScheme(mViewport->getMaterialScheme());
    passParent->setShadowsEnabled(mViewport->getShadowsEnabled());
    _compile();
}

 

 
原因:
我的兩個viewport的VisibilityMask值不相同, 將它們設為相同就好了, 不再一直產生新的內部Material
 
解析:
理論上兩個viewport的VisibilityMask和compositorChain應該是互相獨立不受影響
所以Ogre的Compositor架構應該有一些使用上的盲點

 

 

Rz

 

 

 

  Rz     should work (hard)