I used the reflection.ray file as a starting point and expanded it to create a reflective box with four colored, reflective spheres. I then added a lens in front of the camera to distort the field and clean up the perfect reflections inside the cube, some of which can be seen at the corners of the image. This image was generated at a depth of 5. The ray file is included below.
===============================================
SBT-raytracer 1.0
camera {
position = (0,0,-16);
viewdir = (0,0,1);
aspectratio = 1;
updir = (0,1,0);
}
directional_light {
direction = (0, 0, 1);
colour = (0.2, 0.2, 0.2);
}
point_light {
position = (-1,4,0);
colour = (1.0,1.0,0.7)
constant_attenuation_coeff= 0.25;
linear_attenuation_coeff = 0.003372407;
quadratic_attenuation_coeff = 0.000045492;
}
point_light {
position = (3,0,-16);
colour = (1.0,0.7,0.7)
constant_attenuation_coeff= 0.25;
linear_attenuation_coeff = 0.003372407;
quadratic_attenuation_coeff = 0.000045492;
}
// Sphere acts as a lens
translate(0,0,-12,
rotate(0,1,0,1.57,
scale(0.4, 2.5, 2.5,
sphere {
material = {
diffuse = (0, 0, 0);
transmissive = (0.8, 0.8, 0.8);
index = 1.5;
}
} )))
translate(-1,0,0,
scale(0.8,
sphere {
material = {
diffuse = (0,0.8,0);
specular = (0.8,0.8,0);
shininess = 102.4;
}
}))
translate(0.6,0,-2,
scale(0.6,
sphere {
material = {
diffuse = (0.0,0.4,0.4);
specular = (0.0,0.8,0.8);
shininess = 115.2;
}
}))
translate(1,2,2,
scale(1.2,
sphere {
material = {
diffuse = (0.4,0.4,0);
specular = (0.8,0.8,0);
shininess = 102.4;
}
}))
translate(-2,-2,-4,
scale(0.8,
sphere {
material = {
diffuse = (0.8,0.0,0.0);
specular = (0.5,0.5,0.5);
shininess = 115.2;
}
}))
//mirror box
//back
translate( 0,0,6,
scale(20,
rotate(1,0,0,3.1415,
square {
material = {
diffuse = (0.1,0.1,0.1);
specular = (1.0,1.0,1.0);
shininess = 128.0;
}})))
//bottom
translate( 0,-7.0,0,
scale(20,
rotate(1,0,0,-1.57,
square {
material = {
diffuse = (0.1,0.1,0.1);
specular = (1.0,1.0,1.0);
shininess = 128.0;
}})))
//left
translate( 7.0,0,0,
scale(20,
rotate(0,1,0,-1.57,
square {
material = {
diffuse = (0.1,0.1,0.1);
specular = (1.0,1.0,1.0);
shininess = 128.0;
}})))
//right
translate( -7.0,0,0,
scale(20,
rotate(0,1,0,-1.57,
square {
material = {
diffuse = (0.1,0.1,0.1);
specular = (1.0,1.0,1.0);
shininess = 128.0;
}})))
//top
translate( 0,7.0,0,
scale(20,
rotate(1,0,0,-1.57,
square {
material = {
diffuse = (0.1,0.1,0.1);
specular = (1.0,1.0,1.0);
shininess = 128.0;
}})))