Figure 1: An example of a single ray interacting with a drop.
To use this model to create images, define a “droplet” function
that describes how much light exits the sphere, and in which direction, when light enters in a certain direction. This function is the
probability that a ray will enter and exit the sphere in another direction, both initially defined as 3-D vectors. Snell’s law and the reflection law are used to trace rays through a sphere of radius, r. For
simplicity, take the limit as r approaches 0, and reduce the vector representation of the ingoing and outgoing rays to a directional lati-tude/longitude on the sphere. If the sphere is at the origin, all rays
into the infinitesimal sphere will be in a plane intersecting the
upward axis, where the incoming ray lies along the plane. Due to the
properties of both Snell’s law and the reflection law, all propagated
rays will also lie on this plane. The function is identical for all angles
in the axis of longitude; therefore, this degree of freedom can be
removed. Now, reformulate the function in terms of the angle
between the incoming direction and exiting direction. This function
is rotationally invariant due to the rotational symmetry of the sphere;
therefore, incoming light only needs to be considered from one direction. Outgoing light corresponding to other incoming directions will
simply be a rotated version of the original incoming/outgoing pair.
Figure 2: A plot of all of the rays that exit the sphere from
Figure 3: A plot of light intensity leaving the sphere, in terms
of the cosine of the angle between the incidence vector and
To apply this theory to create the BRDF and BTDF, use a unit sphere
to calculate the pairs of incoming and outgoing rays by randomly
shooting rays into one side of the sphere in one direction and tabulating how many rays exit in a certain direction. This data can be precomputed and tabulated into discrete buckets in terms of the cosine of
the angle between the entering and exiting ray; with a reasonable number of samples (~1000 rays were used in the sample implementation),
the precomputed data produces a visually accurate BRDF and BTDF.
Figure 3 shows that the intensity of light is highly angularly
dependent. Particularly, a visually significant amount of light is
focused at 42 degrees, and a secondary band appears at 51 degrees.
Figure 2 shows the same rays as Figure 3 plotted from the side of the
drop, with the light entering from the left. This property of water
droplets creates the macroscopic rainbow effect; a rainbow arc
around the viewer occurs primarily at 42 degrees, and a secondary
arc that is not always visible to the eye occurs at 51 degrees.
Wavelength Dependent Effects
Snell’s law depends on the refraction index of the medium that the
light is refracted through. In the case of water, the refraction index is
slightly different for different wavelengths of light. Due to this effect,
the areas of focused light seen above are located at slightly different
angles for different wavelengths, producing the colored bow. White
light is made up of a range of wavelengths. For the model to be accurate, the pattern of outgoing rays that result from different wavelengths must be accounted for. The physics that relate refraction
index to wavelength is quite complicated, but Paul Huibers created a
sufficiently accurate approximation of the wavelength dependence of
the refraction index based on physical measurements (Formula 4)
that produces good results for these purposes [ 4].
Formula 4: Huibers’ index of refraction formula for water.
In order to account for the wavelength dependent effects, the table
of angular values discussed previously is computed at various different
wavelengths. In the sample implementation, wavelengths are recorded
from 400 nm to 700 nm, which is the range of wavelengths of visible
light. The wavelengths are recorded in 15 nm intervals; this number was
chosen because it was the largest interval that did not produce noticeable banding in test images. A smaller interval could be chosen to reduce
banding if necessary. Later, when all of the light rays are gathered, calculations are done separately in each of these wavelength buckets and
then converted to XYZ color using the CIE matching functions provided
by Pharr and Humphreys [ 4]. The CIE, or the International Commission
on Illumination, is an international committee that sets color and illumination standards, such as defining the conversion from wavelengths
to colors on computer screens. CIE XYZ color can easily be converted
to the RGB color space typically used in computer-generated images. An
extensive discussion of why the CIE matching functions produces correct results in the RGB color space is beyond the scope of this paper; it
is covered in detail by Pharr and Humphreys. Essentially, these functions
integrate over all wavelengths for X, Y, and Z and weight each wavelength
depending on how much it contributes to each of these three color components. This method of accounting for wavelength dependence is not
the most efficient method, but it is flexible and easy to implement.