I (mis)used perl for 3d graphics last time.
You can get the source code from http://www.math.bme.hu/~ambrus/pu/tri.
You may not understand it as it lacks comments.
I do not develop this program any further.
It outputs a ppm.
Note: this was for university class too.
Update. Let me complete the story. I wrote the thingy in Perl because I did not have Mathematica at home.
Later, I converted the program to Mathematica in the university, so what I've really given as a homework was
a Mathematica program and an article explaining it.
(In my case, however, it was obligatory to use Mathematica.)