Skip to content

Commit

Permalink
multiply box intersection normal by invTranspose instead of transform
Browse files Browse the repository at this point in the history
  • Loading branch information
likangning93 committed Sep 23, 2020
1 parent 63ef6d5 commit f4acc04
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/intersections.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ __host__ __device__ float boxIntersectionTest(Geom box, Ray r,
outside = false;
}
intersectionPoint = multiplyMV(box.transform, glm::vec4(getPointOnRay(q, tmin), 1.0f));
normal = glm::normalize(multiplyMV(box.transform, glm::vec4(tmin_n, 0.0f)));
normal = glm::normalize(multiplyMV(box.invTranspose, glm::vec4(tmin_n, 0.0f)));
return glm::length(r.origin - intersectionPoint);
}
return -1;
Expand Down

0 comments on commit f4acc04

Please sign in to comment.