[Bf-blender-cvs] [da975c5] master: GLSL: Fix voronoi texture giving different results form rendered
Sergey Sharybin
noreply at git.blender.org
Mon May 30 13:07:12 CEST 2016
Commit: da975c59c2a0f5844ba01031aa6843c09dc4fddc
Author: Sergey Sharybin
Date: Mon May 30 13:07:11 2016 +0200
Branches: master
https://developer.blender.org/rBda975c59c2a0f5844ba01031aa6843c09dc4fddc
GLSL: Fix voronoi texture giving different results form rendered
===================================================================
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 a3b0580..91ca6a5 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -2403,6 +2403,12 @@ int floor_to_int(float x)
{
return int(floor(x));
}
+
+int quick_floor(float x)
+{
+ return int(x) - ((x < 0) ? 1 : 0);
+}
+
#ifdef BIT_OPERATIONS
float integer_noise(int n)
{
@@ -2453,9 +2459,9 @@ float bits_to_01(uint bits)
float cellnoise(vec3 p)
{
- int ix = floor_to_int(p.x);
- int iy = floor_to_int(p.y);
- int iz = floor_to_int(p.z);
+ int ix = quick_floor(p.x);
+ int iy = quick_floor(p.y);
+ int iz = quick_floor(p.z);
return bits_to_01(hash(uint(ix), uint(iy), uint(iz)));
}
More information about the Bf-blender-cvs
mailing list