• Advertisement
Sign in to follow this  

XNA Alphablending

This topic is 3349 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'm doing a bunch of rendering, saving the resulting back buffer, and then using the back buffer in a post processing shader (on another render target). I then want to do an additive blend of the result of that render and the previously stored back buffer. This is the code I'm using at the moment - noEffect is essentially a VS that does nothing and a Pixel shader that just returns the colour of the texture at each pixel (again - nothing). http://www.ziggyware.com/codepaste.php?pasteID=499 I don't get a blended result, I simply get whatever I draw second. Any ideas? I could do the blending in a shader using two texture channels but that seems a bit OTT when this should work. Unless, of course, it shouldn't :) Cheers, Matt

Share this post


Link to post
Share on other sites
Advertisement
AlphaDestinationBlend and AlphaSourceBlend only affect the final value of the alpha channel, not the color channels. You need to set DestinationBlend and SourceBlend to Blend.One.

On a side note, you're not going to save anything by using hardware blending if you need to go through an entire pass just to get your first texture into the backbuffer. If what you want blended isn't already in the backbuffer, you're better off just sampling your two textures in the shader since you'll save the added bandwidth of the first rendering pass and also the additional bandwidth used by blending.

Share this post


Link to post
Share on other sites
Good point! Thanks very much :) The back buffer is already filled with one texture so wanted to do it this way.

Share this post


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

  • Advertisement