refraction

 

Each object can specify their Index of Refraction as well as their colour. You can see that the lens on the left has a purple tinge from it’s original colour.

The assumption made by the ray tracer is that everything exists in air with an index of refraction of 1.0

As a side note, this was perhaps the most difficult objective to implement as the breadth from basic implementation to photo realistic implementations seemed large.

The Basics


Refraction is the change in direction of a wave (light ray) due to it’s change in speed. The change in speed is caused when entering objects with a different index of refraction (i.e. air = 1.0). The basic implementation of refraction is straightforward and consists of implementing Snell’s law to calculate the refracted angle upon entering and exiting an object.


Things that this ray tracer does not account for however is light attenuation within the object.