From 3f4c0612fedf9d135d72c428e2433c890edb0412 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Sun, 11 Oct 2015 19:43:30 +0500 Subject: Fix T45058: Cycles hair shader reflects incorrectly for meshes The issue was caused by non-continuous tangent space calculated for triangles. This commit adds a Tangent input to Hair BSDF node which can be used to hook up Tangent calculated form UV as an input to the node in order to make sure the tangent space is continuous. Doing this as an input instead of using default tangent layer from UV because of several reasons: - This way it's really easy to preserve compatibility with existing setups. - Default UV map is not necessarily giving continuous space, one might want to use other tangent space sources or distort the space for some artistic decision. Reviewers: juicyfruit, dingto Reviewed By: dingto Differential Revision: https://developer.blender.org/D1428 --- source/blender/nodes/shader/nodes/node_shader_bsdf_hair.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source/blender/nodes/shader/nodes/node_shader_bsdf_hair.c') diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_hair.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_hair.c index dbc8807a845..25be59f091d 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_hair.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_hair.c @@ -33,7 +33,9 @@ static bNodeSocketTemplate sh_node_bsdf_hair_in[] = { { SOCK_RGBA, 1, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, { SOCK_FLOAT, 1, N_("Offset"), 0.0f, 0.0f, 0.0f, 0.0f, -M_PI_2, M_PI_2, PROP_ANGLE}, { SOCK_FLOAT, 1, N_("RoughnessU"), 0.1f, 0.1f, 0.1f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - { SOCK_FLOAT, 1, N_("RoughnessV"), 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { -1, 0, "" } + { SOCK_FLOAT, 1, N_("RoughnessV"), 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, + { SOCK_VECTOR, 1, N_("Tangent"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_bsdf_hair_out[] = { -- cgit v1.2.3