[Bf-blender-cvs] [9ae5708df42] soc-2019-cycles-procedural: Fix 2D noise_grad function
OmarSquircleArt
noreply at git.blender.org
Thu Jun 27 19:35:39 CEST 2019
Commit: 9ae5708df425ea6c8c40e4e807a3604e72b28b2f
Author: OmarSquircleArt
Date: Thu Jun 27 19:36:37 2019 +0200
Branches: soc-2019-cycles-procedural
https://developer.blender.org/rB9ae5708df425ea6c8c40e4e807a3604e72b28b2f
Fix 2D noise_grad function
===================================================================
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 8917c3977a6..a7a5b1eb494 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -3230,7 +3230,7 @@ float noise_grad(uint hash, float x, float y)
{
uint h = hash & 7u;
float u = h < 4u ? x : y;
- float v = 2.0 * h < 4 ? y : x;
+ float v = 2.0 * (h < 4u ? y : x);
return negate_if(u, h & 1u) + negate_if(v, h & 2u);
}
@@ -3246,9 +3246,9 @@ float noise_grad(uint hash, float x, float y, float z)
float noise_grad(uint hash, float x, float y, float z, float w)
{
uint h = hash & 31u;
- float u = (h < 24u) ? x : y;
- float v = (h < 16u) ? y : z;
- float s = (h < 8u) ? z : w;
+ float u = h < 24u ? x : y;
+ float v = h < 16u ? y : z;
+ float s = h < 8u ? z : w;
return negate_if(u, h & 1u) + negate_if(v, h & 2u) + negate_if(s, h & 4u);
}
More information about the Bf-blender-cvs
mailing list