[Bf-blender-cvs] [4de142e0b7b] blender2.8: Eevee : Fix bug with SSS and SSR active node selection

Clément Foucault noreply at git.blender.org
Sat Nov 18 22:15:24 CET 2017


Commit: 4de142e0b7ba014a3e1e41672600aa38465f2454
Author: Clément Foucault
Date:   Sat Nov 18 22:14:53 2017 +0100
Branches: blender2.8
https://developer.blender.org/rB4de142e0b7ba014a3e1e41672600aa38465f2454

Eevee : Fix bug with SSS and SSR active node selection

The bug was affecting the ability to correctly edit the expected SSS profile.

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

M	source/blender/draw/engines/eevee/eevee_materials.c
M	source/blender/nodes/shader/node_shader_tree.c
M	source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c
M	source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.c

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

diff --git a/source/blender/draw/engines/eevee/eevee_materials.c b/source/blender/draw/engines/eevee/eevee_materials.c
index 23057bd91c0..b0e30109a7f 100644
--- a/source/blender/draw/engines/eevee/eevee_materials.c
+++ b/source/blender/draw/engines/eevee/eevee_materials.c
@@ -763,7 +763,7 @@ static struct DRWShadingGroup *EEVEE_default_shading_group_create(
         bool is_hair, bool is_flat_normal, bool use_blend, bool use_ssr, int shadow_method)
 {
 	static int ssr_id;
-	ssr_id = (use_ssr) ? 0 : -1;
+	ssr_id = (use_ssr) ? 1 : -1;
 	int options = VAR_MAT_MESH;
 
 	if (is_hair) options |= VAR_MAT_HAIR;
@@ -791,7 +791,7 @@ static struct DRWShadingGroup *EEVEE_default_shading_group_get(
         bool is_hair, bool is_flat_normal, bool use_ssr, int shadow_method)
 {
 	static int ssr_id;
-	ssr_id = (use_ssr) ? 0 : -1;
+	ssr_id = (use_ssr) ? 1 : -1;
 	int options = VAR_MAT_MESH;
 
 	if (is_hair) options |= VAR_MAT_HAIR;
diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c
index 18229db384f..5bc144e8e07 100644
--- a/source/blender/nodes/shader/node_shader_tree.c
+++ b/source/blender/nodes/shader/node_shader_tree.c
@@ -439,7 +439,7 @@ static void ntree_shader_link_builtin_normal(bNodeTree *ntree,
 static void ntree_shader_relink_displacement(bNodeTree *ntree,
                                              short compatibility)
 {
-	if (compatibility != NODE_NEW_SHADING) {
+	if ((compatibility & NODE_NEW_SHADING) == 0) {
 		/* We can only deal with new shading system here. */
 		return;
 	}
@@ -511,7 +511,7 @@ static bool ntree_tag_ssr_bsdf_cb(bNode *fromnode, bNode *UNUSED(tonode), void *
  */
 static void ntree_shader_tag_ssr_node(bNodeTree *ntree, short compatibility)
 {
-	if (compatibility & NODE_NEWER_SHADING) {
+	if ((compatibility & NODE_NEWER_SHADING) == 0) {
 		/* We can only deal with new shading system here. */
 		return;
 	}
@@ -523,8 +523,8 @@ static void ntree_shader_tag_ssr_node(bNodeTree *ntree, short compatibility)
 	/* Make sure sockets links pointers are correct. */
 	ntreeUpdateTree(G.main, ntree);
 
-	int lobe_count = 0;
-	nodeChainIter(ntree, output_node, ntree_tag_ssr_bsdf_cb, &lobe_count, true);
+	float lobe_id = 1;
+	nodeChainIter(ntree, output_node, ntree_tag_ssr_bsdf_cb, &lobe_id, true);
 }
 
 static bool ntree_tag_sss_bsdf_cb(bNode *fromnode, bNode *UNUSED(tonode), void *userdata, const bool UNUSED(reversed))
@@ -546,7 +546,7 @@ static bool ntree_tag_sss_bsdf_cb(bNode *fromnode, bNode *UNUSED(tonode), void *
  */
 static void ntree_shader_tag_sss_node(bNodeTree *ntree, short compatibility)
 {
-	if (compatibility & NODE_NEWER_SHADING) {
+	if ((compatibility & NODE_NEWER_SHADING) == 0) {
 		/* We can only deal with new shading system here. */
 		return;
 	}
@@ -558,8 +558,8 @@ static void ntree_shader_tag_sss_node(bNodeTree *ntree, short compatibility)
 	/* Make sure sockets links pointers are correct. */
 	ntreeUpdateTree(G.main, ntree);
 
-	int sss_count = 0;
-	nodeChainIter(ntree, output_node, ntree_tag_sss_bsdf_cb, &sss_count, true);
+	float sss_id = 1;
+	nodeChainIter(ntree, output_node, ntree_tag_sss_bsdf_cb, &sss_id, true);
 }
 
 /* EEVEE: Find which material domain are used (volume, surface ...).
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c
index 7ebfc12e143..aa2b3bbfc32 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c
@@ -99,7 +99,7 @@ static int node_shader_gpu_bsdf_principled(GPUMaterial *mat, bNode *node, bNodeE
 	}
 
 	/* SSS Profile */
-	if (node->sss_id == 0) {
+	if (node->sss_id == 1) {
 		static short profile = SHD_SUBSURFACE_BURLEY;
 		bNodeSocket *socket = BLI_findlink(&node->original->inputs, 2);
 		bNodeSocketValueRGBA *socket_data = socket->default_value;
diff --git a/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.c b/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.c
index 7d03eb8805b..116825ff0da 100644
--- a/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.c
+++ b/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.c
@@ -54,7 +54,7 @@ static int node_shader_gpu_subsurface_scattering(GPUMaterial *mat, bNode *node,
 	if (!in[5].link)
 		GPU_link(mat, "world_normals_get", &in[5].link);
 
-	if (node->sss_id == 0) {
+	if (node->sss_id == 1) {
 		bNodeSocket *socket = BLI_findlink(&node->original->inputs, 2);
 		bNodeSocketValueRGBA *socket_data = socket->default_value;
 		bNodeSocket *socket_sharp = BLI_findlink(&node->original->inputs, 3);



More information about the Bf-blender-cvs mailing list