These simple test files can be found in the "scenes/simple" directory of your project folder. We recommend you start with these scenes and once you're sure they work fine, try the more complicated scenes bundled with the ray tracer. We may be testing your program with some of these files during the grading session.
trimesh_cube.ray |
|
This scene tests triangle intersections. The first image is the result without shading implemented, the second with shading implemented. |
SBT-raytracer 1.0 camera { position = (0,0,-4); viewdir = (0,0,1); aspectratio = 1; updir = (0,1,0); } point_light { position = (1, 1, -3.0); colour = (1.0, 1.0, 1.0); constant_attenuation_coeff= 0.25; linear_attenuation_coeff = 0.003372407; quadratic_attenuation_coeff = 0.000045492; } rotate(1,1,1,1, scale(2, translate(-0.5,-0.5,-0.5, polymesh { points = ( (0,0,0), (0,1,0), (1,1,0), (1,0,0), (0,0,1), (0,1,1), (1,1,1), (1,0,1)); faces = ( (0,1,2), (0,2,3), (6,5,4), (7,6,4), (3,2,6), (3,6,7), (4,5,1), (4,1,0), (1,5,2), (5,6,2), (4,0,3), (4,3,7) ); material = { ambient = (0.0,0.0,0.0); diffuse = (0.1,0.1,1.0); specular = (0.0,0.0,0.0) } } ))) |
cyl_emissive.ray |
|
This scene is designed to test the emissive shading term. |
SBT-raytracer 1.0 // cyl_emissive.ray // Test for the emissive term camera { position = (5, 0, 0); viewdir = (-1, 0, 0); updir = (0, 1, 0); } // The cylinder should turn out a solid red. rotate( 1, 0, 0, 1.6, rotate( 0, 1, 0, -0.5, cylinder { material = { emissive = (0.5, 0, 0); } } ) ) |
cyl_ambient.ray |
|
This scene is designed to test the ambient shading model. |
SBT-raytracer 1.0 // cyl_ambient.ray // Test for the ambient term ambient_light { color = (1.0, 1.0, 1.0); } camera { position = (5, 0, 0); viewdir = (-1, 0, 0); updir = (0, 1, 0); } // This scene doesn't need any directional/point // lights since the material on the cylinder has // an ambient color. // The cylinder should turn out a solid red. rotate( 1, 0, 0, 1.6, rotate( 0, 1, 0, -0.5, cylinder { material = { ambient = (0.5, 0, 0); } } ) ) |
cyl_diffuse.ray |
|
This scene is designed to test for the diffuse term. |
SBT-raytracer 1.0 // cyl_diffuse.ray // Test for the diffuse term camera { position = (5, 0, 0); viewdir = (-1, 0, 0); updir = (0, 1, 0); } // This is a directional light coming from the // left of the scene. directional_light { // Direction is automatically normalized direction = (-1, -0.5, -1); color = (1, 0, 1); } // The cylinder should turn out a shaded blue. rotate( 1, 0, 0, 1.6, rotate( 0, 1, 0, -0.5, cylinder { material = { diffuse = (0, 0, 0.8); } } ) ) |
cyl_diff_spec.ray |
|
This scene tests for the specular term in addition to the diffuse term. |
SBT-raytracer 1.0 // cyl_diff_spec.ray // Test for specular term added to diffuse camera { position = (5, 0, 0); viewdir = (-1, 0, 0); updir = (0, 1, 0); } // This is a directional light coming from behind us directional_light { direction = (-1, 0, 0); color = (1, 0, 1); } // The cylinder should have a specular highlight // in the middle. rotate( 1, 0, 0, 1.6, cylinder { material = { diffuse = (0, 0, 1); specular = (1, 0, 1); shininess = 128.0; } } ) |
box_dist_atten.ray |
|
This scene tests for distance attenuation of lights. |
SBT-raytracer 1.0 // box_dist_atten.ray // Test for distance attenuation camera { position = (7, 0, 0); viewdir = (-1, 0, 0); updir = (0, 0, 1); } // Point light just above the center of the box. point_light { position = (0, 0, 1); color = (1, 1, 1); constant_attenuation_coeff= 0.2; linear_attenuation_coeff = 0.3; quadratic_attenuation_coeff = 0.0; } // The box forms a plane, which should be noticably // brighter in the middle than on the edges translate( 0, 0, -2, scale( 15, 15, 1, box { material = { diffuse = (0, 1, 0); } } ) ) |
box_cyl_reflect.ray |
|
This scene tests for reflection. |
SBT-raytracer 1.0 // box_cyl_reflect.ray // Test the reflection term // Don't forget to increase the trace depth to >= 2! camera { position = (15, 0, 5); viewdir = (-1, 0, -.3); updir = (0, 0, 1); } // Using ambient intensity of 0.25 ambient_light { color = (0.25, 0.25, 0.25); } // Directional light which shouldn't // cast any shadows directional_light { direction = (-1, 0, -0.2); color = (1, 1, 1); } // The box forms a plane, which should reflect the cylinder translate( 0, 0, -2, scale( 15, 15, 1, box { material = { diffuse = (0.5, 0, 0); specular = (0.5, 0.5, 0.5); reflective = (1, 1, 1); shininess = 25.6; } } ) ) // We'll give this a little ambient intensity to ensure // that the bottom, which doesn't face the light, is still // reflected properly (this is a common hack, since with // raytracing you don't have diffuse-diffuse reflections) translate( 0, 0, 1, cylinder { material = { ambient = (0, 1, 0); diffuse = (0, 0.5, 0); specular = (0.5, 0.5, 0.5); reflective = (1, 1, 1); shininess = 25.6; } } ) |
sphere_refract.ray |
|
This scene tests for refraction. |
SBT-raytracer 1.0 // sphere_refract.ray // Test the refraction term // Don't forget to increase the trace depth to >= 2! camera { position = (5, 0, 0); viewdir = (-1, 0, 0); updir = (0, 0, 1); } directional_light { direction = (-1, -1, -0.2); color = (1, 1, 1); } // Sphere acts as a lens scale(.2, 1.5, 1.5, sphere { material = { diffuse = (0, 0.12, 0); transmissive = (0.7, 0.7, 0.7); index = 1.5; } } ) // Add a couple of crossed cylinders behind the sphere to // see the refractive effect. // Note that the reason these are emissive is that otherwise // you have problems if transparent shadows aren't implemented. translate( -2, -1, -10, scale( .2, .2, 20, cylinder { material = { emissive = (0.8, 0.4, 0); } } ) ) translate( 0, 0.5, 0, rotate( 1, 0, 0, .6, translate( -2, -1, -10, scale( .2, .2, 20, cylinder { material = { emissive = (0.8, 0.0, 0.4); } } ) ) ) ) |
box_cyl_opaque_shadow.ray |
|
Tests for opaque (non-transparent) shadows. |
SBT-raytracer 1.0 // box_cyl_opaque_shadow.ray // Test opaque shadows camera { position = (15, 0, 5); viewdir = (-1, 0, -.3); updir = (0, 0, 1); } // This light should cast the shadow of the // cylinder on the box. point_light { position = (3, 0, 6); color = (1, 1, 1); constant_attenuation_coeff= 0.25; linear_attenuation_coeff = 0.003372407; quadratic_attenuation_coeff = 0.000045492; } // The box forms a plane translate( 0, 0, -2, scale( 15, 15, 1, box { material = { diffuse = (0.5, 0, 0); } } ) ) translate( 0, 0, 1, cylinder { material = { diffuse = (0, 0.9, 0); ambient = (0, 0.3, 0); } } ) |
box_cyl_transp_shadow.ray |
|
Tests for semi-transparent shadows. |
SBT-raytracer 1.0 // box_cyl_transp_shadow.ray // Test transparent shadows camera { position = (15, 0, 5); viewdir = (-1, 0, -.3); updir = (0, 0, 1); } // This light should cast the shadow of the // cylinder on the box. point_light { position = (3, 0, 6); color = (1, 1, 1); constant_attenuation_coeff= 0.25; linear_attenuation_coeff = 0.003372407; quadratic_attenuation_coeff = 0.000045492; } // The box forms a plane translate( 0, 0, -2, scale( 15, 15, 1, box { material = { diffuse = (0.5, 0, 0); } } ) ) translate( 0, 0, 1, cylinder { material = { ambient = (0, 0.09, 0); diffuse = (0, 0.27, 0); transmissive = (0.7, 0.7, 0.7); } } ) |
cube_transparent.ray |
|
Tests handling of shading inside of objects.
Most common problem: failure to flip the normal when shading an interior surface.
|
SBT-raytracer 1.0 // cube_transparent.ray // Tests handling of shading inside of objects. // Don't forget to increase the trace depth to >= 2! camera { position = (0,0,-3); viewdir = (0,0,1); aspectratio = 1; updir = (0,1,0); } directional_light { direction = (0, 0, 1); colour = (1.0, 1.0, 1.0); } directional_light { direction = (0,3,-1); colour = (0.9,0.9,0.5); } rotate(1,1,1,1, box { material = { diffuse = (0.8,0.8,0.3); transmissive = (0.7,0.7,0.7); index = 1.5; } }) |
poly_sphere.ray |
|
Phong interpolation of normals. The first image shows what happens if you
use per-face normals, and the second shows how it should look after Phong
interpolation of vertex normals.
(Consult the project assignment page to determine if you are required to implement this feature, or if it is an extra credit option.) |
SBT-raytracer 1.0 // poly-sphere.ray // Test Phong interpolation of normals. // Trace ray depth of 0 is fine. camera { position = (0,0,-4); viewdir = (0,0,1); aspectratio = 1; updir = (0,1,0); } point_light { position = (1, 1, -3.0); colour = (1.0, 1.0, 1.0); constant_attenuation_coeff= 0.25; linear_attenuation_coeff = 0.003372407; quadratic_attenuation_coeff = 0.000045492; } rotate(1,1,1,1, scale(1, translate(-0.0,-0.0,-0.0, polymesh { points = (...); normals = (...); faces = (...); material = { ambient = (0.0,0.0,0.0); diffuse = (0.3,0.6,0.3); specular = (0.5,0.5,0.5); transmissive = (0,0,0); shininess = 10; } } ))) |
texture_map.ray |
|
Tests texture mapping. (Consult the project assignment page to determine if you are required to implement this feature, or if it is an extra credit option.) |
SBT-raytracer 1.0 // texture_map.ray // Test texture mapping // Don't forget to increase the trace depth to >= 2! camera { position = (15, 0, 5); viewdir = (-1, 0, -.3); updir = (0, 0, 1); } directional_light { direction = (-0.2, 0.2, -2); color = (.7, .7, .7); } directional_light { direction = (-1, -0.5, -0.3); color = (.6, .6, .6); } // The box forms a plane, which should reflect the cylinder translate( 0, 0, -2, scale( 15, 15, 1, box { material = { diffuse = map( "texture-checkerboard.png" ); specular = (0.5, 0.5, 0.5); reflective = (0, 0, 0); shininess = 25.6; } } ) ) translate( 0, 0, 2, scale( 2, sphere { material = { specular = (0.8, 0.8, 0); reflective = (0.7, 0.7, 0); diffuse = (0.2, 0.2, 0); shininess = 256.0; } } ) ) |