I'm currently rendering my whole game to a RenderTarget
in order to stretch the scene to any resolution. I also have a bloom effect rendered with the scene. I'm now working on the UI part of the game, the problem is, I don't want the bloom to affect the UI elements.
So in order to not have the bloom apply to the UI, I need to draw it after the base.Draw(gameTime);
call. It works, the UI is not affected by the bloom but is also rendered outside of the render target which isn't making it responsive for every resolution.
How can I incorporate the UI inside the render target but without having it affected by the bloom component?
This is the Draw method code:
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.SetRenderTarget(_renderTarget);
GraphicsDevice.Clear(Color.Black);
Bloom.BeginDraw();
_currentState.Draw(gameTime, _spriteBatch);
GraphicsDevice.SetRenderTarget(null);
_spriteBatch.Begin(blendState: BlendState.AlphaBlend);
_spriteBatch.Draw(_renderTarget, new Rectangle(0, 0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height), Color.White);
//_spriteBatch.Draw(texture, new Rectangle(50, 50, 500, 200), new Color(Color.Black, 0.7f));
_spriteBatch.End();
base.Draw(gameTime);
_currentState.PostDraw(gameTime, _spriteBatch);
}