Tenth Task
Explain Given Code (again)
For this task we were given this example, that creates a ray traced scene, we have to modify it.
The final code is on Github and you may play with it on Codepen.
The Ray Tracing algorithm is simple to undestand, but hard to implement and heavy on the resources needed. Simply put, it "shoots" rays from the viewpoint to calculate the resulting color to show for each pixel. This is opposite of how the real world works, where a light source sends lightrays that bounce until they hit your eyes.
![]()
This explanation falls short, there are a lot of things to keep in mind. For instance, several rays are sent from each pixel to average the final color, and the depth of recursiveness of bouncing of each ray impact the performance.
The program is simple enough, but hard to read, due to the complexity of the task. [Here's the original source]