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:
Diffstat (limited to 'intern/cycles/kernel/shaders/node_math.h')
-rw-r--r--intern/cycles/kernel/shaders/node_math.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/intern/cycles/kernel/shaders/node_math.h b/intern/cycles/kernel/shaders/node_math.h
index 3a008721d5e..2da73b94212 100644
--- a/intern/cycles/kernel/shaders/node_math.h
+++ b/intern/cycles/kernel/shaders/node_math.h
@@ -88,6 +88,13 @@ point wrap(point value, point max, point min)
wrap(value[2], max[2], min[2]));
}
+/* Built in OSL faceforward is `(dot(I, Nref) > 0) ? -N : N;` which is different to
+ * GLSL `dot(Nref, I) < 0 ? N : -N` for zero values. */
+point compatible_faceforward(point vec, point incident, point reference)
+{
+ return dot(reference, incident) < 0.0 ? vec : -vec;
+}
+
matrix euler_to_mat(point euler)
{
float cx = cos(euler[0]);