diff options
Diffstat (limited to 'source')
3 files changed, 18 insertions, 2 deletions
diff --git a/source/blender/draw/engines/eevee_next/eevee_instance.hh b/source/blender/draw/engines/eevee_next/eevee_instance.hh index f47d4f20363..1efda769648 100644 --- a/source/blender/draw/engines/eevee_next/eevee_instance.hh +++ b/source/blender/draw/engines/eevee_next/eevee_instance.hh @@ -111,7 +111,7 @@ class Instance { bool overlays_enabled() const { - return (!v3d) || ((v3d->flag & V3D_HIDE_OVERLAYS) == 0); + return v3d && ((v3d->flag2 & V3D_HIDE_OVERLAYS) == 0); } bool use_scene_lights() const diff --git a/source/blender/draw/engines/eevee_next/shaders/eevee_film_frag.glsl b/source/blender/draw/engines/eevee_next/shaders/eevee_film_frag.glsl index 5867330f151..26040234fd0 100644 --- a/source/blender/draw/engines/eevee_next/shaders/eevee_film_frag.glsl +++ b/source/blender/draw/engines/eevee_next/shaders/eevee_film_frag.glsl @@ -26,4 +26,6 @@ void main() } gl_FragDepth = get_depth_from_view_z(-out_depth); + + gl_FragDepth = film_display_depth_ammend(texel_film, gl_FragDepth); } diff --git a/source/blender/draw/engines/eevee_next/shaders/eevee_film_lib.glsl b/source/blender/draw/engines/eevee_next/shaders/eevee_film_lib.glsl index 62c3d89cfc4..b286836e8df 100644 --- a/source/blender/draw/engines/eevee_next/shaders/eevee_film_lib.glsl +++ b/source/blender/draw/engines/eevee_next/shaders/eevee_film_lib.glsl @@ -192,7 +192,7 @@ float film_distance_load(ivec2 texel) /* Repeat texture coordinates as the weight can be optimized to a small portion of the film. */ texel = texel % imageSize(in_weight_img).xy; - if (film_buf.use_history == false) { + if (!film_buf.use_history || film_buf.use_reprojection) { return 1.0e16; } return imageLoad(in_weight_img, ivec3(texel, WEIGHT_lAYER_DISTANCE)).x; @@ -577,6 +577,20 @@ void film_store_weight(ivec2 texel, float value) imageStore(out_weight_img, ivec3(texel, WEIGHT_lAYER_ACCUMULATION), vec4(value)); } +float film_display_depth_ammend(ivec2 texel, float depth) +{ + /* This effectively offsets the depth of the whole 2x2 region to the lowest value of the region + * twice. One for X and one for Y direction. */ + /* TODO(fclem): This could be improved as it gives flickering result at depth discontinuity. + * But this is the quickest stable result I could come with for now. */ +#ifdef GPU_FRAGMENT_SHADER + depth += fwidth(depth); +#endif + /* Small offset to avoid depth test lessEqual failing because of all the conversions loss. */ + depth += 2.4e-7 * 4.0; + return saturate(depth); +} + /** \} */ /** NOTE: out_depth is scene linear depth from the camera origin. */ |