Basic Ray Tracing
Ray tracing is a technique for generating an image by tracing paths of light from the camera through pixels in an image plane and simulating the effects of its encounters with virtual objects. To create different effects different rays are traced. The above diagram shows how the basic effects are generated. Primary rays (Red) are always traced from the camera into the scene in order to determine what will be visible in the final image. To create the direct illumination and shadows "Shadow rays "(Black) are traced from each rendered point to each light in the scene. If the rays "hit" a light the point is illuminated based on the light's settings. If they hit an object the point is shaded. Reflection rays (Green) are traced in the direction of the reflection vector which depends on the type of reflection - fresnel or normal and the index of refraction of the material. The direction of the Refraction rays(Blue) depends only on the index of refraction of the material. For clear reflections and refractions only a single ray is traced. To create glossy reflections or refractions many rays are traced in a cone - the spread of the cone depends on the glossiness amount.
Subsurface scattering and translucency effects are generated by tracing rays inside the geometry.