i have a 2D MonoGame Game (using DirectX), that was originally an XNA game. It involves prerendered shadows (they are Texture2Ds drawn with SpriteBatch.draw). Right now the shadows are being drawn with an alpha value, so overlapping shadows appear darker. This is NOT what i want. Overlapping shadows should be the same shade of black.
So what i want to do is draw all these shadows to a surface, such that the shadows are completely black (alpha == 255), and the surface background is completely transparent (alpha == 0), and then take that surface and draw it to the screen using Color.White*0.25f to give alpha to the shadows at the end.
I'm not sure how to switch rendering targets, or whatever the terminology is, and go about this. Can someone help?
what ive tried so far:
GraphicsDevice.SetRenderTarget(RENTAR); // RENTAR is the name of my RenderTarget2D
GraphicsDevice.DepthStencilState = new DepthStencilState() { DepthBufferEnable = true }; // not really sure what this does but it was in examples
GraphicsDevice.Clear(Color.White*0.0f); // i clear it with a totally transparent white background, in other words, white with alpha == 0
// now draw shadows normally, but instead of Color.White*0.25f, i use Color.White so that the black shadows are drawn completely black, with no alpha
GraphicsDevice.SetRenderTarget(null); // switch render target back to the screen
SpriteBatch.Draw(RENTAR, new Rectangle(0, 0, 800, 600), Color.White*0.25f); // see i added the "*0.25f" to try to draw this texture with alpha, but it comes out totally blank
So all of this works except that the shadows end up being completely black. I want them completely black in the RenderTarget, so that they dont overlap with any darker shades, and then i want to draw the final RenderTarget on the screen with an alpha of 0.25f, hence "Color.White*0.25f" in the final spritebatch draw. But its as if that 0.25f doesn't exit.