Friday, November 18, 2022
HomeGame Developmentc# - Monogame - RenderTarget with bloom impact

c# – Monogame – RenderTarget with bloom impact


I am at present rendering my entire sport to a RenderTarget in an effort to stretch the scene to any decision. I even have a bloom impact rendered with the scene. I am now engaged on the UI a part of the sport, the issue is, I do not need the bloom to have an effect on the UI components. So in an effort to not have the bloom apply to the UI, I want to attract it after the bottom.Draw(gameTime); name. It really works, the UI isn’t affected by the bloom however can be rendered outdoors of the render goal which is not making it responsive for each decision. How can I incorporate the UI contained in the rendertarget however with out having it affected by the bloom element?

that is the Draw technique code:

 protected override void Draw(GameTime gameTime)
    {
        GraphicsDevice.SetRenderTarget(_renderTarget);
        GraphicsDevice.Clear(Colour.Black);

        Bloom.BeginDraw();

        _currentState.Draw(gameTime, _spriteBatch);
        GraphicsDevice.SetRenderTarget(null);
        _spriteBatch.Start(blendState: BlendState.AlphaBlend);
        _spriteBatch.Draw(_renderTarget, new Rectangle(0, 0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Top), Colour.White);
        //_spriteBatch.Draw(texture, new Rectangle(50, 50, 500, 200), new Colour(Colour.Black, 0.7f));
        _spriteBatch.Finish();

        base.Draw(gameTime);

        _currentState.PostDraw(gameTime, _spriteBatch);
    }

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments