[c36722f9628] soc-2018-hair-shader: Remap randomization to roughness/color ± the given percentage factor

L. E. Segovia noreply at git.blender.org
Sun Jun 17 00:21:06 CEST 2018


Commit: c36722f96287b226f02783925f52bb413c6b3c0c
Author: L. E. Segovia
Date:   Sat Jun 16 22:20:26 2018 +0000
Branches: soc-2018-hair-shader
https://developer.blender.org/rBc36722f96287b226f02783925f52bb413c6b3c0c

Remap randomization to roughness/color ± the given percentage factor

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

M	intern/cycles/kernel/svm/svm_closure.h

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

diff --git a/intern/cycles/kernel/svm/svm_closure.h b/intern/cycles/kernel/svm/svm_closure.h
index e5486c1ab23..2c79188f2b5 100644
--- a/intern/cycles/kernel/svm/svm_closure.h
+++ b/intern/cycles/kernel/svm/svm_closure.h
@@ -748,8 +748,8 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *
 			color_randomization = clamp(color_randomization, 0.0f, 1.0f);
 			float roughness_randomization = (stack_valid(roughness_randomization_ofs)) ? stack_load_float(stack, roughness_randomization_ofs) : __uint_as_float(data_node3.w);
 
-			float factor_random_color = (1.0f-color_randomization)+random*color_randomization;
-			float factor_random_roughness = (1.0f - roughness_randomization) + random*roughness_randomization;
+			float factor_random_color = 1.0f + 2.0f*(random - 0.5f)*color_randomization;
+			float factor_random_roughness = 1.0f + 2.0f*(random - 0.5f)*roughness_randomization;
 
 			PrincipledHairBSDF *bsdf = (PrincipledHairBSDF*)bsdf_alloc(sd, sizeof(PrincipledHairBSDF), weight);
 			if(bsdf) {



More information about the Bf-blender-cvs mailing list