..

Homework 3 - Fully-Featured Raytracer

Jackson Kruger

The source code for my Raytracer can be found on Github. I developed this Raytracer in Visual Studio in Windows. A compiled executable can be downloaded here.

Features (which should be apparent from the outputs below)

Attempted but not working or barely working:

Architecture Overview

The file containing main, Raytracer.cpp, only exists to kick things off. It tells Parser what file to parse, who then initializes the relevant objects and sets appropriate values. The most important objects it initializes are the Renderer, the Scene, and the Camera. The Scene contains all of the lights and shapes, while the camera primarily exists to construct the rays. The Renderer is the bridge between the Camera and the Scene, as well as the final Image object that is used to output at the end. It iterates over width and height, telling the camera to construct the rays, getting the colors of the pixels from the Scene, then setting the pixels of the Image. The Scene has a collection of Intersectables which it it tells to intersect with the current Ray, potentiall modifying the out-parameter Intersection. I employed object-oriented patterns pretty heavily, and leveraged C++'s polymorphism heavily as well. For example, a Primitive is something that is both Intersectable and Materialed. An IntersectableGroup is a collection of other Intersectables, and is thus itself Intersectable, but does not have a Material.

Notes


My compiled executable for windows as well as all images and scenes used here (they have the same names) can be downloaded: here

Output Images

Sample scenes

The following are the rendered outputs of the provided sample scenes. The only modification I made to these before running them was changing the output file location.

Custom scenes

The following a variety of custom scenes that I made.


That same image rendered with depth of field and supersampling



A sphere moving from left to right using my motion_warp option


A glass sphere just in front of the camera


My personal favorite scene. I'd like for this image and the ones like it to be submitted for the art contest.


And other old versions of this scene


This was a messed up output of "test_reasonable.scn"

Resolution and Aspect Ratio

These are just to show that my Raytracer can handle odd FOV's and resolutions (they have hover text). Note that these images were rendered at the for the first checkin (HW2), and thus don't have refraction in them.

Scene File Additions

plane nx ny nz px py pz
quad px py pz rx ry rz ux uy uz
rectangular_prism px py pz rx ry rz ux uy uz fx fy fz
end_position px py pz
motion_warp boolOn
DOF focalDistance lensRadius numSamples
supersampling sampleRadius
jittered_supersampling boolJittered

Performance

I'm not too happy with my performance overall, especially considering my failure to implement a BVH. I also didn't attempt parallelization as my Raytracer doesn't seem to be CPU-bound. It's rare for a core to max while I'm running intense scenes, probably indicating it's spending much of its time creating/destroying objects. I didn't get a chance to give a thorough effort to optimize, beyond the little attempts I made throughout the project.

Scene Runtime
ambient_sphere.scn 98ms
spheres1.scn 1269ms
spheres2.scn 3893ms
spot_sphere.scn 106ms
bear.scn 1220ms
guys_triangle.scn 80ms
outdoor.scn 770ms
test_reasonable.scn 692ms
ShadowTest.txt 5721ms
bottle.txt 59487ms
bottle-nolabel.txt 100791ms
gear.txt 494122ms
arm-top.txt 245871ms
reaching_hand.txt 494999ms
dragon.scn 692054ms