Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2015-10-11 17:43:30 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-10-11 17:43:30 +0300
commit3f4c0612fedf9d135d72c428e2433c890edb0412 (patch)
tree867750baf18ab8e70b38942c4de0ed7a1f17ec51 /intern
parent34e7285b0a62e0a4daa74caecbaea2932b13c05b (diff)
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
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/kernel/svm/svm_closure.h5
-rw-r--r--intern/cycles/render/nodes.cpp1
2 files changed, 5 insertions, 1 deletions
diff --git a/intern/cycles/kernel/svm/svm_closure.h b/intern/cycles/kernel/svm/svm_closure.h
index c495ebb35bd..2120c892490 100644
--- a/intern/cycles/kernel/svm/svm_closure.h
+++ b/intern/cycles/kernel/svm/svm_closure.h
@@ -411,7 +411,10 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *
sc->data1 = param2;
sc->data2 = -stack_load_float(stack, data_node.z);
- if(!(ccl_fetch(sd, type) & PRIMITIVE_ALL_CURVE)) {
+ if(stack_valid(data_node.y)) {
+ sc->T = normalize(stack_load_float3(stack, data_node.y));
+ }
+ else if(!(ccl_fetch(sd, type) & PRIMITIVE_ALL_CURVE)) {
sc->T = normalize(ccl_fetch(sd, dPdv));
sc->data2 = 0.0f;
}
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp
index bb76383c5cf..7ac872b8416 100644
--- a/intern/cycles/render/nodes.cpp
+++ b/intern/cycles/render/nodes.cpp
@@ -2358,6 +2358,7 @@ HairBsdfNode::HairBsdfNode()
add_input("Offset", SHADER_SOCKET_FLOAT);
add_input("RoughnessU", SHADER_SOCKET_FLOAT);
add_input("RoughnessV", SHADER_SOCKET_FLOAT);
+ add_input("Tangent", SHADER_SOCKET_VECTOR);
}
void HairBsdfNode::compile(SVMCompiler& compiler)