How to Fade/set alpha/transparency on Overlays...?!

RichTufty

16-02-2007 17:42:31

Hey, i'm looking high and low to try and find out how to do this, i would like to fade in an OverlayContainer for a HUD. I'm using MOGRE with C#.

I have an overlay that uses a PNG to display say a Map to the screen, i'm cool with coding the actual fade, i just want to know the command(s) to set the alpha on the image of the overlay.

Do i have to manipulate the material? The overlay itself?

Any help whatsoever would be much appreciated!!

Many thanks,
Tufty

RichTufty

20-02-2007 11:58:04

OK this is how i solved how to make overlays transparent:

My overlay just has a single material (from an image file)

For the material (in the script) in the pass needed:
scene_blend alpha_blend




/*
materialName - material i am wanting to fade
fade - float holding the fade value, 0 being completey transparent 1 being solid
*/

MaterialPtr tempMat = MaterialManager.Singleton.GetByName(materialName);
TextureUnitState tempTex = tempMat.GetTechnique(0).GetPass(0).GetTextureUnitState(0);
tempTex.SetAlphaOperation(LayerBlendOperationEx.LBX_MODULATE, LayerBlendSource.LBS_TEXTURE, LayerBlendSource.LBS_MANUAL, 1.0f, fade);



Hope this helps others trying to acheive the same as me!

Tufty