Here are a few test scenes for use with trace. Start with these scenes and once you're sure they work fine, try the more complicated scenes bundled with the raytracer.
Download these as a single group.
| 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
|
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 = 1.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 = 0.2;
}
} ) )
// 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 = 0.2;
}
} )
|
| sphere_refract.ray | |
|
This scene tests for refraction.
|
SBT-raytracer 1.0
// cyl_cyl_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.
translate( -2, -1, -10,
scale( .2, .2, 20,
cylinder {
material = { diffuse = (0.8, 0.4, 0); specular = (0.7, 0.7, 0.7); }
} ) )
translate( 0, 0.5, 0,
rotate( 1, 0, 0, .6,
translate( -2, -1, -10,
scale( .2, .2, 20,
cylinder {
material = { diffuse = (0.8, 0, 0.4); specular = (0.7, 0.7, 0.7); }
} ) ) ) )
|
| 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. Note that the
|
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);
}
} )
|
| texture_map.ray | |
|
Tests texture mapping.
|
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( "checkerboard.bmp" );
specular = (0.5, 0.5, 0.5);
reflective = (0, 0, 0);
shininess = 0.2;
}
} ) )
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 = 2;
}
}
) )
|
| recurse_depth.ray | |
|
Tests for larger amounts of recursive depth.
|
Scene file not shown due to length. |