diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-01-09 20:57:26 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-01-09 20:57:26 +0400 |
commit | 8f37c143ed0b23257e6da453351f198a35f5677e (patch) | |
tree | cf7b8cd298d85d92d85c08e02f8129ffe12e64ba /intern/cycles/kernel/svm | |
parent | 7eb3b37bec3f350773331db749d387d69bf3d518 (diff) |
Cycles: small tweak to checker texture, scale rather than add with epsilon,
looks a bit better on all sides of a mesh.
Diffstat (limited to 'intern/cycles/kernel/svm')
-rw-r--r-- | intern/cycles/kernel/svm/svm_checker.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/intern/cycles/kernel/svm/svm_checker.h b/intern/cycles/kernel/svm/svm_checker.h index 8dda5e3052b..bee0cc57689 100644 --- a/intern/cycles/kernel/svm/svm_checker.h +++ b/intern/cycles/kernel/svm/svm_checker.h @@ -24,11 +24,15 @@ __device_noinline float svm_checker(float3 p, float scale) { p *= scale; - /* 0.00001 because of unit sized stuff */ - int xi = (int)fabsf(floor(0.00001f + p.x)); - int yi = (int)fabsf(floor(0.00001f + p.y)); - int zi = (int)fabsf(floor(0.00001f + p.z)); - + /* avoid precision issues on unit coordinates */ + p.x = (p.x + 0.00001f)*0.9999f; + p.y = (p.y + 0.00001f)*0.9999f; + p.z = (p.z + 0.00001f)*0.9999f; + + int xi = (int)fabsf(floorf(p.x)); + int yi = (int)fabsf(floorf(p.y)); + int zi = (int)fabsf(floorf(p.z)); + return ((xi % 2 == yi % 2) == (zi % 2))? 1.0f: 0.0f; } |