Jeff Daudel
I) BUMP MAPPING
To add a rippling effect of the liquid, I made a bump map based of three factors:
1) Bump Period
2) Fade Factor
3) Spread Factor
The functions takes a point and a normal as a parameter. First I figure out the
distance of the 3D point in 2D space by substracting out the vector from the origin
in space to the vector parallel to the normal. What's left is the distance - d.
I then compute the fraction of d divided by the bump period, to get an oscillating
function. The distance increase based on the spread factor so that the period is
larger the further away from the origin. Then the length of this vector is reduced
by the Fade factor so that the bump influence is reduced the further away from the
origin as well.
I then take this vector and add it to the normal to push it along the radial distance.
Then the vector is normalized.
After all this, the cirular ripples are produced.
I vary the 2 factors from final1.ppm and final3.ppm. The fist one has no fade and
no spread, so it is a regular undiminishing ripple. The second has both a fade and
a spread so you can see the difference as the ripples move away from the origin.
--------------------------------------------------------------------------
II) PROCEDURAL TEXTURING
A) Spline interpolation (planet rings)
In shade.cpp, I use a function "spline", that takes a parameter, 0-1,
that simply interpolates any set of knots using a cubic spline. These knots are
3D color values, which the function interpolates each r,g,b component seperately,
giving a smooth transition from one value to another. I created a disk primitive
(see rt.h for the Disc class) and given the distance from its origin, pass this
fraction from a constant period to the spline function.
B) Gradient lattice noise
The procedural texture for the planet(s) was based on a gradient lattice noise
described by Ken Perlin et al. It takes a 3D point and returns a color based on
a marble-like texture. At the heart of the functions is a simple spline interpolation
as described above, but given a hard-coded, 256 random number, adds the proper noise.