Refraction Simulator

September 2014 | By Daniel Johnson


Displays the path that light would take when it refracts through variously-shaped objects, color-coded based on the initial angle of emission. In order to do this, it casts a series of rays and uses Snell’s law to determine how they refract off of objects. It then iteratively casts more rays between rays that get too far apart or act differently (if one ray hits something and the other hits something else, for instance) to get higher accuracy. The computations are performed in Javascript, and then the result is drawn using WebGL. Read more about the implementation here:

Built with: