diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2017-08-19 03:39:16 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2017-08-19 03:39:16 +0300 |
commit | 63f70ef14d8ab364d3cbbe2a329bcd555685219a (patch) | |
tree | 0e4b84e6bf7ce9f0932858d63a5688736c0b8788 /source/blender/draw/engines/eevee/shaders/effect_bloom_frag.glsl | |
parent | 2abc21ace5a046ee4043a6b9c8a317defb05a035 (diff) |
Eevee: Bloom: Add Clamp setting
It's purpose is to limit the amount of light that spread across the screen.
Not entierly sure if it's very usefull, but it sure help to avoid to drown the screen in bloom.
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders/effect_bloom_frag.glsl')
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/effect_bloom_frag.glsl | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/effect_bloom_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_bloom_frag.glsl index 5bb9607d33c..9aab9ae7b4f 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_bloom_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_bloom_frag.glsl @@ -31,6 +31,7 @@ uniform vec2 sourceBufferTexelSize; /* Step Blit */ uniform vec4 curveThreshold; +uniform float clampIntensity; /* Step Upsample */ uniform sampler2D baseBuffer; /* Previous accumulation buffer */ @@ -161,7 +162,11 @@ vec4 step_blit(void) rq = curveThreshold.z * rq * rq; /* Combine and apply the brightness response curve. */ - m *= max(rq, br - curveThreshold.w) / max(br, 1e-5); + m *= max(rq, br - curveThreshold.w) / max(1e-5, br); + + /* Clamp pixel intensity */ + br = max(1e-5, brightness(m)); + m *= 1.0 - max(0.0, br - clampIntensity) / br; return vec4(m, 1.0); } |