Skip to content

Commit

Permalink
stop rays at camera after reflection
Browse files Browse the repository at this point in the history
  • Loading branch information
gridley committed Dec 20, 2023
1 parent 974d36b commit 4adabf0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/plot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1713,6 +1713,14 @@ void PhongRay::on_intersection()
? material()
: lowest_coord().cell;

// If we are reflected and have advanced beyond the camera,
// the ray is done. This is checked here because we should
// kill the ray even if the material is not opaque.
if (reflected_ && (r() - plot_.camera_position()).dot(u()) >= 0.0) {
stop();
return;
}

// Anything that's not opaque has zero impact on the plot.
if (!plot_.is_id_opaque(hit_id))
return;
Expand Down

0 comments on commit 4adabf0

Please sign in to comment.