Glavin001 / Raytracer

Raytracer for CSCI 4471 Computer Graphics class project
http://glavin001.github.io/Raytracer
8 stars 2 forks source link

Raytracer

Raytracer for CSCI 4471 Computer Graphics class project

See Features section below for a complete feature list.

Author

Downloads

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.

Compiling

Build the executable in bin/ directory.

make

Cleaning

make clean

Usage

After compiling (see above):

./bin/raytracer.o

Testing

Unit Testing

make test

Rendering Sample Scenes

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.

Rendering Arguments

You can change the default arguments for render task.

Cleaning Rendered Images

After running make render and populating your out/ directory with images you may wish to clean / delete all of those images.

make clean-render

Rendering with a clean build

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
Examples

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

Convert .bmp to .png images

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/`

Documentation

Source Code

Using Doxygen.

make docs

Features

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.

Electives (22 required marks)

Your choice of additional features beyond the specific required ones.

Implemented 26 elective marks:

Starting Out (5 required marks)

Implemented 5 out of 5 required marks.

Primitives and Modeling (29 required marks)

Implemented 29 out of 29 required marks.

image

image

render

scene2_09_bunny_200-shadows_shade_back

scene2_10_bunny_1k_normals scene2_10_bunny_1k-shadows_shade_back

scene12_vase_normals scene12_vase-shadows_shade_back

scene13_diamond_normals scene13_diamond-shadows_shade_back

test_bunny_1k_normals test_bunny_1k-shadows_shade_back

scene2_11_squashed_sphere_normals scene2_11_squashed_sphere-shadows_shade_back

scene2_13_rotated_squashed_sphere_normals scene2_13_rotated_squashed_sphere-shadows_shade_back

scene2_14_axes_cube_normals scene2_14_axes_cube-shadows_shade_back

scene2_15_crazy_transforms_normals scene2_15_crazy_transforms-shadows_shade_back

Light Simulation and Illumination (36 required marks)

Implemented 36 out of 36 required marks and 4 elective marks.

image

scene_shininess_variations-shadows_shade_back

scene4_03_mirrored_floor_normals scene4_03_mirrored_floor-shadows_shade_back

scene4_04_reflective_sphere_normals scene4_04_reflective_sphere-shadows_shade_back

scene_reflective_sphere_normals scene_reflective_sphere_bounces_0 scene_reflective_sphere_bounces_1 scene_reflective_sphere_bounces_2 scene_reflective_sphere_bounces_3 scene_reflective_sphere-shadows_shade_back

scene_reflective_shininess_variations_normals scene_reflective_shininess_variations-shade_back scene_reflective_shininess_variations-shadows_shade_back

scene2_03_colored_lights-shadows_shade_back scene4_02_colored_shadows-shadows_shade_back

Camera and Lens Model (11 required marks)

Implemented 11 out of 11 required marks.

Debugging Tools (12 required marks)

Implemented 12 out of 12 required marks and 2 elective marks.

scene1_01_depth scene1_02_depth scene1_03_depth scene1_04_depth scene1_05_depth scene1_06_depth scene1_07_depth scene2_04_perspective_depth scene2_05_depth scene2_06_depth scene2_07_depth

scene2_07_depth scene2_07_sphere_triangles_normals scene2_07_sphere_triangles-no_back scene2_07_sphere_triangles-shade_back

scene2_05_depth scene2_05_inside_sphere_normals scene2_05_inside_sphere-no_back scene2_05_inside_sphere-shade_back

octahedron_2_normals octahedron_normals scene_reflective_shininess_variations_normals scene_reflective_sphere_normals scene_shininess_variations_normals scene1_01_normals scene1_02_normals scene1_03_normals scene1_04_normals scene1_05_normals scene1_06_normals scene1_07_normals scene1_08_normals scene01_plane_normals scene2_01_diffuse_normals scene2_02_ambient_normals scene2_03_colored_lights_normals scene2_04_perspective_normals scene2_05_inside_sphere_normals scene2_06_plane_normals scene2_07_sphere_triangles_normals scene2_08_cube_normals scene2_09_bunny_200_normals scene2_10_bunny_1k_normals scene2_11_squashed_sphere_normals scene2_12_rotated_sphere_normals scene2_13_rotated_squashed_sphere_normals scene2_14_axes_cube_normals scene2_15_crazy_transforms_normals scene2_16_t_scale_normals scene02_cube_normals scene4_01_sphere_shadow_normals scene4_02_colored_shadows_normals scene4_03_mirrored_floor_normals scene4_04_reflective_sphere_normals scene4_05_transparent_bar_angle_view_normals scene4_05_transparent_bar_normals scene4_06_transparent_bars_normals scene4_07_transparent_sphere_1_normals scene4_08_transparent_sphere_1_normals scene4_09_transparent_sphere_2_normals scene4_10_point_light_distance_normals scene4_11_point_light_circle_normals scene4_12_point_light_circle_d_attenuation_normals scene4_13_point_light_circle_d2_attenuation_normals scene4_14_faceted_gem_normals scene05_bunny_200_normals scene06_bunny_1k_normals scene10_sphere_normals scene11_cube_normals scene12_vase_normals scene13_diamond_normals test_bunny_1k_normals test_colored_reflective_sphere_shadows_2_normals test_colored_reflective_sphere_shadows_3_normals test_colored_reflective_sphere_shadows_4_normals test_colored_reflective_sphere_shadows_normals test_noise_1_normals test_ortho_cube_normals test_ortho_cube_refraction_normals test_perspective_1_normals test_plane_1_normals test_refraction_inside_sphere_normals test_texture_mapping_sphere_normals test_transparent_sphere_normals test_wine_glasses_normals tetrahedron_normals

Textures (10 required marks)

Implemented 10 out of 10 required marks and 5 elective marks.

Acceleration Techniques (0 required marks)

Implemented 6 elective marks.

Distributed Raytracing (0 required marks)

Implemented 5 elective marks.

Software Engineering (0 required marks)

Implement 4 elective marks.