2.2 Computing Caustics
Snell’s Law is not easy to code with this formulation, because it only imposes one restriction, making the computation of the refracted ray nontrivial. Assuming that the incident, transmitted, and surface normal rays are co-planar, a variety of coder-friendly formulas can be used, such as the one in Foley et al. 1996:
Here T is the transmitted ray, N is the surface normal, E is the incident ray, and , are the indices of refraction.