Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix paths that don't have light contributions #16

Merged
merged 2 commits into from
Aug 9, 2020

Conversation

GoncaloFDS
Copy link
Contributor

The problem:
Paths that do not hit a light are giving a contribution and they shouldn't. e.g If a path it's a wall and terminates if contribution should be zero however with the current code we get that the contribution of that path is the color of the material.
RayTracer_ZpYY4fa9xa
RayTracer_jEFUi50fXy

Solution:
if the path exceeds the max path length and it didn't get a contribution from a light, that path contribution is zero.

Path length 1:
RayTracer_s8TXwAYCM6
Path length 2:
RayTracer_d63hwaYv3A
Path length 3:
RayTracer_rDM4t4tPIe

And some samples gathered from the Ray Tracing: The Rest of Your Life
Path length 1:
1bounce
Path length 2:
2bounces
Path length 3:
3bounces

@GPSnoopy
Copy link
Owner

GPSnoopy commented Aug 9, 2020

Well spotted. I did read the code of the CPU implementations, and you're absolutely right.

Although it only works because the light emitting materials in "RayTracing in one weekend" never scatter rays when hit by them (effectively becoming an implicit stop condition). I've added a comment to that effect.

@GPSnoopy GPSnoopy merged commit 95ea915 into GPSnoopy:master Aug 9, 2020
@GoncaloFDS GoncaloFDS deleted the zero-light-contributions branch August 9, 2020 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants