[Bf-blender-cvs] [d32a103d53c] master: Fix T63789: Precision issues in glsl noise texture

mano-wii noreply at git.blender.org
Sat May 4 22:08:40 CEST 2019


Commit: d32a103d53c46317ca2dd8bcf7c666782c05562f
Author: mano-wii
Date:   Sat May 4 16:44:44 2019 -0300
Branches: master
https://developer.blender.org/rBd32a103d53c46317ca2dd8bcf7c666782c05562f

Fix T63789: Precision issues in glsl noise texture

There is a significant precision loss when converting large float values to int.

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

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 cf7a83e8a87..1cbf58f9d16 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -1162,8 +1162,9 @@ vec3 cellnoise_color(vec3 p)
 
 float floorfrac(float x, out int i)
 {
-  i = floor_to_int(x);
-  return x - i;
+  float x_floor = floor(x);
+  i = int(x_floor);
+  return x - x_floor;
 }
 
 /* bsdfs */



More information about the Bf-blender-cvs mailing list