diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2021-03-04 13:59:49 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2021-03-08 19:25:16 +0300 |
commit | ba75ea8012084aa84ba8c9ac088b88a8dcf4fb21 (patch) | |
tree | 32610751177961885185afee8f4c4773ccda4ced /source/blender/draw/intern/shaders/common_math_lib.glsl | |
parent | 6afe2d373a00a49a7a51cafec50d03ada0fe0743 (diff) |
EEVEE: Use Fullscreen maxZBuffer instead of halfres
This removes the need for per mipmap scalling factor and trilinear interpolation
issues. We pad the texture so that all mipmaps have pixels in the next mip.
This simplifies the downsampling shader too.
This also change the SSR radiance buffer as well in the same fashion.
Diffstat (limited to 'source/blender/draw/intern/shaders/common_math_lib.glsl')
-rw-r--r-- | source/blender/draw/intern/shaders/common_math_lib.glsl | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/draw/intern/shaders/common_math_lib.glsl b/source/blender/draw/intern/shaders/common_math_lib.glsl index d02fd27f35f..0344b977139 100644 --- a/source/blender/draw/intern/shaders/common_math_lib.glsl +++ b/source/blender/draw/intern/shaders/common_math_lib.glsl @@ -128,6 +128,12 @@ vec3 normalize_len(vec3 v, out float len) return v / len; } +vec4 safe_color(vec4 c) +{ + /* Clamp to avoid black square artifacts if a pixel goes NaN. */ + return clamp(c, vec4(0.0), vec4(1e20)); /* 1e20 arbitrary. */ +} + /** \} */ /* ---------------------------------------------------------------------- */ |