Test scenes for the raytracer

Here are a few test scenes for use with trace. I recommend you 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

Test for the emissive term in the Phong shading equation.

SBT-raytracer 1.0

// cyl_emissive.ray
// Test for the emissive term in the Phong shading equation.

camera
{
	position = (5, 0, 0);
	viewdir = (-1, 0, 0);
	updir = (0, 1, 0);
}

// This scene doesn't need any lights at all
// since the material on the cylinder is
// emissive.  Render it with an ambient light 
// intensity of 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

Test for the ambient term in the Phong shading equation.

SBT-raytracer 1.0

// cyl_ambient.ray
// Test for the ambient term in the Phong shading equation.

ambient_light
{
	color = (1.0, 1.0, 1.0);
}

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 = { ambient = (0.5, 0, 0); 
		}
	} ) )

cyl_diffuse.ray

Test for the diffuse term in the Phong shading equation.

SBT-raytracer 1.0

// cyl_diffuse.ray
// Test for the diffuse term in the Phong shading equation.

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

Test for specular term added to diffuse in Phong shading.

SBT-raytracer 1.0

// cyl_diff_spec.ray
// Test for specular term added to diffuse in Phong shading.

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

Test for distance attenuation of point lights.

SBT-raytracer 1.0

// box_dist_atten.ray
// Test for distance attenuation of point lights.

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

Test the reflection term.

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;
		}
	} )

cylinder_refract.ray

Test refraction using a cylinder.

SBT-raytracer 1.0

// cyl_cyl_refract.ray
// Test refraction using a cylinder.
// Don't forget to increase the trace depth to >= 4!

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
translate( 0, 0, -0.5, 
scale(.2, 1.5, 1.5, cylinder {
	material = { 
		diffuse = (0, 0.12, 0);
		transmissive = (0.9, 0.9, 0.9);
		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 = { 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.4); }
	} ) ) ) )

sphere_refract.ray

Test refraction using a sphere.

SBT-raytracer 1.0

// cyl_cyl_refract.ray
// Test refraction using a sphere.
// Don't forget to increase the trace depth to >= 4!

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.9, 0.9, 0.9);
		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 = { 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.4); }
	} ) ) ) )

box_cyl_opaque_shadow.ray

Test opaque 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);
		}
	} )

texture_map.ray

Test texture mapping (not required for CSE591 in Spring 2002).

SBT-raytracer 1.0

// texture_map.ray
// Test texture mapping (not required for CSE591 in Spring 2002).
// 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;
		}
	}
) )