Project: Testcases
Testcases
The framework comes with a collection of test case files that cover many of the more common cases of each feature you should implement (and most of the bonus features). The test cases are organized in the data/tests
-directory by milestone. These test cases are not a complete test suite, and you will need to come up with your own test cases (think of corner cases that may occur!). You are, however, encouraged to share your more interesting test cases on Discord (which can also help you compare results). Below you will find a gallery of the output of the reference implementation for each of the provided test cases. While the results should be pretty consistent across implementations, there are some minor variations e.g. in how rounding and shadow ray offsets are handled, so minor differences are possible.
You can find more test cases, that I used for the milestone submissions, here
Milestone 1
/milestone1/test1.json
: A simple sphere
/milestone1/test2.json
: The empty file produces the same result (the default values are the values from test1.json
)
/milestone1/test3.json
: A bigger sphere with an offset
/milestone1/test4.json
: Two spheres (using “fake” union; test again when you’ve implemented the “real” union)
/milestone1/test5.json
: A plane
/milestone1/test6.json
: Tilted plane
/milestone1/test7.json
: Plane and sphere (compare to milestone2/test9.json
below)
/milestone1/test8.json
: A triangle
Quadrics
/milestone1/test9.json
: A cylinder (infinite height); note that you need to be able to move the camera origin for this test case (not the camera direction, though)
/milestone1/test10.json
: A cylinder with finite height; note that you need to be able to move the camera origin for this test case (not the camera direction, though)
/milestone1/test11.json
: A double cone; note that you need to be able to move the camera origin for this test case (not the camera direction, though)
/milestone1/test12.json
: A paraboloid (yours may be upside down; you can change the signs, if you want to, but don’t have to); note that you need to be able to move the camera origin for this test case (not the camera direction, though)
/milestone1/test13.json
: A one-sheet hyperboloid; note that you need to be able to move the camera origin for this test case (not the camera direction, though)
/milestone1/test14.json
: A two-sheet hyperboloid; note that you need to be able to move the camera origin for this test case (not the camera direction, though)
Milestone 2
/milestone2/test1.json
: The union of two spheres
/milestone2/test2.json
: The intersection of the same two spheres as in test 1
/milestone2/test3.json
: A union of two spheres
/milestone2/test4.json
: The intersection of the same two spheres as in test 3
/milestone2/test5.json
: The difference of the two spheres from test 3 (the green sphere carves a hole out of the red one)
/milestone2/test6.json
: The union of three spheres
/milestone2/test7.json
: The difference of the red sphere and the union of the other two from test 6. Note: If you can see the background through the hole, instead of the green inner cavity, you implemented the union incorrectly (or did not change the default union).
/milestone2/test8.json
: The intersection of the same three spheres as in test 6
/milestone2/test9.json
: The intersection a sphere and a plane (the same ones as in milestone1/test7.json
)
/milestone2/test10.json
: The intersection of two planes.
/milestone2/test11.json
: The intersection of three planes.
/milestone2/test12.json
: The intersection of four planes. Note that the “back” plane points away from the camera (also see the next test).
/milestone2/test13.json
: The intersection of five planes (a pyramid stump). Note that this is particularly tricky because many rays originate inside the bottom plane but never hit it.
Camera Position and Rotation
/milestone2/test14.json
: The pyramid stump from test 13 from a different angle.
/milestone2/test15.json
: The intersection of the sphere from test 4 from another angle.
/milestone2/test16.json
: The intersection of the sphere from test 4 with a smaller field-of-view.
/milestone2/test17.json
: The intersection of the sphere from test 4 with a larger field-of-view.
/milestone2/test18.json
: The intersection of the sphere from test 4 with a smaller field-of-view and from a different angle.
Movement, Rotation and Scaling
/milestone2/test19.json
: The same as test 4, except that the spheres are moved using the "moverotation"
object.
/milestone2/test20.json
: A scaled sphere (i.e. an ellipsoid).
/milestone2/test21.json
: The intersection of the ellipsoid from test 20 with a sphere.
/milestone2/test22.json
: Moving and rotating the ellipsoid from test 20/21, and intersecting it with a sphere.
Using Quadrics
/milestone2/test23.json
: Moving and rotating a cylinder
/milestone2/test24.json
: Moving and rotating a cylinder and intersecting it with a sphere
/milestone2/test25.json
: Intersection of a hyperboloid of one sheet and a sphere.
/milestone2/test26.json
: Intersection of a hyperboloid of two sheets and a sphere.
/milestone2/test27.json
: Intersection of a two hyperboloids (one rotated and moved a bit) and a sphere.
/milestone2/test28.json
: Intersection of a sphere and a (rotated and moved) cylinder.
/milestone2/test29.json
: The difference between the same sphere and cylinder as in test 28.
Milestone 3
/milestone3/test1.json
: The same sphere as in milestone1/test1.json
using phong lighting.
/milestone3/test2.json
: The same sphere again, but with different material properties (note the specular highlight).
/milestone3/test3.json
: The same sphere and material as in test 2, but with two light sources (note that there are two highlights now).
/milestone3/test4.json
: Two spheres with different material properties (note how the green sphere’s specular highlight looks very different).
/milestone3/test5.json
: The same as test 4, but with shadows turned on (the green sphere is between the red sphere and one of the two light sources).
/milestone3/test6.json
: Three lights with different colors shine onto a white sphere. Note that there is another sphere behind the camera that partially blocks each of these light sources; You can see where zero (the small region in the center), one, or two of the three lights hit the surface of the visible sphere.
/milestone3/test7.json
: Two white spheres with different material properties, and three light sources with different colors. Note how the colors of the lights interact on the two surfaces.
/milestone3/test8.json
: Two white spheres and one red one (all with different material properties) with lights with different colors. Note that one of the the lights no longer uses a “pure” green as its color, affecting the appearance of the two white spheres.
/milestone3/test9.json
: Many spheres on a plane, with two differently colored light sources and shadows enabled.
Reflection
/milestone3/test10.json
: Many spheres on a reflective plane, with two differently colored light sources and shadows enabled.
/milestone3/test11.json
: Many reflective spheres on a reflective plane, with two differently colored light sources and shadows enabled. This may take a few seconds (about 5 on my machine).
/milestone3/test12.json
: Similar to test 11, but with a higher limit for reflective rays.
CSG and Lighting
/milestone3/test13.json
: The shape from milestone2/test7.json
using the phong lighting model, with a light source inside.
/milestone3/test14.json
: The moon: A large sphere with smaller spheres (“craters”) carved out, shined upon by a red light. Note that the light can only reach one side of the craters (if any).
/milestone3/test15.json
: The pyramid stump from milestone2/test13.json
with phong lighting.
Using Transformations and/or Quadrics
/milestone3/test16.json
: A scaled sphere using phong lighting and a plastic-looking material.
/milestone3/test17.json
: The shape from milestone2/test24.json
using phong lighting and a plastic-looking material.
/milestone3/test18.json
: Same as test 17, but the light source was moved. Note the shapes of the specular highlights.
/milestone3/test19.json
: The shape from milestone2/test29.json
with phong lighting.
/milestone3/test20.json
: The same as test 19, but with shadows on. Note how the light can not reach the inner/blue part.
/milestone3/test21.json
: A reflective version of the shape from milestone2/test24.json
, with a sphere being reflected in it.
/milestone3/test22.json
: Similar to test 21, but with a cylinder instead.
Refraction
/milestone3/test23.json
: A lens (consisting of the intersection of two spheres) in front of a red and blue sphere.
/milestone3/test24.json
: To compare: A single transparent sphere in front of the same two red and blue spheres.
/milestone3/test25.json
: The same scene as in test 23, viewed from the side (requires moving and rotating the camera).
/milestone3/test26.json
: Another angle of test 23 (requires moving and rotating the camera). Note how the lens shows very interesting optical effects.
/milestone3/test27.json
: A partially transparent version of the shape from milestone2/test24.json
, with a sphere behind it.
/milestone3/animation1/scene%03d.json
: 250-frame animation of the camera rotating around a scene similar to test 23 (with some minor modifications to make the animation nicer). You can get this animation by setting input
, output
and repeat
(!) accordingly:
String input = "data/tests/milestone3/animation1/scene%03d.json";
String output = "data/tests/milestone3/animation1/frame%03d.png";
int repeat = 250;
/milestone3/animation1/scene%03d.json
: 250-frame animation of the camera rotating around a scene similar to test 23 (with some minor modifications to make the animation nicer). You can get this animation by setting input
, output
and repeat
(!) accordingly:
String input = "data/tests/milestone3/animation2/scene%03d.json";
String output = "data/tests/milestone3/animation2/frame%03d.png";
int repeat = 100;
Milestone 4
/milestone4/test1.json
: Mapping a texture onto a sphere
/milestone4/test2.json
: Textures also work with phong lighting and material properties.
/milestone4/test3.json
: Adding a moon and shadows (I know what you’re thinking: “that’s no moon …”)
/milestone4/test4.json
: A tiled texture on a plane.
/milestone4/test5.json
: You can change the tiling of the texture.
/milestone4/test6.json
: A textured triangle using the default coordinates.
/milestone4/test7.json
: You can also choose different texture coordinates for the vertices and the texture will be interpolated.
/milestone4/test8.json
: If you have a bunch of triangles with textures you can assemble a box (note: The box is fake, it only consists of the visible walls).
/milestone4/test9.json
: With the “moverotation”-transformation you can also rotate the box.
/milestone4/test10.json
: More complex objects are just more triangles, here you can see a chair. This object consists of a few hundred triangles, so rendering may take a few seconds. Note that scripts/convert_obj.py
contains a script that can help you convert your own 3D objects (in .obj-format) to our json format.
/milestone4/test11.json
: With the “moverotation”-transformation you can see the full beauty of the chair. Take a look at the texture file chair02.png.
With reflections
/milestone4/test12.json
: Textures are also reflected.
/milestone4/test13.json
: Reflection is also helpful to see parts of an object that might otherwise be hidden.
/milestone4/test14.json
: Two (angled) planes make a nice mirror array.
/milestone4/test15.json
: With refraction you can “zoom in” on textures.