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:
authorSergey Sharybin <sergey.vfx@gmail.com>2014-12-15 19:18:01 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2014-12-25 00:50:49 +0300
commitf770bc4757a2b471d5aaee048359096c1c79a6b2 (patch)
tree853a0b93183aa814b4ec5a45f8050b47aa9c779d /intern/cycles/util
parent57d235d9f496fd71f5b57cef36d34fae5bf9d9ce (diff)
Cycles: Implement watertight ray/triangle intersection
Using this paper: Sven Woop, Watertight Ray/Triangle Intersection http://jcgt.org/published/0002/01/05/paper.pdf This change is expected to address quite reasonable amount of reports from the bug tracker, plus it might help reducing the noise in some scenes. Unfortunately, it's currently about 7% slower than the previous solution with pre-computed triangle plane equations, but maybe with some smart tweaks to the code (tests reshuffle, using SIMD in a nice way or so) we can avoid the speed regression. But perhaps smartest thing to do here would be to change single triangle / ray intersection with multiple triangles / ray intersections. That's how Embree does this and it's watertight single ray intersection is not any faster that this. Currently only triangle intersection is modified accordingly to the paper, in the future we would also want to modify the node / ray intersection. Reviewers: brecht, juicyfruit Subscribers: dingto, ton Differential Revision: https://developer.blender.org/D819
Diffstat (limited to 'intern/cycles/util')
-rw-r--r--intern/cycles/util/util_math.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/intern/cycles/util/util_math.h b/intern/cycles/util/util_math.h
index 78005546a01..6898dc974c6 100644
--- a/intern/cycles/util/util_math.h
+++ b/intern/cycles/util/util_math.h
@@ -1452,6 +1452,22 @@ ccl_device bool map_to_sphere(float *r_u, float *r_v,
}
}
+ccl_device_inline int util_max_axis(float3 vec)
+{
+ if(vec.x > vec.y) {
+ if(vec.x > vec.z)
+ return 0;
+ else
+ return 2;
+ }
+ else {
+ if(vec.y > vec.z)
+ return 1;
+ else
+ return 2;
+ }
+}
+
CCL_NAMESPACE_END
#endif /* __UTIL_MATH_H__ */