# Total internal reflection

This topic is 3380 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, I am trying to write a raytracer with refraction/reflection, but I don't understand the problem of total internal reflection (refraction?). When does it occur? And how should I treat it? Thanks, Icebraker

##### Share on other sites
I'm not really sure if total internal reflection is different from what i know as total reflection, so the following may be wrong.

From Snell's law you have:

sin(theta_i) / sin(theta_t) = n2 / n1 = n12

where theta_i is the angle of incidence, theta_t is the angle of the transmitted ray, n1 is the real refractive index of the first material and n2 the real refractive index of the second material.

When n2 > n1, then n12 > 1 and the above equation gives:

sin(theta_t) = sin(theta_i) / n12

and there is always a real angle theta_t of refraction for every angle of incidence.

On the other hand, if n12 < 1, there is a real value for theta_t only for those incident angles theta_i for which sin(theta_i) <= n12. For larger values of the angle of incidence, total reflection takes place. In other words, no light enters the second medium and all the incident light is reflected back to the first medium.

I think, the easiest way to handle this is to remove the refraction part in these cases and calculate only the reflection.

Hope that helps.

HellRaiZer

##### Share on other sites
Here's a raytracer tutorial with source code in C++ that goes over Snell Descartes as well as Fresnel for refraction reflection :

Raytracer with snell-descartes and fresnel law detailed.

LeGreg

##### Share on other sites
Give a look to this paper:
Reflections and refractions in raytracing

Shortly, there are some circumstances where when light hits a transmissive surface it is reflected instead than refracted. When this happens inside an object (i.e. the light is trying to leave the object) then Total Internal Reflection (TIR) happens: the light is reflected inside the object again. Until the light hit a transparent surface with an incident angle smaller than the critical angle, the light will not be able to leave the object. This is what happens inside optical fibers, for example.