[Bf-blender-cvs] [1fa7d51f342] master: Eevee: Noise Texture: try to fix floating point accuracy issue

Clément Foucault noreply at git.blender.org
Fri Apr 26 18:37:31 CEST 2019


Commit: 1fa7d51f342a07febac102d381fd3075efc78e2b
Author: Clément Foucault
Date:   Fri Apr 26 18:37:17 2019 +0200
Branches: master
https://developer.blender.org/rB1fa7d51f342a07febac102d381fd3075efc78e2b

Eevee: Noise Texture: try to fix floating point accuracy issue

Cycles check for infinity and return 0.0 otherwise.

===================================================================

M	source/blender/gpu/shaders/gpu_shader_material.glsl

===================================================================

diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl
index 6ad93e88130..36c4138cefd 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -2771,7 +2771,9 @@ float noise_perlin(float x, float y, float z)
 
   noise_v[1] = noise_nerp(v, noise_u[0], noise_u[1]);
 
-  return noise_scale3(noise_nerp(w, noise_v[0], noise_v[1]));
+  float r = noise_scale3(noise_nerp(w, noise_v[0], noise_v[1]));
+
+  return (isinf(r)) ? 0.0 : r;
 }
 
 float noise(vec3 p)



More information about the Bf-blender-cvs mailing list