HW2: Raytrace Multiple Ellipsoids
2010, Dr. Lawlor, CS
481/681, CS, UAF
For this assignment, build a simple OpenGL program that raytraces several ellipsoids. Your program must:
- Show more than one ellipsoid, each at a different location, orientation, and with a different color reflectance.
- Allow the ellipsoids to intersect other geometry in the Z buffer consistently.
- Have decent camera movement and lighting.
- For 481 students, you can ignore shadows.
- For 681 students, you must allow the ellipsoids to cast shadows on each other.
Just hardcoding
the object count, properties, and light sources into your program is fine for
now.
Raytracing an Ellipsoid
As a quadric surface, the general equation for an ellipsoid is:
a*x2 + b*y2 + c* z2 + k = 0
Another representation of an ellipsoid is as a sphere with a different
scale factor applied on each axis. However, keep in mind that the
normal vector needs the transpose of the inverse of the point scale matrix.
You don't need to trim an ellipsoid; it's a closed surface already.
My raytraced ellipsoids look like this. I did the (much
harder!) 681 version with shadows. I added some stripes along the
X axis so I could see the shadowing better.