**Refraction:**

Added the refraction.

I calculated the refraction using the snell's law. Snell's law is the formula that describes the relationship between angle of incidence and refraction, when a ray of light passes from one material to another. The actual science behind it is explained in below image:

Better image, without noise:

**Reflection:**

I also added Reflection today.

The ray is reflected from the reflective surface at an angle equal to the angle between the incident ray and the normal to the surface. The reflected direction can be calculated using the formula:

*Reflected direction*= incident - 2.0 * dot(normal, incident) * normal ;

**Fresnel:**When

**ray intersects**

**with materials with different transmission coefficient, it either refracts or reflects from the surface. I used russian roullete technique to determine whether the ray should reflect or refract based on the fresnel transmission coefficient.**

Fresnel equation is solved using the wikipedia link.