[Bf-blender-cvs] [e998465] master: Cycles: Fix Wave texture difference between OSL and SVM, OSL wasn't using the "Scale" properly for distortion.

Thomas Dinges noreply at git.blender.org
Mon Jan 13 22:01:49 CET 2014


Commit: e9984653a827f1f5de8e1a1d019854b77afb1ea5
Author: Thomas Dinges
Date:   Mon Jan 13 22:01:39 2014 +0100
https://developer.blender.org/rBe9984653a827f1f5de8e1a1d019854b77afb1ea5

Cycles: Fix Wave texture difference between OSL and SVM, OSL wasn't using the "Scale" properly for distortion.

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

M	intern/cycles/kernel/shaders/node_wave_texture.osl
M	intern/cycles/kernel/svm/svm_wave.h

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

diff --git a/intern/cycles/kernel/shaders/node_wave_texture.osl b/intern/cycles/kernel/shaders/node_wave_texture.osl
index 2de376c..ba40207 100644
--- a/intern/cycles/kernel/shaders/node_wave_texture.osl
+++ b/intern/cycles/kernel/shaders/node_wave_texture.osl
@@ -19,19 +19,15 @@
 
 /* Wave */
 
-float wave(point p, float scale, string type, float detail, float distortion, float dscale)
+float wave(point p, string type, float detail, float distortion, float dscale)
 {
-	float x = p[0] * scale;
-	float y = p[1] * scale;
-	float z = p[2] * scale;
-
 	float n = 0.0;
 
 	if (type == "Bands") {
-		n = (x + y + z) * 10.0;
+		n = (p[0] + p[1] + p[2]) * 10.0;
 	}
 	else if (type == "Rings") {
-		n = (sqrt(x * x + y * y + z * z) * 20.0);
+		n = length(p) * 20.0;
 	}
 
 	if (distortion != 0.0) {
@@ -57,7 +53,7 @@ shader node_wave_texture(
 	if (use_mapping)
 		p = transform(mapping, p);
 
-	Fac = wave(p, Scale, Type, Detail, Distortion, DetailScale);
+	Fac = wave(p * Scale, Type, Detail, Distortion, DetailScale);
 	Color = Fac;
 }
 
diff --git a/intern/cycles/kernel/svm/svm_wave.h b/intern/cycles/kernel/svm/svm_wave.h
index 3749135..7f90815 100644
--- a/intern/cycles/kernel/svm/svm_wave.h
+++ b/intern/cycles/kernel/svm/svm_wave.h
@@ -18,12 +18,10 @@ CCL_NAMESPACE_BEGIN
 
 /* Wave */
 
-ccl_device_noinline float svm_wave(NodeWaveType type, float3 p, float scale, float detail, float distortion, float dscale)
+ccl_device_noinline float svm_wave(NodeWaveType type, float3 p, float detail, float distortion, float dscale)
 {
 	float n;
 
-	p *= scale;
-
 	if(type == NODE_WAVE_BANDS)
 		n = (p.x + p.y + p.z) * 10.0f;
 	else /* NODE_WAVE_RINGS */
@@ -51,7 +49,7 @@ ccl_device void svm_node_tex_wave(KernelGlobals *kg, ShaderData *sd, float *stac
 	float distortion = stack_load_float_default(stack, distortion_offset, node2.z);
 	float dscale = stack_load_float_default(stack, dscale_offset, node2.w);
 
-	float f = svm_wave((NodeWaveType)type, co, scale, detail, distortion, dscale);
+	float f = svm_wave((NodeWaveType)type, co*scale, detail, distortion, dscale);
 
 	if(stack_valid(fac_offset)) stack_store_float(stack, fac_offset, f);
 	if(stack_valid(color_offset)) stack_store_float3(stack, color_offset, make_float3(f, f, f));




More information about the Bf-blender-cvs mailing list