Reverse BlendState.

I wrote this simple custom BlendState.
image

Without a RenderTarget everything works fine.
GoodImage

However, when I’m drawing to a RenderTarget. Things go wrong.
BadIMage

The problem is that the SpriteBatch class is using AlphaBlend by default and thus it alters the final image.
Screenshot_1

Just use renderstate.alphablend when beginning the spritebatch there. It’s a possible parameter.

More sure you call “clear” on the render target and choose a transparent background.

Oh I see you don’t want it. Nevertheless blendstate is a parameter for spritebatch calls.

This is how i doing currently. As i said the problem is that when i draw the final RenderTarget the SpriteBatch is going to modify the image. I need an another custom BlendState to prevent that but i don’t have any idea about how to do it.
image

Try clearing the backbuffer after the render to texture

I would clear the second back buffer to black. I would use BlendState.AlphaBlend for both SpriteBatch.Begin() calls. Not sure why additive is being used unless you’re doing something a bit out of the ordinary.

Since that, I found the solution :D. Anybody who is interested in the result here’s the library where I contributed NuklearDotNet