Raytracer help - Background color writing over some colors? I'm implementing Peter Shirley's &quot;Raytracer in a Weekend: The next week&quot; and I'm having some trouble with rendering a scene with a light. I'm not sure if the issue is the background color or the light itself but the raytracer seems to be working fine in any scenes that have no lights.
The image rendered is supposed to be:

but it actually turns out as:

When I try to troubleshoot and change the background color to blue the image is:

Hopefully someone who has implemented this raytracer before or who has intuition about raytracing has an idea why this might be happening??
In Lambertion::scatter there is a comment about attenuating light based on distance.
For a raytracer this is not required as the distribution of rays themselves cause attenuation over distance.