diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-02-13 03:54:59 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-02-13 03:55:08 +0300 |
commit | eaea5c8904bee569384598cc96af10f7f55a9be8 (patch) | |
tree | 1249b4dd79d1833e463ed0dd955fd4f50954fea8 /source/blender/draw/engines/workbench/shaders | |
parent | 10b04fa3162c4e1c1036d6c4837cff27134e3f11 (diff) |
Workbench: Fix depth of field background being glitchy
Diffstat (limited to 'source/blender/draw/engines/workbench/shaders')
-rw-r--r-- | source/blender/draw/engines/workbench/shaders/workbench_effect_dof_frag.glsl | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_effect_dof_frag.glsl b/source/blender/draw/engines/workbench/shaders/workbench_effect_dof_frag.glsl index bd16189db32..0efcfb35929 100644 --- a/source/blender/draw/engines/workbench/shaders/workbench_effect_dof_frag.glsl +++ b/source/blender/draw/engines/workbench/shaders/workbench_effect_dof_frag.glsl @@ -251,7 +251,7 @@ void main() ivec2 texel = ivec2(uv * size); vec4 color = vec4(0.0); - float tot = 1e-4; + float tot = 0.0; float coc = decode_coc(texelFetch(inputCocTex, texel, 0).rg); float max_radius = coc; @@ -272,7 +272,12 @@ void main() tot += weight; } - blurColor = color / tot; + if (tot > 0.0) { + blurColor = color / tot; + } + else { + blurColor = textureLod(halfResColorTex, uv, 0.0); + } } #endif @@ -385,7 +390,9 @@ void main() * ----------------- STEP 4 ------------------ */ #ifdef RESOLVE -out vec4 finalColor; + +layout(location = 0) out vec4 finalColorAdd; +layout(location = 1) out vec4 finalColorMul; void main() { @@ -398,7 +405,8 @@ void main() float zdepth = linear_depth(depth); float coc = calculate_coc(zdepth); - finalColor = texture(halfResColorTex, uv); - finalColor.a = smoothstep(1.0, 3.0, abs(coc)); + float blend = smoothstep(1.0, 3.0, abs(coc)); + finalColorAdd = texture(halfResColorTex, uv) * blend; + finalColorMul = vec4(1.0 - blend); } #endif |