Giter Site home page Giter Site logo

parhelia512 / bloomfilter-for-monogame-and-xna Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kosmonaut3d/bloomfilter-for-monogame-and-xna

0.0 1.0 0.0 493 KB

A bloom filter module, which can easily be added to existing applications. Solution includes sample

C# 68.59% HLSL 31.41%

bloomfilter-for-monogame-and-xna's Introduction

BloomFilter for Monogame and XNA

A Bloom filter usable for Monogame and XNA applications.

Included is a sample solution, which shows the basic setup and how the integration can look like.

For the effect itself you only need the BloomFilter.cs and Shaders/BloomFilter/Bloom.fx files. This is a Windows desktop build, with DirectX.

OpenGL

I have added and tested Crossplatform and it should work without many problems (hopefully) now. Instead of using the default directx shaders we have to switch to OpenGL shaders. In shaders/bloomfilter/ there is a different .fx file called bloomCrossPlatform.fx If you rename that one to bloom.fx it should work.

Description

The default rendertargets are of Format.Color, but if you do HDR or fp16 in general you should switch them up to fp16, too.

Alt text

High-Quality Bloom filter for high-performance applications

Based largely on the implementations in Unreal Engine 4 and Call of Duty AW
For more information look for

"Next Generation Post Processing in Call of Duty Advanced Warfare" by Jorge Jimenez

http://www.iryoku.com/downloads/Next-Generation-Post-Processing-in-Call-of-Duty-Advanced-Warfare-v18.pptx


The idea is to have several rendertargets or one rendertarget with several mip maps
so each mip has half resolution (1/2 width and 1/2 height) of the previous one.

32, 16, 8, 4, 2

In the first step we extract the bright spots from the original image. If not specified otherwise thsi happens in full resolution.
We can do that based on the average RGB value or Luminance and check whether this value is higher than our Threshold.

    BloomUseLuminance = true / false (default is true)

    BloomThreshold = 0.8f;

Then we downscale this extraction layer to the next mip map.
While doing that we sample several pixels around the origin.

We continue to downsample a few more times, defined in

    BloomDownsamplePasses = 5 ( default is 5)

Afterwards we upsample again, but blur in this step, too.
The final output should be a blur with a very large kernel and smooth gradient.

The output in the draw is only the blurred extracted texture. 
It can be drawn on top of / merged with the original image with an additive operation for example.

If you use ToneMapping you should apply Bloom before that step.

bloomfilter-for-monogame-and-xna's People

Contributors

kosmonaut3d avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.