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>2015-03-12 15:51:01 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-03-17 13:49:08 +0300
commit86b862ecc90783750aec59e474cfa6973acbafef (patch)
tree7b3f4295c5f387ea1819ea9a4269e131a8e2816f
parent651689fc62809e3bf8c57ba9fb138456acecd96d (diff)
Revert "Fix T43865: Cycles: Watertight rendering produces artifacts on a huge plane"
The fix was really flacky, in terms during speed benchmarks i had abort() in the fallback block to be sure it never runs in production scenes, but that affected on the optimization as well. Without this abort there's quite bad slowdown of 5-7% on the renders even tho the Pleucker fallback was never run. This is all weird and for now reverting the change which affects on all the production scenes and will look into alternative fixes for the original issue with precision loss on huge planes. This reverts commit 9489205c5c0b9b432d02be4a3d0d15fc62ee6cb9.
-rw-r--r--intern/cycles/kernel/geom/geom_triangle_intersect.h40
1 files changed, 5 insertions, 35 deletions
diff --git a/intern/cycles/kernel/geom/geom_triangle_intersect.h b/intern/cycles/kernel/geom/geom_triangle_intersect.h
index 06917dc16d8..c9e30a451da 100644
--- a/intern/cycles/kernel/geom/geom_triangle_intersect.h
+++ b/intern/cycles/kernel/geom/geom_triangle_intersect.h
@@ -154,15 +154,10 @@ ccl_device_inline bool triangle_intersect(KernelGlobals *kg,
* the hit distance.
*/
const float T = (U * A_kz + V * B_kz + W * C_kz) * Sz;
-
- /* Perform "near clipping". */
- const float abs_T = xor_signmast(T, sign_mask);
- if(abs_T < 0.0f) {
- return false;
- }
- /* Perform "far clipping". */
- const float abs_det = xor_signmast(det, sign_mask);
- if(abs_T > isect->t * abs_det) {
+ const float sign_T = xor_signmast(T, sign_mask);
+ if ((sign_T < 0.0f) ||
+ (sign_T > isect->t * xor_signmast(det, sign_mask)))
+ {
return false;
}
@@ -174,37 +169,12 @@ ccl_device_inline bool triangle_intersect(KernelGlobals *kg,
{
/* Normalize U, V, W, and T. */
const float inv_det = 1.0f / det;
- const float t = T * inv_det;
-
-#ifdef __INTERSECTION_REFINE__
- /* TODO(sergey): When intersection refine is enabled ray is being
- * pushed by quite small epsilon from the surface, which causes
- * numerical issues of watertight Woop intersection check with
- * huge triangles.
- *
- * Here we're working this around by checking distance in Pleucker
- * coordinates if intersection is suspiciously close to the point
- * in order to eliminate self-shadowing.
- *
- * Ideally we need to solve this in Woop intersection code but
- * it's quite tricky.
- */
- if(UNLIKELY(abs_det > 100000.0f && t < 1e-3f)) {
- const float3 Ng = cross(A - B, C - A);
- const float pleucker_den = dot(Ng, dir);
- const float pleucker_T = dot(A, Ng);
- if(UNLIKELY(pleucker_T * pleucker_den < 0.0f)) {
- return false;
- }
- }
-#endif
-
isect->prim = triAddr;
isect->object = object;
isect->type = PRIMITIVE_TRIANGLE;
isect->u = U * inv_det;
isect->v = V * inv_det;
- isect->t = t;
+ isect->t = T * inv_det;
return true;
}
return false;