Alpha blending passes has unexpected result

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
Shem
Halfling
Posts: 55
Joined: Fri Feb 16, 2018 9:32 am
x 8

Alpha blending passes has unexpected result

Post by Shem »

Hi all,

Not sure what I'm doing wrong but when I try to alpha blend two passes the top one is using the max alpha from both instead of it own alpha.

Code: Select all

	//Create the material and texture layers
	m_RenderMat = Ogre::MaterialManager::getSingleton().create("RttMat", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
	m_RenderMat->load();
	Ogre::Pass* ppass;  TextureUnitState* ptus;
	ppass = m_RenderMat->getBestTechnique()->getPass(0);
	ppass->setSceneBlending(SBT_TRANSPARENT_ALPHA);
	ptus = ppass->createTextureUnitState("RttTex");
	ppass = m_RenderMat->getBestTechnique()->createPass();
	ppass->setSceneBlending(SBT_TRANSPARENT_ALPHA);
	ptus = ppass->createTextureUnitState("RttTex2");

I can see this as my top pass has thin semi transparent lines (center is opaque and sides are transparent) which become thicker once they overlap the bottom pass graphics

Thanks in advance
Shem

Ogre Version: 1.12.9
Operating System: Win10
Render System: OGL3+
Quadro RTX 4000

Shem
Halfling
Posts: 55
Joined: Fri Feb 16, 2018 9:32 am
x 8

Re: Alpha blending passes has unexpected result

Post by Shem »

My bad. I keep forgetting the viewport background color is also being used when blending.

Post Reply