[Bf-blender-cvs] [9946cca] master: Fix T48860: Cycles SSS artifacts with spatially split BVH

Sergey Sharybin noreply at git.blender.org
Mon Jul 18 10:46:44 CEST 2016


Commit: 9946cca14676bf07b3c7c103e99033fe1e4e423e
Author: Sergey Sharybin
Date:   Fri Jul 15 14:55:37 2016 +0200
Branches: master
https://developer.blender.org/rB9946cca14676bf07b3c7c103e99033fe1e4e423e

Fix T48860: Cycles SSS artifacts with spatially split BVH

The issue was caused by SSS intersection code gathering all
intersections without check for duplicated ones. This caused
situations when same intersection will be recorded twice in
the case if triangle is shared by several BVH nodes.

Usually this is handled by checking intersection distance
after sorting intersections (in shadow_blocked for example)
but for SSS we don't do such sorting and using number of
intersections to calculate various things.

Didn't find anything smarter than to check intersection
distance in triangle_intersect_subsurface().

This solves render artifacts in the cost of 1.5% slowdown
of extreme case rendering (SSS object filling in whole
FullHD screen).

Reviewers: brecht

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2105

===================================================================

M	intern/cycles/kernel/geom/geom_triangle_intersect.h

===================================================================

diff --git a/intern/cycles/kernel/geom/geom_triangle_intersect.h b/intern/cycles/kernel/geom/geom_triangle_intersect.h
index fc081bd..720ee6a 100644
--- a/intern/cycles/kernel/geom/geom_triangle_intersect.h
+++ b/intern/cycles/kernel/geom/geom_triangle_intersect.h
@@ -255,6 +255,13 @@ ccl_device_inline void triangle_intersect_subsurface(
 	/* Normalize U, V, W, and T. */
 	const float inv_det = 1.0f / det;
 
+	const float t = T * inv_det;
+	for(int i = min(max_hits, ss_isect->num_hits); i >= 0; --i) {
+		if(ss_isect->hits[i].t == t) {
+			return;
+		}
+	}
+
 	ss_isect->num_hits++;
 	int hit;
 
@@ -277,7 +284,7 @@ ccl_device_inline void triangle_intersect_subsurface(
 	isect->type = PRIMITIVE_TRIANGLE;
 	isect->u = U * inv_det;
 	isect->v = V * inv_det;
-	isect->t = T * inv_det;
+	isect->t = t;
 
 	/* Record geometric normal. */
 	/* TODO(sergey): Use float4_to_float3() on just an edges. */




More information about the Bf-blender-cvs mailing list