CS6620 Assignment1
From Dangerski
[edit] CS 6620 Assignment 1
Reference Image generated by my ray tracer
Source Code
Source Code
[edit] Creative Image
This is a box with a pyramid of spheres on top of it. There is also a ring casting a shadow on the spheres.
This has multiple rings.
[edit] Extra Credit
Tori
I used the intersection method outlined in the Ray Tracing from the ground up book. It requires solving a quartic equation because you can have up to 4 intersection points. I borrowed code from the web for solving that.
The equation for the torus is:
Squaring gives the implicit equation for a generic torus
f(x,y,z) = (x2 + y2 + z2) − 2(a2 + b2)(x2 + y2 + z2) + 4a2y2 + (a2 − b2)2 = 0
where a = swept radius and b = tube radius
You substitute the ray equation and get a 4th degree polynomial:
c4t4 + c3t3 + c2t2 + c1t + c0 = 0
Then you solve for c4,c3,c2,c1,c0
For the normal calculation you use the gradient:




