Skip to content

Commit 4adabf0

Browse files
committed
stop rays at camera after reflection
1 parent 974d36b commit 4adabf0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Diff for: src/plot.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -1713,6 +1713,14 @@ void PhongRay::on_intersection()
17131713
? material()
17141714
: lowest_coord().cell;
17151715

1716+
// If we are reflected and have advanced beyond the camera,
1717+
// the ray is done. This is checked here because we should
1718+
// kill the ray even if the material is not opaque.
1719+
if (reflected_ && (r() - plot_.camera_position()).dot(u()) >= 0.0) {
1720+
stop();
1721+
return;
1722+
}
1723+
17161724
// Anything that's not opaque has zero impact on the plot.
17171725
if (!plot_.is_id_opaque(hit_id))
17181726
return;

0 commit comments

Comments
 (0)