Unfortunately, ray tracing of general scenes is undecidable:
http://www.cs.duke.edu/~reif/paper/tygar/raytracing.pdf
Semirelatedly, do you think the Haskell Diagrams lib with its normals tricks would be a good pedagogical substrate for raytracing for general shapes? Seems like it would allow punting on how surfaces are represented Mebe.