Don't acknowledge intersections closer than t=1e-2.
This avoids intersections with the shape itself.
This commit is contained in:
parent
6c1e8c7ffb
commit
daeb052003
1 changed files with 3 additions and 0 deletions
|
@ -200,6 +200,9 @@ Scene::trace_ray(const Ray &ray,
|
||||||
nints = s->does_intersect(ray, &t);
|
nints = s->does_intersect(ray, &t);
|
||||||
if (nints > 0) {
|
if (nints > 0) {
|
||||||
for (int i = 0; i < nints; i++) {
|
for (int i = 0; i < nints; i++) {
|
||||||
|
if (t[i] < 1e-2) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (t[i] < nearest_t) {
|
if (t[i] < nearest_t) {
|
||||||
intersected_shape = s;
|
intersected_shape = s;
|
||||||
nearest_t = t[i];
|
nearest_t = t[i];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue