diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-10-15 17:04:33 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-10-15 17:04:50 +0300 |
commit | 9ecf68e8ae060c8d46a809ca3e6aacf399f23033 (patch) | |
tree | 2ae014c7815366e1118fce2941231a9c8bb1dc54 /source/blender/draw/engines/eevee/shaders/effect_dof_vert.glsl | |
parent | 478899dee771e2421d49077674af4de97b78cd9e (diff) |
Eevee: Fix Missing alpha when rendering with DOF
NOTE: There is a float imprecision near the focus plane
due to the current technique used for DOF. This makes the alpha channel
transparent on nearly in focus objects even when they should not.
This artifact should be fixed when the DOF will use scatter as gather for
low brightness areas.
Fix T57042 : Eevee does not render alpha when DOF is turned on
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders/effect_dof_vert.glsl')
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/effect_dof_vert.glsl | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/effect_dof_vert.glsl b/source/blender/draw/engines/eevee/shaders/effect_dof_vert.glsl index ec8b474b431..92fd36f684a 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_dof_vert.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_dof_vert.glsl @@ -10,6 +10,7 @@ uniform sampler2D farBuffer; uniform sampler2D cocBuffer; flat out vec4 color; +flat out float weight; flat out float smoothFac; flat out ivec2 edge; out vec2 particlecoord; @@ -49,8 +50,8 @@ void main() /* find the area the pixel will cover and divide the color by it */ /* HACK: 4.0 out of nowhere (I suppose it's 4 pixels footprint for coc 0?) * Makes near in focus more closer to 1.0 alpha. */ - color.a = 4.0 / (coc * coc * M_PI); - color.rgb *= color.a; + weight = 4.0 / (coc * coc * M_PI); + color *= weight; /* Compute edge to discard fragment that does not belong to the other layer. */ edge.x = (is_near) ? 1 : -1; |