[Bf-blender-cvs] [0488b728ebe] blender2.8: Eevee: Add support for the Hair info node.

Clément Foucault noreply at git.blender.org
Wed May 30 12:25:38 CEST 2018


Commit: 0488b728ebec61b50351d850d8fd52bfe67a40f0
Author: Clément Foucault
Date:   Tue May 29 12:27:34 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB0488b728ebec61b50351d850d8fd52bfe67a40f0

Eevee: Add support for the Hair info node.

Only the random output is not supported for the moment.

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

M	source/blender/gpu/shaders/gpu_shader_material.glsl
M	source/blender/nodes/shader/nodes/node_shader_hair_info.c

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

diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl
index d84ffe99a6b..795320df6b7 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -2479,6 +2479,23 @@ void node_bevel(float radius, vec3 N, out vec3 result)
 	result = N;
 }
 
+void node_hair_info(out float is_strand, out float intercept, out float thickness, out vec3 tangent, out float random)
+{
+#ifdef HAIR_SHADER
+	is_strand = 1.0;
+	intercept = hairTime;
+	thickness = hairThickness;
+	tangent = normalize(worldNormal); /* TODO fix naming */
+	random = 0.0;
+#else
+	is_strand = 0.0;
+	intercept = 0.0;
+	thickness = 0.0;
+	tangent = vec3(1.0);
+	random = 0.0;
+#endif
+}
+
 void node_displacement_object(float height, float midlevel, float scale, vec3 N, mat4 obmat, out vec3 result)
 {
 	N = (vec4(N, 0.0) * obmat).xyz;
diff --git a/source/blender/nodes/shader/nodes/node_shader_hair_info.c b/source/blender/nodes/shader/nodes/node_shader_hair_info.c
index 6a15c59aa5b..13259dce9d1 100644
--- a/source/blender/nodes/shader/nodes/node_shader_hair_info.c
+++ b/source/blender/nodes/shader/nodes/node_shader_hair_info.c
@@ -37,6 +37,11 @@ static bNodeSocketTemplate outputs[] = {
 	{	-1, 0, ""	}
 };
 
+static int node_shader_gpu_hair_info(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
+{
+	return GPU_stack_link(mat, node, "node_hair_info", in, out);
+}
+
 /* node type definition */
 void register_node_type_sh_hair_info(void)
 {
@@ -47,6 +52,7 @@ void register_node_type_sh_hair_info(void)
 	node_type_socket_templates(&ntype, NULL, outputs);
 	node_type_init(&ntype, NULL);
 	node_type_storage(&ntype, "", NULL, NULL);
+	node_type_gpu(&ntype, node_shader_gpu_hair_info);
 
 	nodeRegisterType(&ntype);
 }



More information about the Bf-blender-cvs mailing list