diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-09-10 17:26:18 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-09-10 19:05:11 +0300 |
commit | 5e7a56dc646596c8cdac6f7ade8665c3ccbe201b (patch) | |
tree | 358c280f0e2c393194631ababb759cceef9b6d4a /source/blender/draw/engines/eevee/shaders/effect_dof_vert.glsl | |
parent | ec64cad5a88ca892a8c2189574344a4b90cfa80d (diff) |
Eevee: Cleanup DoF implementation
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 | 10 |
1 files changed, 6 insertions, 4 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 6e43115d799..ec8b474b431 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_dof_vert.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_dof_vert.glsl @@ -47,7 +47,9 @@ void main() color = texelFetch(farBuffer, texelco, 0); } /* find the area the pixel will cover and divide the color by it */ - color.a = 1.0 / (coc * coc * M_PI); + /* 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; /* Compute edge to discard fragment that does not belong to the other layer. */ @@ -92,7 +94,9 @@ void main() gl_Position.xy += (0.5 + vec2(texelco) * 2.0) * texel_size; /* Push far plane to left side. */ - gl_Position.x += (!is_near) ? 1.0 : 0.0; + if (!is_near) { + gl_Position.x += 2.0 / 2.0; + } /* don't do smoothing for small sprites */ if (coc > 3.0) { @@ -101,6 +105,4 @@ void main() else { smoothFac = 1.0; } - - int tex_width = textureSize(cocBuffer, 0).x; } |