solstice-solver

Solver library of the solstice app
git clone git://git.meso-star.com/solstice-solver.git
Log | Files | Refs | README | LICENSE

commit 3f14c6cb263b01f443bfdc4d6513272938f06fbb
parent 22c8ecf61b7b500078ba43795ae455435fbc920f
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Fri, 27 Jan 2017 13:52:27 +0100

Fix self hit on punched surfaces

Diffstat:
Msrc/ssol_scene.c | 10+++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/ssol_scene.c b/src/ssol_scene.c @@ -407,9 +407,13 @@ hit_filter_function if(dst >= FLT_MAX) { /* No projection is found => the ray does not intersect the quadric */ return 1; - } else { - hit_side = d3_dot(dir, N) < 0 ? SSOL_FRONT : SSOL_BACK; - if(inst == rdata->inst_from) { + } else if(inst == rdata->inst_from) { + + if(hit->distance <= rdata->range_min) { + /* Handle RT numerical imprecision, the hit is below the lower bound + * of the ray range. */ + return 1; + } else { /* If the intersected instance is the one from which the ray starts, * ensure that the ray does not intersect the opposite side of the * quadric */