Graphics Reference
In-Depth Information
Oil Slicks
An oil slick is caused by a thin film of oil on top of water. It is
very common to see these in streets and parking lots, espe-
cially right after a rain when it has not rained in a while. As
shown in Figure 16.4, the light is partially reflected from
the top surface of the oil and partially refracted down
into the oil. At the oil-water interface, the light is reflected
upward, and the reflected light then passes through the
oil surface back into the air. The interference between the
directly reflected and the refracted-then-reflected light
causes the oil slick's visual effect.
Here we see a similar computation of the wave-
lengths, but there is an interesting twist because the light
undergoes a 180° phase change at the oil-water interface.
The light that comes from the interface has a slightly lon-
ger path, which we will assume is simply 2 d longer. The
refractive index η of the oil means that the light in the oil has wavelength
λ out = λ/η, and the phase change means that the light coming out of the oil is a
half wavelength out of phase with light that went in. The two light waves will
then cancel if the added distance is a multiple of the wavelength of the light in
the oil, 2 d = m * λ out . The light waves will reinforce each other if the distance is
a half wavelength off such a multiple, 2 d = ( m + 0.5) * λ out . So the wavelengths
that we see in an oil slick are all defined by
Figure 16.4. Light interacting with a
thin oil film over water.
2
d
λ
=
λ
.
m
+
05
.
We know d and η. We just need to see what, if any, integer values of m
would give us wavelengths in the visible spectrum. We will assume that the oil
on top of the water is in the shape of decaying exponential “hump,” perturbed
with a noise function. The vertex shader, then, records the current position in
that hump and the location of the center center of the hump.
out vec3 vMCposition;
out vec3 vCenter;
void main( )
{
vCenter = vec3( 0., 0., 0. );
vMCposition = aVertex.xyz;
gl_Position = uModelViewProjectionMatrix * aVertex;
}
Search WWH ::




Custom Search