Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2021-03-04 13:59:49 +0300
committerClément Foucault <foucault.clem@gmail.com>2021-03-08 19:25:16 +0300
commitba75ea8012084aa84ba8c9ac088b88a8dcf4fb21 (patch)
tree32610751177961885185afee8f4c4773ccda4ced /source/blender/draw/intern/shaders/common_math_lib.glsl
parent6afe2d373a00a49a7a51cafec50d03ada0fe0743 (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.glsl6
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. */
+}
+
/** \} */
/* ---------------------------------------------------------------------- */