From 7377d411b47d50cd943cd33e3e55c0409bb79f91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dietrich?= Date: Thu, 1 Mar 2018 11:54:01 +0100 Subject: Cycles volume: fast empty space optimization by generating a tight mesh around the volume. We generate a tight mesh around the active voxels of the volume in order to effectively skip empty space, and start volume ray marching as close to interesting volume data as possible. See code comments for details on how the mesh generation algorithm works. This gives up to 2x speedups in some scenes. Reviewed by: brecht, dingto Reviewers: #cycles Subscribers: lvxejay, jtheninja, brecht Differential Revision: https://developer.blender.org/D3038 --- intern/cycles/util/util_math_int3.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'intern/cycles/util') diff --git a/intern/cycles/util/util_math_int3.h b/intern/cycles/util/util_math_int3.h index fa7a02636de..1bc6ca7f376 100644 --- a/intern/cycles/util/util_math_int3.h +++ b/intern/cycles/util/util_math_int3.h @@ -78,6 +78,22 @@ ccl_device_inline int3 clamp(const int3& a, int3& mn, int mx) } #endif /* !__KERNEL_OPENCL__ */ + +ccl_device_inline bool operator==(const int3 &a, const int3 &b) +{ + return a.x == b.x && a.y == b.y && a.z == b.z; +} + +ccl_device_inline bool operator!=(const int3 &a, const int3 &b) +{ + return !(a == b); +} + +ccl_device_inline bool operator<(const int3 &a, const int3 &b) +{ + return a.x < b.x && a.y < b.y && a.z < b.z; +} + CCL_NAMESPACE_END #endif /* __UTIL_MATH_INT3_H__ */ -- cgit v1.2.3