Commit: 836fc68c526bc5a15d628ba282fc401cbe824902 Author: Sergey Sharybin Date: Mon May 30 13:07:11 2016 +0200 Branches: compositor-2016 https://developer.blender.org/rB836fc68c526bc5a15d628ba282fc401cbe824902
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))); } _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs