improved interactive raytracer

I added some features to my raytracer: reflections, refractions, hard shadows, fresnel effect. It's also possible now to previsualize the scene and the raytracing process using sandy3d (the gray line is the primary ray, the red ones the shadow rays, the green ones the reflected rays and the blue ones the refracted rays). This was very useful to me for debugging.

Here's the script used for the rendering above:

scene.maxReflection = 1;
scene.maxRefraction = 3;
scene.eye = new Vector(0, 30, -500);
var s1 = new Sphere(100, new Vector(0, 0, 200), new Vector(255));
s1.refrIndex = 1.;
var s2 = new Sphere(50, new Vector(0, 0, 500), new Vector(0, 255));
var l = new Light(new Vector(0, 500, -500));
var p = new Plane(new Vector(0, 1), -100, new Vector(0, 0, 255));

No comments: