diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2017-11-23 21:16:11 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2017-11-23 21:16:11 +0300 |
commit | 4f8bffa7bfe46192b43c75d864e2117369cbffdd (patch) | |
tree | 3e869e57151f4d487106d59bba1f2282a9578a44 /source/blender/gpu | |
parent | b79b8478ee3bb1b115c5d6b8bdb0cc74d5169955 (diff) | |
parent | debd9f6ea1286533d4d5c9262fa6724c862fe35e (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_material.glsl | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl index 4aaaab2c5ad..5d0ca35cc1f 100644 --- a/source/blender/gpu/shaders/gpu_shader_material.glsl +++ b/source/blender/gpu/shaders/gpu_shader_material.glsl @@ -3348,7 +3348,10 @@ float calc_gradient(vec3 p, int gradient_type) return atan(y, x) / (M_PI * 2) + 0.5; } else { - float r = max(1.0 - sqrt(x * x + y * y + z * z), 0.0); + /* Bias a little bit for the case where p is a unit length vector, + * to get exactly zero instead of a small random value depending + * on float precision. */ + float r = max(0.999999 - sqrt(x * x + y * y + z * z), 0.0); if (gradient_type == 5) { /* quadratic sphere */ return r * r; } |