Raytracer for CSCI 4471 Computer Graphics class project
See Features
section below for a complete feature list.
Pre-Built Binary for Mac (188 KB) | zip of in/ directory (32.6 MB) |
zip of out/ directory (4.22 MB) |
zip of img/ directory (2.79 MB) |
---|
Note: Some of the required files are ignored by Git to keep the repository's size at a minimum. The complete in/
directory can be downloaded and swapped in place after downloading this repository. This will allow you to test all of the files, including those with large .obj
and texture files.
The out/
directory contains all of the rendered images as .bmp
.
The img/
directory contains all of the images converted into .png
.
You may prefer to download the resulting images in out/
and img/
, and skip compiling and running the Raytracer entirely.
Build the executable in bin/
directory.
make
make clean
After compiling (see above):
./bin/raytracer.o
make test
make render
Then look into the out/
for all of the rendered images.
You can also copy and paste the commands that are printed out for each file render.
For instance, you may see:
cd in/ ; ../bin/raytracer.o -input test_noise_1.txt -size 200 200 -bounces 4 -output ../out/test_noise_1-no_back.bmp -normals ../out/test_noise_1_normals.bmp ; cd ../
You can easily copy and paste this command to re-render
this case for input test_noise_1.txt
with those arguments.
You can change the default arguments for render
task.
PATTERN
- Defaults to*.txt
- Globbing pattern to select input files fromin/
directorySIZE
- Defaults to200
- Size of rendered imagesEXT
- Defaults tobmp
(bmp
ortga
supported) - File extension of rendered imagesBOUNCES
- Defaults to4
- # of recursive bounces of a ray, used for reflectionsSPECIALS
- Defaults toon
(on
oroff
) - Render special cases of the input files, such as with depth mapping
After running make render
and populating your out/
directory with images you may wish to clean / delete all of those images.
make clean-render
By default, make render
will only compile any new / changed files.
To force a make clean
before building the binary and running the render
task you can use the render-clean
task.
# Exactly like using just `render` task
# Except it runs `clean` task before building
make render-clean
To render a single file, use full filename and force the pattern to only match one:
make render PATTERN=test_bunny_1k.txt
You can use Globbing / patterns to select input files:
make render PATTERN=test_colored_reflective_sphere_shadows_2*
You can also change the rendered image size:
# Render all images with output size of 1000
make render SIZE=1000
# Render specific pattern of images with output size of 1000
make render PATTERN=test_texture_mapping_sphere.txt SIZE=1000
You can also disable the special custom rendered images:
make render SPECIAL=off
First, install imagemagick
:
brew install imagemagick
The following will convert the .bmp
images to .png
images and move them into the img/
directory.
make convert-render
You should run this after you're satisfied with your .bmp
renders.
It will render all of the .bmp
images it can find in out/
, and will take some time. Be patient and run only when you're ready.
make render # Render `.bmp` images to `out/`
make convert-render # Convert `.bmp` to `.png` and move to `img/`
Using Doxygen.
make docs
Here is the complete feature list. Bolded list items are require features. Features marked with ✓ are implemented, while those without are not.
In addition to the 103 required marks there were 26 elective marks implemented, totalling to 129 marks out of the 125 marks for 100%.
Below is the complete list of features and details about each where applicable.
Your choice of additional features beyond the specific required ones.
Implemented 26 elective marks:
- Multiple light sources (4 marks)
- Other debugging tools (2 marks)
- Environment Mapping (5 marks)
- Octree (6 marks)
- Antialiasing (5 marks)
- Source Control (4 marks)
Implemented 5 out of 5 required marks.
- [✓] Basic classes, main function (5 marks)
- [✓] Material
- See Material.h and Material.cpp
- [✓] Hit
- See Hit.h
- [✓] Ray
- See Ray.h
- [✓] Material
Implemented 29 out of 29 required marks.
-
[✓] Object3D (4 marks)
- See Object3D.h
-
[✓] Sphere (6 marks)
-
See Sphere.h and Sphere.cpp
-
-
[✓] Group (5 marks)
- See Group.h
-
[✓] Plane (2 marks)
- See Plane.h
-
[✓] Triangle (2 marks)
- See Triangle.h
- [✓] Transformations (8 marks)
- See Transform.h
-
Constructive Solid Geometry (10 marks)
-
Additional Primitives (3 or more marks)
-
3-D Iterated Function System (8 marks)
Implemented 36 out of 36 required marks and 4 elective marks.
- [✓] Diffuse shading (5 marks)
- See Material.cpp
- [✓] Phong model (5 marks)
- See Material.cpp
- [✓] Specular Reflection (10 marks)
- See RayTracer.cpp
-
[✓] Basic Shadows (6 marks)
- See RayTracer.cpp
-
[✓] Refraction (10 marks)
-
See RayTracer.cpp
scene4_06_transparent_bars.txt
|scene4_07_transparent_sphere_1.txt
--- | --- | --- | ---|
scene4_06_transparent_bars-shadows_shade_back.bmp
|scene4_07_transparent_sphere_1-shadows_shade_back
scene4_08_transparent_sphere_1.txt
|scene4_09_transparent_sphere_2.txt
--- | --- | --- | ---|
scene4_08_transparent_sphere_1-shadows_shade_back.bmp
|scene4_09_transparent_sphere_2-shadows_shade_back.bmp
-
-
Soft Shadows (6 marks)
-
[✓] Multiple light sources (4 marks)
- See RayTracer.cpp
-
Spotlights (4 marks)
-
Glossy reflections (7 marks)
-
Simple Fog (4 marks)
-
Volumetric fog (8 marks)
-
Photon Mapping (15 marks)
Implemented 11 out of 11 required marks.
-
[✓] Camera (2 marks)
- See Camera.h
-
[✓] Orthographic Camera (4 marks)
-
[✓] Perspective Camera (5 marks)
-
Bloom (4 marks)
-
Depth-of-field (8 marks)
-
Fisheye appearance (2 marks)
-
Oblique Cameras (2 marks)
-
Other Non-Linear Cameras (4+ marks)
Implemented 12 out of 12 required marks and 2 elective marks.
- [✓] Depth Visualization (4 marks)
- See main.cpp
- [✓] Back face shading / no shading (4 marks)
- See Material.cpp
- [✓] Normal Visualization (4 marks)
- See main.cpp
-
OpenGL Previsualization Tool (6 marks)
-
[✓] Other Tools (2+ marks)
-
[✓] I developed RayCapture for the purpose of assisting me with quicker debugging and generating sample input scenes.
-
[✓] I have used Unit Testing to help me with my debugging. You can run
make test
to see the results. This has helped me in the initial development of this Raytracer for testing Camera's generateRay return values in comparison to the right values calculated "by hand". See test/unit/ directory for source code of the unit tests. -
[✓] I developed a
render.sh
script that allows me to pass arguments in to customize which input files are rendered and how they are rendered, size of image, number of ray bounces, etc. See Rendering Arguments section above for more details.
Implemented 10 out of 10 required marks and 5 elective marks.
-
[✓] Simple Procedural (4 marks)
-
See Noise.h and Noise.cpp and PerlinNoise.h and PerlinNoise.cpp
scene12_vase.txt
|test_noise_1.txt
--- | --- | ---|
scene12_vase-no_back.bmp
|test_noise_1-shadows_shade_back.bmp
-
-
[✓] Texture Mapping I (6 marks)
-
See texture.hpp and texture.cpp and Sphere.cpp
test_texture_mapping_sphere.txt
| --- | ---|
test_texture_mapping_sphere-shadows_shade_back.bmp
|
-
-
Texture Mapping II (up to 6 marks)
-
[✓] Environment Mapping (5 marks)
This could be sphere maps or cube maps. - [✓] Cube Map support - See CubeMap.h and CubeMap.cpp
`scene10_sphere.txt` | `scene12_vase.txt`
--- | ---
|
scene10_sphere-shadows_shade_back.bmp
| scene12_vase-shadows_shade_back.bmp
-
Additional texture model loading (4 marks)
-
Bump mapping (6 marks)
Implemented 6 elective marks.
-
Adaptive Ray Depth (5 marks)
-
Intersection Methods (4 marks)
-
BSP tree (6 marks)
-
Grid (6 marks)
-
Adaptive bounding boxes or bounding spheres (6 marks)
-
[✓] Octree (6 marks)
- [✓] Raytracer has Octree support for Meshes loaded by .obj files
- See octree.hpp and octree.cpp and Mesh.cpp
- [✓] Raytracer has Octree support for Meshes loaded by .obj files
-
Some other technique of your choice (6 marks)
Implemented 5 elective marks.
-
[✓] Antialiasing (5)
- [✓] Jittering method for antialiasing
- See main.cpp
Normal | Antialiasing with
n=2
| Antialiasing withn=4
--- | --- | ---|
|
- [✓] Jittering method for antialiasing
-
Adaptive Antialiasing (4 marks)
-
Motion Blur (4 marks)
Implement 4 elective marks.
-
[✓] Source Code Control (4 marks)
- Using Git and GitHub!
-
Parallelizing the Raytracer (5 marks)