Close

Ray Tracing

With JavaScript

This was a fun creative coding project in JavaScript, using the p5.js library. I was inspired by a video on the YouTube channel "The Coding Train" on the same topic, and felt like taking on the challenge myself.

The objective of the project was to simulate a light source in a closed environment by 'casting rays' from a point source and drawing their intersection with the environment. This is a technique often used in rendering algorithms, where individual rays of light from a light source are traced out to determine the appearance of a rendered object. In this case, I'm just casting out rays in a plane, and instead of using the output in rendering, I'm just displaying it in this neat visualization! Move your mouse around the black square to see it in action (and reload the page if you want to generate new 'walls').