Another Transparency question

Problems building or running the engine, queries about how to use features etc.
Post Reply
ank
Halfling
Posts: 43
Joined: Thu Jan 05, 2006 2:35 am
Location: Pittsburgh, PA

Another Transparency question

Post by ank » Thu Feb 02, 2006 7:27 pm

Hello,

When I create a transparent material and set it to be the material of an Entity, I get mild yellow streaks on the Entity. Hacking with alphaLevel didnt help at all and neither did substituting LBX_MODULATE with LBO_ADD.

Anyone got any ideas?

Thanks
-Ankur

The code that I am using is below:

Code: Select all

Real alphaLevel = 0.1f; 

MaterialPtr alphamat = MaterialManager::getSingleton().create("transparentWall", 
																	  ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); 
Pass* pass = alphamat->getTechnique(0)->getPass(0); 
pass->setSceneBlending(SBT_TRANSPARENT_ALPHA); 
pass->setDepthWriteEnabled(false); 
TextureUnitState* t = pass->createTextureUnitState(); 
t->setAlphaOperation(LBX_SOURCE1, LBS_MANUAL, LBS_CURRENT, alphaLevel); 
t->setColourOperationEx(LBX_MODULATE, LBS_TEXTURE, LBS_CURRENT, ColourValue::White, ColourValue::White, alphaLevel);
0 x

User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19261
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
Contact:

Post by sinbad » Fri Feb 03, 2006 12:08 am

I think we need a screenshot :)
0 x

ank
Halfling
Posts: 43
Joined: Thu Jan 05, 2006 2:35 am
Location: Pittsburgh, PA

Post by ank » Fri Feb 03, 2006 4:58 am

Hi Sinbad,

I meant to post a screenshot but kinda forgot about it...

so here it is, I have set the alphaLevel to 0.5f but even with 0.1f the yellow lines are there though not so pronounced but one can easily see them. So the scene is basically two transparent walls shaped like letter "L" and I want to control the transparency of both of them. Please disregard the 3 viewports on the right of the image, I am referring to the image in the center.

thanks for helping out ... :)

-Ankur

Image
0 x

ank
Halfling
Posts: 43
Joined: Thu Jan 05, 2006 2:35 am
Location: Pittsburgh, PA

Post by ank » Sat Feb 04, 2006 9:10 pm

Hi,

I still havent been able to figure out a solution to this problem. Does anyone have any ideas about this ?

-Ankur
0 x

User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
Contact:

Post by haffax » Sat Feb 04, 2006 9:59 pm

The yellow lines are a warning texture. They mean, that Ogre has not found a certain texture, or didn't like one of your materials. Check your Ogre.log to find out the reason for it.
0 x
team-pantheon programmer
creators of Rastullahs Lockenpracht

User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19261
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
Contact:

Post by sinbad » Sat Feb 04, 2006 10:22 pm

Yes, this mean you're using GL and are using a texture unit without assigning a texture to it. We bind a warning texture to show it up because some drivers will crash or display garbage. You can still not use a texture, but you have to be careful about what colour operation you use (default is modulate). Use "colour_op_ex source1 src_current src_texture" to use no colour from the current texture unit, just the alpha.
0 x

ank
Halfling
Posts: 43
Joined: Thu Jan 05, 2006 2:35 am
Location: Pittsburgh, PA

Post by ank » Tue Feb 21, 2006 12:33 am

Hello,

thanks for helping me out but I am not still not sure what your comments meant. I tried making some changes to the code based on what you guys suggested but still no good for me. I may have gotten it all wrong but I tried changing the

Code: Select all

t->setColourOperationEx(LBX_BLEND_MANUAL, LBS_TEXTURE, LBS_CURRENT, ColourValue::White, 
									ColourValue::White,1.0);
to this

Code: Select all

t->setColourOperationEx(LBX_BLEND_MANUAL, LBS_CURRENT, LBS_TEXTURE, ColourValue::White, 
									ColourValue::White,1.0);
but still no good, b/c thats what I thought you guys were referring to. Sorry for being too ignorant about this renderToTexture details.

thanks
-Ankur

Code: Select all

char s[20]; sprintf(s, "Texture_%02d", i); String RTname = String(s);
sprintf(s, "Material_%02d", i); String RTmatname = String(s);
		
rttTexFactory[i] = mRoot->getRenderSystem()->createRenderTexture( RTname, 512,256, TEX_TYPE_2D, PF_R8G8B8 );
vpOverlayPort = rttTexFactory[i]->addViewport(camFactory[i]);//mReflectCam);//, 3, 0.75f, 0.50f, 0.25f, 0.25f);
vpOverlayPort->setClearEveryFrame( true );
vpOverlayPort->setBackgroundColour( ColourValue(0,0,0) );
			
mat = MaterialManager::getSingleton().create(RTmatname, ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
t = mat->getTechnique(0)->getPass(0)->createTextureUnitState("egyptrockyfull.jpg");
t = mat->getTechnique(0)->getPass(0)->createTextureUnitState(RTname);
			
t->setColourOperationEx(LBX_BLEND_MANUAL, LBS_TEXTURE, LBS_CURRENT, ColourValue::White, 
									ColourValue::White,1.0);
			t->setTextureAddressingMode(TextureUnitState::TAM_CLAMP);
t->setProjectiveTexturing(false, mReflectCam);
0 x

Post Reply