diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-05-29 13:27:34 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-05-30 13:25:20 +0300 |
commit | 0488b728ebec61b50351d850d8fd52bfe67a40f0 (patch) | |
tree | 2f7e0e48cd4712837ae424f7f720297313ec4242 /source | |
parent | 10f6450ef24ca1e99b3454c76117d877f35541fe (diff) |
Eevee: Add support for the Hair info node.
Only the random output is not supported for the moment.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_material.glsl | 17 | ||||
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_hair_info.c | 6 |
2 files changed, 23 insertions, 0 deletions
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); } |