# I - Raytracing Reference

## Incident

Light rays falling on (as opposed to reflected from or refracted through) a surface are known as "incident" rays. The medium through which an incident ray passes before interaction with the surface is called the "incident medium". Correct identification of the incident medium is essential in calculating the correct relative index of refraction.

## Index of refraction

The index of refraction (IOR) of a transparent medium is a measure of its ability to deviate light through refraction. The standard formula for index of refraction (denoted by the Greek letter eta) is where cv and cm are the speeds of light in vacuum and in the medium respectively. A useful alternative formula is contained in Snell's Law, which states that where i and r are the angles of incidence and refraction respectively. These are illustrated in the next diagram. ##### Angles of incidence (i) and refraction (r) for refraction througha glass block. The green lines are surface normals

When a ray passes from one transparent medium (M1) to another (M2), it is deviated according to a relative index of refraction. This is given by where n21 is the relative IOR of M2 with respect to M1, and n1 and n2 are the IOR's of M1 and M2 respectively. Snell's law holds for the relative index of refraction.

## Infinite

An infinite quantity cannot be bounded: it has no observable beginning or end. Computer graphics applications usually distinguish between finite and infinite shapes. An infinite shape cannot be completely isolated within a region of space and thus cannot have a bounding volume. Examples of infinite shapes are straight lines (in the strict sense, as opposed to line segments), planes and paraboloids.

## Inside

A point is (technically) said to be inside a simple closed surface if a ray starting from this point intersects the surface an odd number of times. The reasoning is, if the point was outside, then every time the ray entered the object it would have to leave it. This would correspond to two intersections. The total number of intersections would therefore always be even (or zero). However, for an inside point, the last exit-time intersection would not have an entry-time counterpart, and the total number of intersections would be odd.

The above definition gives the brute-force method of testing for inside points. This is in fact the method usually used for closed polygon meshes. But in most cases, there are simpler methods. For example, given a sphere x^2 + y^2 + z^2 = R^2, the usual way of testing if the point (x1, y1, z1) is inside the sphere is to evaluate the quantity (x1^2 + y1^2 + z1^2 - R^2): if it is negative, the point is inside; if it is positive, the point is outside; and if it is zero, the point lies on the surface.

## Integral

An integral is the reverse of a derivative, hence it is also called an "antiderivative". If the function f(x) is the derivative of the function F(x), then F(x) is the integral of f(x). This is written as For each function f(x), there are actually an infinite number of integrals, all differing in the value of the constant term. Hence, if we know one integral F(x) of f(x), then all the other integrals may be represented as F(x) + c, where c is an arbitrary constant. The process of finding the integral is known as "integration".

The above definition is, strictly speaking, that of an "indefinite integral". There is another type of integral known as a "definite integral", defined in terms of an interval [a, b]. This is calculated from first principles as where n = (b - a)/h. By the Fundamental Theorem of Calculus, the definite integral may be evaluated as where F is the indefinite integral as defined above. This definite integral gives the area enclosed between the curve y = f(x), the x-axis and the lines x = a and x = b (the area is positive if the curve lies above the x-axis and negative otherwise).

Definite integration is a summation process. It is therefore used to calculate the total or average value attained by a quantity within a particular interval. For example, given the function v(t) describing the velocity of an object at time t, the definite integral of v(t) with respect to t in the interval t = 0 to t = 2 seconds represents the displacement of the object in the first two seconds of its motion (velocity is the derivative of displacement, therefore displacement is the integral of velocity). When the function to be integrated is complicated, numrical summation methods are used to evaluate the definite integral from first principles.

## Intensity

Intensity is a measure of the amplitude of the incident light radiations. Alternatively, it is a measure of the rate of arrival of photons at a point. Either way, high intensity implies high energy. Graphics applications often refer to colour component intensities. This is merely the intensity of any one component (say R, G or B) of light. Note that colour and intensity are different terms. Colour tells us about the intensity distribution in light. However, the terms are often used interchangeably (in fact, I have been guilty of this on a number of occasions in this website).

## Interpolation

Interpolation is a way of forming a continuous sequence from a set of discrete quantities. This technique is sometimes referred to as "curve-fitting" or "regression". For example, say a function A(x) assumes the following values:

A(1) = a1, A(2) = a2, A(3) = a3, ...

What if we want to get the value of A(2.7)? We must approximate the value of A at 2.7 based on the discrete sequence given. A common method is linear interpolation. This produces a straight line graph between two discrete points. Applying it to the above data gives

A(2.7) = (3 - 2.7) * A(2) + (2.7 - 2) * A(3) = 0.3 * a2 + 0.7 * a3

Better methods include cosine interpolation and spline interpolation. These produce curved graphs from a discrete sequence. Spline interpolation produces the smoothest output because it uses more than two discrete values. ## Intersection

An intersection of two sets is the part that is common to both sets. A geometrical intersection of two objects is a point (or the locus of a point) common to both objects. We can see that the second definition is an extension of the first.

In computer graphics, intersections are used primarily in three cases. First, an intersection of two solid objects produces a third solid object according to the rules of Constructive Solid Geometry. Second, raytracers use ray-object intersection data for determining visibility. Ray-object intersections are the points where a ray cuts an object surface. Third, intersections of objects with bounding shapes are extensively utilized in clipping algorithms.

## Isosurface

An isosurface is a surface extracted with statistical methods from a 3-D set of values at different points in space. For example, if you are given a density map of a cloud, then the isosurface extracted would be (approximately) the surface of the cloud. The extraction process closely resembles the edge filter (which just shows the edges of shapes) of many image-editing programs.

There is, by the way, another use of the term. So far I have encountered this one only in an unofficial version of the raytracer POV-Ray, but considering the popularity of this software I'm willing to bet thousands of people are using it. It describes an isosurface as an algebraic surface formulated by the user in a graphics program, so that the program has no way of knowing the equation of the shape beforehand. This is one of the most general primitives a graphics program can handle, and requires some fancy mathematics.

## Iterative

An iterative process is repetitive: it loops several times (in fact, the words "loop" and "iteration" are often used interchangeably). We often read or hear about "iterative root finders". These are functions used to solve equations by looping over and over again, each time narrowing in towards the root. They are of considerable importance in raytracing and usually represent the stablest way of solving equations with a computer. Another common example of an iterative process is an algorithm to generate a fractal.