diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-03-29 16:03:50 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-03-29 16:03:50 +0400 |
commit | 3847d0c0df53d9a5a90e039404ecf6e5fa153877 (patch) | |
tree | f4d6ba0af5b9adcc62e746be1fcd65d0f0e5f66b /intern/cycles/util/util_math.h | |
parent | 47e7acf2313694460297ddfdac1d2a4a851b75ed (diff) |
Cycles code internals: add initial implementation of decoupled ray marching.
This basically records all volumes steps, which can then later be used multiple
time to take scattering samples, without having to step through the volume
again. From the paper:
"Importance Sampling Techniques for Path Tracing in Participating Media"
This works only on the CPU, due to usage of malloc/free.
Diffstat (limited to 'intern/cycles/util/util_math.h')
-rw-r--r-- | intern/cycles/util/util_math.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/intern/cycles/util/util_math.h b/intern/cycles/util/util_math.h index bb73aa1bbfe..b57aa26dbc4 100644 --- a/intern/cycles/util/util_math.h +++ b/intern/cycles/util/util_math.h @@ -1122,6 +1122,17 @@ ccl_device_inline void make_orthonormals(const float3 N, float3 *a, float3 *b) /* Color division */ +ccl_device_inline float3 safe_invert_color(float3 a) +{ + float x, y, z; + + x = (a.x != 0.0f)? 1.0f/a.x: 0.0f; + y = (a.y != 0.0f)? 1.0f/a.y: 0.0f; + z = (a.z != 0.0f)? 1.0f/a.z: 0.0f; + + return make_float3(x, y, z); +} + ccl_device_inline float3 safe_divide_color(float3 a, float3 b) { float x, y, z; |