Jump to content
  • Advertisement
Sign in to follow this  
JohannesH

XNA alpha overlay problem

This topic is 3057 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

I am a beginner in XNA, but have used MDX a short time. I am in the process of moving a MDX project to XNA and got into a strange painting issue with alpha blending. This was working fine in MDX. I am setting RenderState: GraphicsDevice.RenderState.AlphaBlendEnable = true; GraphicsDevice.RenderState.SourceBlend = Blend.SourceAlpha ; GraphicsDevice.RenderState.DestinationBlend = Blend.InverseSourceAlpha; And all works well until I get to overlay 2 TriangleStrips. I would have expected the color to simply get darker when they are overlaid (alpha channel set to 130 for both). A png to illustrate is here: http://www.farmergps.com/download/test4/XNA-Alpha1.png Had some trouble converting from LH to RH, however I don't think that is related. (you can see the grid shining through, although it was drawn first and has the same 0 z value as the violet drawing) Maybe somebody can point me in the right direction? Thanks, Johannes

Share this post


Link to post
Share on other sites
Advertisement
After some more experiments I am thinking that my problem may not be alpha channel related but maybe more to the order of triangles. I have seen some triangles disappear to white....

Share this post


Link to post
Share on other sites
Found my problem:

GraphicsDevice.RenderState.DepthBufferEnable = true;
GraphicsDevice.RenderState.DepthBufferWriteEnable = false;

This article did the trick:
http://blogs.msdn.com/shawnhar/archive/2009/02/18/depth-sorting-alpha-blended-objects.aspx

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!