Jump to content
  • Advertisement
Sign in to follow this  
ShadowDragonX

Blend Modes - Writing Alpha to a texture

This topic is 2894 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 everybody,

I'm trying to do a 2D Scorched Earth/Worms style game in XNA. Basically my game is doing per-pixel collision detection using a texture for the collision map.

The problem I'm having is I'm just trying to draw a circle to my ground texture to cut a hole in it and I'm at a loss.

I'm trying to do it the way worms did with a black and white texture for the ground (white is collidable, black is not) and then get fancy by drawing a white circle (with black key color) to it and use the blend modes to invert the white to make a hole in it.

This isn't working.

I've also tried changing the white circle color to alpha (still with a black key color) and then tried to write directly to the ground texture's alpha channel and overwrite it....and again, this didn't work.

I'm at a loss as to how to do this.

Any help GREATLY appreciated!


Share this post


Link to post
Share on other sites
Advertisement

can you visualize the texture you've written the collision info to?
texture a 2d quad with it...what's it look like?

here's something that got me a while ago; not sure if it's related but
when writing to textures, make sure you enable alpha.

CGameObject::SetRenderState ( D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_BLUE | D3DCOLORWRITEENABLE_ALPHA );

the default is rgb, no alpha 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!