Hi there!
Yesterday I was discussing with @Jjagg how it would be nice to have small reusable parts that one could load when designing a game.
So here we are.
github: https://github.com/UnterrainerInformatik/BloomEffectRenderer
nuget: https://www.nuget.org/packages/BloomEffectRenderer/
This render-pipeline renders a bloom effect using the old XNA technique in the old blog posts (reference is in the readme) but without all the hassle.
Just get the package via nuget and start blooming
The shaders are embedded, so you don’t even have to add them to the content pipeline.
Should be easy to use:
private Point Resolution { get; } = new Point(1920, 1080);
private Renderer Renderer { get; } = new Renderer();
protected override void LoadContent()
{
...
Renderer.LoadContent(GraphicsDevice);
...
}
protected override void UnloadContent()
{
...
Renderer?.UnloadContent();
...
}
protected override void Initialize()
{
base.Initialize();
Renderer.Initialize(graphics.GraphicsDevice, Resolution);
}
protected override void Draw(GameTime gameTime)
{
// Image is some Texture2D that will be drawn to the backbuffer in this example.
// (hence the <null>).
// To bloom your game in a post-process step, draw all your assets to a
// RenderTarget2D first and then pass that rendertarget to this method.
Renderer.Render(graphics.GraphicsDevice, spriteBatch, "image", Image, null, Settings.PRESET_SETTINGS[1]);
base.Draw(gameTime);
}
As always, if you have suggestions or find bugs, I’m open to pull requests / discussions here or on GitHub, no problem.
Or PM me.
cu,
Psilo