Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

davedx

Alpha blending weirdness

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

Hey, I have a problem with alpha blending producing some strange results and wondered if anyone could provide some pointers as to what might be going wrong. I''ve been putting together some stuff from the directx tutorials at www.andypike.com. At the moment I''m using the mesh class found there to load a simple .x model of a spaceship, and behind it, there''s a sphere (supposed to be a planet!). Neither the ship nor the planet are texture mapped, and they have default material properties, nothing fancy. With those two objects everything is cool. The problem occurs when I try to introduce a 2D control panel overlay (again using code found at the tutorials above). The 2D overlay is a single panel with a transparent texture rendered onto it in orthographic projection mode. To do this alpha blending is setup during initialisation. What happens is: - the sphere disappears completely - the colour of the texture being rendered to the 2D panel is incorrect (light white instead of orange) If I remove the sphere from the render pipeline, the 2D colour problem goes away. If I remove the alpha blending initialisation, everything works fine (except for the 2D panel). The reason I''m so stumped is that I thought alpha blending applies to textures, not vertex shaders? Any help would be most welcome! Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Just bumping this, as I'm still having the problem. :( Any suggestions at all would be great!

Share this post


Link to post
Share on other sites
I'm just taking a guess about how your code is set up, but do you set the alpha stuff, and then render everything, the planet, 2D interface, and all? If so, what you should probably try is set up your Render States to disable alpha blending, draw your sphere, and then set up your Render States to enable alpha, after which you draw your interface. You'll end up doing this every frame, but most programs involve at least some state changes every frame. You do want to minimize these changes as much as possible, but sometimes they simply need to be done.

Or maybe I'm making poor assumptions about how you have things set up...

Share this post


Link to post
Share on other sites

  • 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!