enabling RTSS ShaderGenerator in Ogre 2.0

Discussion area about developing with Ogre2 branches (2.1, 2.2 and beyond)
Post Reply
djreep81
Gnoblar
Posts: 12
Joined: Wed Jun 20, 2012 6:31 am

enabling RTSS ShaderGenerator in Ogre 2.0

Post by djreep81 »

Migrating RTSS Ogre 1.9 to Ogre 2.0

My question involves the RTShaders, the new CompositorPassSceneDef and the viewport in Ogre 2.0. In Ogre 1.9 I was able to setup the RTShader System as the Ogre documentation describes. No issues with 1.9. The following line in the code sets the material scheme for RTShader and applys it to the viewport.

Code: Select all

 
mViewport->setMaterialScheme (Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME); 
Now with Ogre 2.0 that line has no affect. This value is overridden in the CompositorPassSceneDef class. CompositorPassSceneDef contains another default variable mMaterialScheme with a default value of MaterialManager::DEFAULT_SCHEME_NAME. In the CompositorPassScene::execute method, the materialscheme set in the viewport is overridden with this value (mMaterialScheme)

CompositorPassSceneDef code that overrides the vieport value.

Code: Select all

String oldViewportMatScheme = mViewport->getMaterialScheme();
mViewport->setMaterialScheme(mDefinition->mMaterialScheme);  
...
//restore viewport material scheme                                                                            
mViewport->setMaterialScheme(oldViewportMatScheme);
So in order to resolve this I set the material scheme in the compositor pass to the value of Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME.

Code: Select all

Ogre::CompositorPassSceneDef* scenepass = static_cast<Ogre::CompositorPassSceneDef*> (targetpasses->addPass (Ogre::PASS_SCENE));
scenepass->mMaterialScheme = Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME;
Is this expected behavior? If so, then does every scenepass definition need to define that as the material scheme everywhere when using RTSS. Is that a bit excessive?

djreep81
Gnoblar
Posts: 12
Joined: Wed Jun 20, 2012 6:31 am

Re: enabling RTSS ShaderGenerator in Ogre 2.0

Post by djreep81 »

Since it appears that setting the material scheme in the compositor scene pass is the way to go, would it make since to go ahead and remove the Viewport::setMaterialScheme method in Ogre 2.0/2.1? is there any scenario in which that is not overridden by the compositor value?

*BTW ogre 2.0 works great on android and i am getting a huge performance boost!! I was hesitant to upgrade but no issues so far only great performance!

Post Reply