Assignment 4 - Ray Tracer Phases
Introduction
As you know, the ray tracer is best built in stages.
The following provides guidelines for expanding your original ray tracer to
complete the requirements for Assignment 4.
Try to complete each phase before moving to the next one.
Phase 1
included in this phase:
- add LIGHT_T with single field loc
- initialize fields in objs array (in main) with new values
- update trace to handle multiple objects
- save closest_t, closest_int_pt, closest_normal, closest_object_index
- update parameters to illuminate
- add #define NUM_OBJS 2 in rt.h to use for size of objs array
Phase 2
code updates only
included in this phase:
- reorganize source code
- create light.h/light.c, sphere.h/sphere.c
- include .h files where needed in other .h/.c files
- provide header guards to avoid multiple inclusion
- add code to write directly to a file instead of capturing std output
Phase 3
included in this phase:
- add new PLANE_T and plane intersection function
- create OBJ_T with fields:
- single char type ('s' - sphere; 'p' - plane)
- union with either sphere or plane
- color
- checkerboard (int for true/false)
- color2 (for checkerboard)
- set blue background color (0.3, 0.3, 0.5)
- add plane with (0, 1, 0) normal and D = 0.9, color: (1.0, 1.0, 1.0)
Phase 4
code updates only
included in this phase:
- implement dynamic objs array created with malloc
- create init function to set sphere and plane values
- add function pointers to OBJ_T and call in trace (remove type from obj_t)
Phase 5
included in this phase:
- add checkerboard pattern for plane
- pass full object (or entire objs list) to illuminate
- implement light attenuation
- add vec_len to vp.h/vp.c
Phase 6
included in this phase:
Phase 7
included in this phase:
- add SCENE_T with the following fields
- objs list moved inside
- light moved inside
- start_x, start_y object space locations for changing aspect ratio
- pix_size for column and row increments
- implement arbitrary aspect ratio
image in 1920x1080 HD resolution