Ray tracing is a rendering method for finding global reflection and transmission effects. In this method a ray of light is bounced from one surface to another. For rays in each pixel surfaces are checked whether they have intersected the ray. If they have intersected then the distance between the pixel and the surface is found out. This smallest distance identifies the visible surface for that particular pixel. After identifying the visible surface ray is reflected from the visible surface in a specular path having angle of reflection = angle of incidence. If surface is transparent then the ray is refracted. This reflected or refracted (whichever may be the case) ray is the secondary ray. This secondary ray again hits another visible surface. The process is recursively repeated to get new paths of reflection and refraction. These paths are shown by a binary Ray tracing tree. The rays are terminated when a predetermined surface is reached or if hits a light source:
T1, T2 and T3 are transmitted rays.
R1, R2 and R3 are reflected rays.
When you go from top to bottom in tree, surface intensities are attenuated by distance from parent surface. To determine the intensity of pixel, surface intensities of all nodes are added traversing the ray tree from bottom to top.