Sign in to follow this  

Blend Modes - Writing Alpha to a texture

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

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

This topic is 2645 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this