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
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2016-07-29 03:22:01 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2016-07-29 04:29:05 +0300
commite0c7aaf5adff1920b94dfd37dd1d5ab0ccc8c43a (patch)
tree2f1bf754728b430ee1dd0a07aec855b43a5b8a54
parent52fb441c13771b21d3ab1b50fcadfe257346f264 (diff)
Fix Cycles OSL hair BSDF inconsistencies with SVM.
-rw-r--r--intern/cycles/kernel/shaders/node_hair_bsdf.osl45
-rwxr-xr-xtests/python/cycles_render_tests.py2
2 files changed, 25 insertions, 22 deletions
diff --git a/intern/cycles/kernel/shaders/node_hair_bsdf.osl b/intern/cycles/kernel/shaders/node_hair_bsdf.osl
index c8cb88f0c0b..ef8f2fae894 100644
--- a/intern/cycles/kernel/shaders/node_hair_bsdf.osl
+++ b/intern/cycles/kernel/shaders/node_hair_bsdf.osl
@@ -24,34 +24,35 @@ shader node_hair_bsdf(
float Offset = 0.0,
float RoughnessU = 0.1,
float RoughnessV = 1.0,
- normal Normal = Ng,
+ normal Tangent = normal(0, 0, 0),
output closure color BSDF = 0)
{
- float IsStrand;
float roughnessh = clamp(RoughnessU, 0.001, 1.0);
float roughnessv = clamp(RoughnessV, 0.001, 1.0);
- getattribute("geom:is_curve", IsStrand);
+ float offset = -Offset;
- if (!IsStrand) {
- if (backfacing()) {
- BSDF = transparent();
- }
- else {
- if (component == "reflection")
- BSDF = Color * hair_reflection(Normal, roughnessh, roughnessv, normalize(dPdv), 0.0);
- else
- BSDF = Color * hair_transmission(Normal, roughnessh, roughnessv, normalize(dPdv), 0.0);
- }
+ normal T;
+ float IsCurve = 0;
+ getattribute("geom:is_curve", IsCurve);
+
+ if (isconnected(Tangent)) {
+ T = Tangent;
+ }
+ else if(!IsCurve) {
+ T = normalize(dPdv);
+ offset = 0.0;
+ }
+ else {
+ T = normalize(dPdu);
+ }
+
+ if (backfacing() && IsCurve) {
+ BSDF = transparent();
}
else {
- if (backfacing()) {
- BSDF = transparent();
- }
- else {
- if (component == "reflection")
- BSDF = Color * hair_reflection(Normal, roughnessh, roughnessv, dPdu, -Offset);
- else
- BSDF = Color * hair_transmission(Normal, roughnessh, roughnessv, dPdu, -Offset);
- }
+ if (component == "reflection")
+ BSDF = Color * hair_reflection(Ng, roughnessh, roughnessv, T, offset);
+ else
+ BSDF = Color * hair_transmission(Ng, roughnessh, roughnessv, T, offset);
}
}
diff --git a/tests/python/cycles_render_tests.py b/tests/python/cycles_render_tests.py
index 1434447416d..fb9a4b348b7 100755
--- a/tests/python/cycles_render_tests.py
+++ b/tests/python/cycles_render_tests.py
@@ -17,6 +17,8 @@ def render_file(filepath):
"--factory-startup",
filepath,
"-E", "CYCLES",
+ # Run with OSL enabled
+ # "--python-expr", "import bpy; bpy.context.scene.cycles.shading_system = True",
"-o", TEMP_FILE_MASK,
"-F", "PNG",
"-f", "1",