Jump to content
  • Advertisement
Sign in to follow this  
PERECil

Alpha blending not working correctly

This topic is 4832 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everybody, i've got a problem doing alphablending when using texture's alpha channel. The renderstate is:
GraphicEngine.Instance.RenderingDevice.RenderState.AlphaBlendEnable = true;

GraphicEngine.Instance.RenderingDevice.SetTexture(0, Texture.Data);

GraphicEngine.Instance.RenderingDevice.TextureState[0].ColorOperation = TextureOperation.SelectArg1;
GraphicEngine.Instance.RenderingDevice.TextureState[0].ColorArgument1 = TextureArgument.TextureColor;
GraphicEngine.Instance.RenderingDevice.TextureState[0].ColorArgument2 = TextureArgument.Diffuse;

GraphicEngine.Instance.RenderingDevice.TextureState[0].AlphaOperation = TextureOperation.SelectArg1;
GraphicEngine.Instance.RenderingDevice.TextureState[0].AlphaArgument1 = TextureArgument.TextureColor;
GraphicEngine.Instance.RenderingDevice.TextureState[0].AlphaArgument2 = TextureArgument.Diffuse;

GraphicEngine.Instance.RenderingDevice.RenderState.AlphaSourceBlend = Blend.SourceAlpha;
GraphicEngine.Instance.RenderingDevice.RenderState.AlphaDestinationBlend = Blend.InvSourceAlpha;
GraphicEngine.Instance.RenderingDevice.RenderState.AlphaBlendOperation = BlendOperation.Add;


I'm using it on a TransformedTextured Vertex type. The code that loads the picture (DDS format, DX Texture tool shows that there is an alpha channel in the picture):
TextureAtLevel0.Data = TextureLoader.FromFile(GraphicEngine.Instance.RenderingDevice, FileName, 0, 0, 0, Usage.None, Format.Unknown, Pool.Managed, Filter.None, Filter.None, 0, ref Info);


The texture shows like there wasn't any alpha channel : an example picture can be found here: The original picture can be found here: PNG Version DDS Version Can somebody help me? [edit] forgot a line in Texture State [Edited by - PERECil on August 24, 2005 8:31:04 AM]

Share this post


Link to post
Share on other sites
Advertisement
Oh! Thanks! The problem has gone away :). Mmm I should program a tool that would permit me to change on the fly such things to test differents combinations. This would help me a lot I think :).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!