Skip to content

Instantly share code, notes, and snippets.

@omaraflak
Last active July 25, 2020 08:15
Show Gist options
  • Save omaraflak/4c7bc10beeb8652ec6ad7fff755df80a to your computer and use it in GitHub Desktop.
Save omaraflak/4c7bc10beeb8652ec6ad7fff755df80a to your computer and use it in GitHub Desktop.
# ...
intersection = origin + min_distance * direction
intersection_to_light = normalize(light['position'] - intersection)
_, min_distance = nearest_intersected_object(objects, intersection, intersection_to_light)
intersection_to_light_distance = np.linalg.norm(light['position'] - intersection)
is_shadowed = min_distance < intersection_to_light_distance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment