Alpha differs on RTT layer

marten

23-02-2011 18:57:49

Hello!

I'm having a problem with alpha when using Render To Texture layers. The parts of a gui in a RTTlayer that has some sort of Alpha is rendered much darker and even more transparent than guis rendered normally. To illustrate I've here created two guis using the same skin next to each other. The left one is on a normal layer, and the right one is on a RTTlayer.

[attachment=0]mygui_alphaproblem.png[/attachment]

I've used the RTTLayer class straight off the UnitTest and I'm using a 2D container in an Overlay to render the texture.

This is the way I setup the material for the texture:
Ogre::MaterialPtr material = Ogre::MaterialManager::getSingleton().create(textureName, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
Ogre::Technique* technique = material->createTechnique();
technique->createPass();
material->getTechnique(0)->getPass(0)->setTextureFiltering(TFO_ANISOTROPIC);
material->getTechnique(0)->getPass(0)->setSceneBlending(SBT_TRANSPARENT_ALPHA);
material->getTechnique(0)->getPass(0)->setLightingEnabled(false);
material->getTechnique(0)->getPass(0)->setDepthWriteEnabled(false);
material->getTechnique(0)->getPass(0)->createTextureUnitState(textureName);


Am I missing something with this setup?