# Reflection

Reflection is the phenomena when the wave front changes direction at an interface between two different media, in the way that the wave front returns into the medium from which it originated. In some aspects the surface of the water acts like a perfect mirror. Electromagnetic waves of light are reflected on the surface. The physical law for this: the angle of reflection equals the angle of incidence, and we measure these angles to the normal-vector of the surface, namely the two angles α and β are equal:

Taking into consideration only the reflection behavior of the water it is easy to calculate the color of the pixels on the water surface. Mirroring the position of the camera to the plane of the surface gives the exact location of the virtual view: just determine which color has the object which is visible through every pixel of the water from the virtual view. This idea is shown on the next figure:

If the camera is in point A, the perceived color on the water surface will be the color of the object visible from point B through the same intersection point. Point B is exactly the same far from the plane of the water as point A - the two distances are marked with letter "k" on the figure.

# Refraction

The speed of electromagnetic waves is different in different media. The change happening when it passes from one medium to another causes the phenomenon of refraction. The Snell's law (named after the Dutch mathematician Willebrord Snellius) describes the relationship between the angle of incidence and refraction: the ratio between them is a constant depending on the media or more exactly the ratio of the sines of the angles equals the ratio of velocities in the two media:

or

These angles are measured in respect to the normal-vector of the boundary between the two media.

According to this law the direction of the wave can be refracted towards or from the normal line, depending on the relative refraction-indices of the media. The next figure shows an example:

*In this case the velocity is lower in the second medium (V2<V1), the ray in the second medium is closer to the normal-line.*

The index of refraction for air is 1, for water is 4/3.

# The third dimension

The previously discussed examples and definitions were only two-dimensional, but for the real world, everything needs to be formed into 3D. The following equations describe the direction after refraction in 3D. For explanation, see [1]. Let **s** be the incoming ray of light (vector), **t** the transformed ray of light, **n** the normal-vector of the surface, **η1** and **η2** are the velocity indices. The transformed vector has two components: one parallel and one perpendicular to **n**. This can be written in the following form:

**t = -n cos(θ _{2}) + m sin(θ_{2})**

, where the underscored elements are vectors.

To calculate the two coefficients, we need to use the fact that only the angle along the surface changes, and not the entire direction. m can be defined as follows:

**m = perp _{n}s / sin(θ_{1}) = s - (n • s) n / sin(θ_{1})**

Using the previous equations [1] described the following result:

(1)This equation contains the possibility to have negative square root, which means that the equation is not defined for every angles and coefficients. The physical reason for this is described in the following paragraph.

# Critical angle

There is one more important phenomenon that I need to mention in connection with refraction. If the light is coming from a media with lower velocity, the angle will change from the normal, so the angle between the normal and the beam will be bigger in the target media. This means that to get 90 degree in the target medium a smaller angle is enough in the source medium. This specific angle is called critical angle. The critical and any higher angle results a refraction vector which is parallel to the surface of the media. If this happens, the wave will be refracted along the border of the media, it will not intrude the target medium, the so-called total internal reflection will occur. This critical angle is about 50 degree at a water-air boundary.

The sources of these illustrative images are Wikipedia and http://www.glenbrook.k12.il.us.

There is a funny flash application to play with the reflective-refractive angles and media on this site: http://www.ps.missouri.edu/rickspage/refract/refraction.html

# Multiple reflection and refraction

The light beams are reflected and refracted on the surface of the water, but to a certain amount the transformed light beams meat the air-water border again and reflection and refraction happens newly. This is illustrated on the next figure:

The source of the image is [2].

# The reflection-refraction ratio: the Fresnel term

The first two sections described reflection and refraction. They both happen to electromagnetic waves on the border of different media like on the next figures:

But how to get the accurate ratio between reflection and refraction? Augustin-Jean Fresnel (/freɪˈnɛl/) worked out the laws of optics in the early 19th century. His equations give the degree of reflectance and transmittance at the border of two media with different density. Derivation of them is outside the scope of this paper.

The wave has two components: a parallel and a perpendicular. **E _{i}** is the amplitude of the incident wave,

**E**and

_{r}**E**are the amplitudes of the reflected and the transmitted wave.

_{t}**θ**,

_{i}**θ**

_{r,}_{, and θ}

**t,,**are the angles between the surface normal and the beam of incidence, refraction and transmittance.

For the perpendicular component the equations are the following:

The next equations are showing the properties of the parallel components:

**t = [2n _{i}cos(θ_{i})]/[n_{i}cos(θ_{t}) + n_{t}cos(θ_{i})]**

The more elegant version of them are:

**r _{perpendicular} = −[sin(θ_{i})−sin(θ_{t})]/[sin(θ_{i})+sin(θ_{t})]**

and

**r _{parallel} =[tan(θ_{i})−tan(θ_{t})]/[tan(θ_{i})+tan(θ_{t})]**

If the light is polarized to have only perpendicular component, we call it S-polarized. Similarly, if it has only parallel components, it is called P-polarized. The next figure shows example coefficients depending on the angles for both S and P polarized cases:

As visible on the figure, in case of moving from denser medium to a less dense one (on the right), the reflection coefficient is 1 above the critical angle. This phenomenon is known as total internal reflection, as metioned earlier.

http://en.wikipedia.org/wiki/Fresnel_term

http://hyperphysics.phy-astr.gsu.edu/Hbase/phyopt/freseq.html

# Specular lights

Materials having a flat surface (e.g.: leather, glass and water also) present an interesting phenomenon which I have not mentioned yet. There are several different reflection models, some of them make the created image much more realistic while others help to improve the smaller details. One of these in the second group is specular reflection.

Materials like sand have irregular, bumpy surface and this makes incoming light to be reflected in every directions. This is shown on the next figure:

But if the material has flat surface, the light waves will be parallel after reflection as well. Because of this property shiny, bright spots will be formed on different materials, for example, on leather, metals, or on water if they are illuminated from a certain angle. The Phong illumination model describes this in the way which is most commonly used in 3D computer graphics. Phong Bui Tong developed his model in 1975 and it is still very popular. According to this model the intensity of point has three components: an ambient, a diffuse and a specular component and the specular highlight is seen when the viewer is close to the direction of reflection. The intensity of this kind of light falls off sharply when the viewer moves away from the direction of specular reflection.

Vector L points towards the light-source, V towards the viewer, N is the normal-vector of the surface, R is the direction of reflection while H halves the angle between L and V.

The approximation of the falloff of the intensity in the Phong model uses the power of the cosine of the angle. The specular part of the original formula looks like this:

where **β** is the angle between R and V; **k _{spec}** is the specular coefficient. The exponent

**n**can influence the sharpness of the falloff. A bigger exponent can describe a shinier surface with less gentle falloff. The dot product of two vectors equals the cosine of the angle between them, so the formula can be written in the following form:

Where "**·**" is the dot product.

With the diffuse reflection model the Phong illumination model is the following (**I** means intensity):

Where

**I**s are the different intensities,

**k**s are the ambient, diffuse and specular coefficients, and

**·**is the dot product. Namely, the intensity of a point is equal to the sum of the ambient light-intensity and the sum of the diffuse and specular intensity scaled to the distance of the light-source.

http://www.dgp.toronto.edu/~karan/courses/csc418/fall_2002/notes/illum_local.html

http://www.mini.pw.edu.pl/~kotowski/Grafika/IlluminationModel/Index.html