commit 5ce3cf61ba1c35e1585a913d8d494b307718b842
parent b23d7ee059c67c42e4f9ce269dfbcc1481ecaaf4
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date: Thu, 21 Jan 2021 10:33:49 +0100
Manage an Embree bug (barycentric coordinate out of range)
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/s2d_scene_view.c b/src/s2d_scene_view.c
@@ -166,8 +166,8 @@ hit_setup
hit->prim.scene_prim_id = hit->prim.prim_id + geom->scene_prim_id_offset;
/* The Embree "v" parametric coordinate of the extruded quad corresponds to
- * the edge parametric coordinate */
- hit->u = ray_hit->hit.v;
+ * the edge parametric coordinate (handle Embree returning v out of range) */
+ hit->u = CLAMP(ray_hit->hit.v, 0, 1);
if(geom->flip_contour) {
f2_minus(hit->normal, hit->normal);