[Bf-blender-cvs] [20ed03722fa] soc-2018-hair-shader: Remove "Physical" parametrization [READ BELOW PLEASE]

L. E. Segovia noreply at git.blender.org
Sat Jun 16 15:53:13 CEST 2018


Commit: 20ed03722fad0954d961aeaa0a3b0b5df548afb7
Author: L. E. Segovia
Date:   Sat Jun 16 13:52:42 2018 +0000
Branches: soc-2018-hair-shader
https://developer.blender.org/rB20ed03722fad0954d961aeaa0a3b0b5df548afb7

Remove "Physical" parametrization [READ BELOW PLEASE]

This commits reorders the existing modes. Please review your scenes, and adjust
parametrizations as needed.

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

M	intern/cycles/kernel/shaders/node_principled_hair_bsdf.osl
M	intern/cycles/kernel/svm/svm_closure.h
M	intern/cycles/kernel/svm/svm_types.h
M	intern/cycles/render/nodes.cpp
M	source/blender/makesdna/DNA_node_types.h
M	source/blender/makesrna/intern/rna_nodetree.c
M	source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.c

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

diff --git a/intern/cycles/kernel/shaders/node_principled_hair_bsdf.osl b/intern/cycles/kernel/shaders/node_principled_hair_bsdf.osl
index 49ae9d3d0ba..715247f77e6 100644
--- a/intern/cycles/kernel/shaders/node_principled_hair_bsdf.osl
+++ b/intern/cycles/kernel/shaders/node_principled_hair_bsdf.osl
@@ -52,9 +52,6 @@ shader node_principled_hair_bsdf(
 	if (parametrization == "Absorption coefficient") {
 		Sigma = AbsorptionCoefficient;
 	}
-	else if (parametrization == "physical") {
-		Sigma = -log3(max(AbsorptionCoefficient, 1e-5));
-	}
 	else if (parametrization == "Melanin concentration") {
 		color Melanin_Sigma = AdjustedMelanin*color(0.419, 0.697, 1.37) + AdjustedMelaninRedness*color(0.187, 0.4, 1.05);
 		float roughness_fac = (((((0.245*AdjustedRoughnessU) + 5.574)*AdjustedRoughnessU - 10.73)*AdjustedRoughnessU + 2.532)*AdjustedRoughnessU - 0.215)*AdjustedRoughnessU + 5.969;
diff --git a/intern/cycles/kernel/svm/svm_closure.h b/intern/cycles/kernel/svm/svm_closure.h
index 83e3302b9eb..e5486c1ab23 100644
--- a/intern/cycles/kernel/svm/svm_closure.h
+++ b/intern/cycles/kernel/svm/svm_closure.h
@@ -779,9 +779,6 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *
 					case NODE_PRINCIPLED_HAIR_DIRECT_ABSORPTION:
 						bsdf->sigma = absorption_coefficient;
 						break;
-					case NODE_PRINCIPLED_HAIR_PHYSICAL:
-						bsdf->sigma = -log3(max(absorption_coefficient, make_float3(1e-5f, 1e-5f, 1e-5f)));
-						break;
 					case NODE_PRINCIPLED_HAIR_PIGMENT_CONCENTRATION: {
 						float3 melanin_sigma = eumelanin*make_float3(0.419f, 0.697f, 1.37f) + pheomelanin*make_float3(0.187f, 0.4f, 1.05f);
 						float roughness_fac = (((((0.245f*param2) + 5.574f)*param2 - 10.73f)*param2 + 2.532f)*param2 - 0.215f)*param2 + 5.969f;
diff --git a/intern/cycles/kernel/svm/svm_types.h b/intern/cycles/kernel/svm/svm_types.h
index 1f2011665e3..e5358d58030 100644
--- a/intern/cycles/kernel/svm/svm_types.h
+++ b/intern/cycles/kernel/svm/svm_types.h
@@ -394,10 +394,9 @@ typedef enum ShaderType {
 } ShaderType;
 
 typedef enum NodePrincipledHairParametrization {
-	NODE_PRINCIPLED_HAIR_DIRECT_ABSORPTION = 0,
-	NODE_PRINCIPLED_HAIR_PHYSICAL = 1,
-	NODE_PRINCIPLED_HAIR_REFLECTANCE = 2,
-	NODE_PRINCIPLED_HAIR_PIGMENT_CONCENTRATION = 3,
+	NODE_PRINCIPLED_HAIR_REFLECTANCE = 0,
+	NODE_PRINCIPLED_HAIR_PIGMENT_CONCENTRATION = 1,
+	NODE_PRINCIPLED_HAIR_DIRECT_ABSORPTION = 2,
 	NODE_PRINCIPLED_HAIR_NUM,
 } NodePrincipledHairParametrization;
 
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp
index bf66e0c4cbd..f4de43e1aee 100644
--- a/intern/cycles/render/nodes.cpp
+++ b/intern/cycles/render/nodes.cpp
@@ -3055,10 +3055,9 @@ NODE_DEFINE(PrincipledHairBsdfNode)
 	SOCKET_IN_FLOAT(surface_mix_weight, "SurfaceMixWeight", 0.0f, SocketType::SVM_INTERNAL);
 
 	static NodeEnum parametrization_enum;
-	parametrization_enum.insert("Absorption coefficient", NODE_PRINCIPLED_HAIR_DIRECT_ABSORPTION);
-	parametrization_enum.insert("physical", NODE_PRINCIPLED_HAIR_PHYSICAL);
 	parametrization_enum.insert("Direct coloring", NODE_PRINCIPLED_HAIR_REFLECTANCE);
 	parametrization_enum.insert("Melanin concentration", NODE_PRINCIPLED_HAIR_PIGMENT_CONCENTRATION);
+	parametrization_enum.insert("Absorption coefficient", NODE_PRINCIPLED_HAIR_DIRECT_ABSORPTION);
 	SOCKET_ENUM(parametrization, "Parametrization", parametrization_enum, NODE_PRINCIPLED_HAIR_REFLECTANCE);
 
 	SOCKET_IN_FLOAT(offset, "Offset", 2.f*M_PI_F/180.f);
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index e72440133ea..6a472ec482d 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -954,10 +954,9 @@ typedef struct NodeSunBeams {
 #define SHD_HAIR_TRANSMISSION		1
 
 /* principled hair parametrization */
-#define SHD_PRINCIPLED_HAIR_DIRECT_ABSORPTION		0
-#define SHD_PRINCIPLED_HAIR_PHYSICAL				1
-#define SHD_PRINCIPLED_HAIR_REFLECTANCE				2
-#define SHD_PRINCIPLED_HAIR_PIGMENT_CONCENTRATION	3
+#define SHD_PRINCIPLED_HAIR_REFLECTANCE				0
+#define SHD_PRINCIPLED_HAIR_PIGMENT_CONCENTRATION	1
+#define SHD_PRINCIPLED_HAIR_DIRECT_ABSORPTION		2
 
 /* blend texture */
 #define SHD_BLEND_LINEAR			0
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 058b483a679..6823f890896 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -3323,10 +3323,9 @@ static const EnumPropertyItem node_hair_items[] = {
 };
 
 static const EnumPropertyItem node_principled_hair_items[] = {
-	{SHD_PRINCIPLED_HAIR_DIRECT_ABSORPTION,     "ABSORPTION", 0, "Absorption coefficient",   "Directly set the absorption coefficient sigma_a. This is not the most intuitive way to color hair."},
-	{SHD_PRINCIPLED_HAIR_PHYSICAL,              "PHYSICAL",   0, "Physical",                 "Like Absorption, but uses a  logarithmic mapping. For debugging purposes."},
 	{SHD_PRINCIPLED_HAIR_REFLECTANCE,           "COLOR",      0, "Direct coloring",          "Choose the color of your preference, and the shader will approximate the absorption coefficient to render lookalike hair."},
 	{SHD_PRINCIPLED_HAIR_PIGMENT_CONCENTRATION, "MELANIN",    0, "Melanin concentration",    "Define the melanin concentrations below to get the most realistic-looking hair. You can get the concentrations for different types of hair online."},
+	{SHD_PRINCIPLED_HAIR_DIRECT_ABSORPTION,     "ABSORPTION", 0, "Absorption coefficient",   "Directly set the absorption coefficient sigma_a. This is not the most intuitive way to color hair."},
 	{0, NULL, 0, NULL, NULL}
 };
 
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.c
index 642e7d4fa4f..cdf6ca27beb 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.c
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.c
@@ -65,7 +65,7 @@ static void node_shader_update_hair_principled(bNodeTree *UNUSED(ntree), bNode *
 	
 	for (sock = node->inputs.first; sock; sock = sock->next) {
 		if (STREQ(sock->name, "Color")) {
-			if (parametrization == SHD_PRINCIPLED_HAIR_REFLECTANCE){
+			if (parametrization == SHD_PRINCIPLED_HAIR_REFLECTANCE) {
 				sock->flag &= ~SOCK_UNAVAIL;
 			}
 			else {
@@ -73,7 +73,7 @@ static void node_shader_update_hair_principled(bNodeTree *UNUSED(ntree), bNode *
 			}
 		}
 		else if (STREQ(sock->name, "Melanin")) {
-			if (parametrization == SHD_PRINCIPLED_HAIR_PIGMENT_CONCENTRATION){
+			if (parametrization == SHD_PRINCIPLED_HAIR_PIGMENT_CONCENTRATION) {
 				sock->flag &= ~SOCK_UNAVAIL;
 			}
 			else {
@@ -81,7 +81,7 @@ static void node_shader_update_hair_principled(bNodeTree *UNUSED(ntree), bNode *
 			}
 		}
 		else if (STREQ(sock->name, "Melanin Redness")) {
-			if (parametrization == SHD_PRINCIPLED_HAIR_PIGMENT_CONCENTRATION){
+			if (parametrization == SHD_PRINCIPLED_HAIR_PIGMENT_CONCENTRATION) {
 				sock->flag &= ~SOCK_UNAVAIL;
 			}
 			else {
@@ -89,7 +89,7 @@ static void node_shader_update_hair_principled(bNodeTree *UNUSED(ntree), bNode *
 			}
 		}
 		else if (STREQ(sock->name, "Tint")) {
-			if (parametrization == SHD_PRINCIPLED_HAIR_PIGMENT_CONCENTRATION){
+			if (parametrization == SHD_PRINCIPLED_HAIR_PIGMENT_CONCENTRATION) {
 				sock->flag &= ~SOCK_UNAVAIL;
 			}
 			else {
@@ -97,7 +97,7 @@ static void node_shader_update_hair_principled(bNodeTree *UNUSED(ntree), bNode *
 			}
 		}
 		else if (STREQ(sock->name, "Absorption Coefficient")) {
-			if ((parametrization == SHD_PRINCIPLED_HAIR_PHYSICAL) || (parametrization == SHD_PRINCIPLED_HAIR_DIRECT_ABSORPTION)){
+			if (parametrization == SHD_PRINCIPLED_HAIR_DIRECT_ABSORPTION) {
 				sock->flag &= ~SOCK_UNAVAIL;
 			}
 			else {
@@ -105,7 +105,7 @@ static void node_shader_update_hair_principled(bNodeTree *UNUSED(ntree), bNode *
 			}
 		}
 		else if (STREQ(sock->name, "Color Randomization")) {
-			if (parametrization == SHD_PRINCIPLED_HAIR_PIGMENT_CONCENTRATION){
+			if (parametrization == SHD_PRINCIPLED_HAIR_PIGMENT_CONCENTRATION) {
 				sock->flag &= ~SOCK_UNAVAIL;
 			}
 			else {



More information about the Bf-blender-cvs mailing list