Ray Tracer
Graphics Pipeline
Project


Ray Tracer

Description

In this assignment, you will implement a basic ray tracer. The images above depict the 4 test images you code will be able to produce. The images depict flat shading, phong shading, addition of shadows, and addition of reflections.

Code

Skeleton code is available on ilearn.ucr.edu. If you have trouble obtaining the code via ilearn, please send me an email.

There are 4 files:
1. main.cpp: You do not need to modify this file.
2. ray_tracer.h: This contains the declarations for the classes and methods you will need to implement.
3. ray_tracer.cpp: This is where you should write your implementation.
4. Makefile

The methods that you need to implement are marked with 'TODO' in the code. A code skeleton and driver framework is provided. You will need to implement object intersections, shading, and ray casting.

To run the tests, you run
./ray_tracer < test number >
where test number is 1-4.

You can implement the tests in order:
Test 1: You will need to set up the basic infrastructure for this test, but the flat shader will suffice. You also do not need to do any shadow or reflection rays for this test.
Test 2: Here you will add the Phong Shader. The phong shading will depend on the lighting, so you will need lights.
Test 3: In this test you will generate shadows by casting shadow rays.
Test 4: Here you will make your ray tracer recursive. You will implement the Reflective_Shader and cast reflection rays.

Submission Instructions

The assignment is due Oct. 28, 5:00pm. Submit the following via ilearn:
1. your implementation of 'ray_tracer.cpp'
2. a file called 'documentation.txt' that gives a very brief explanation of how you implemented each function.


Simplified rendering pipeline

Overview

In this assignment, you will be implementing a simplified 3D rendering pipeline (with smooth shading). This will consist of several parts:
1. vertex and viewing transformations
2. rasterization
3. using a z-buffer for hidden surfaces
4. clipping (Optional; extra credit)

Code

Skeleton code is available on ilearn.ucr.edu.

Submission Instructions

The assignment is due Nov. 20, 5:00pm. Your assignment is to implement the functions in minigl.cpp. Submit the following:
1. your implementation of minigl.cpp
2. a file called documentation.txt that gives a very brief explanation of how you implemented each function.

Software Framebuffer

You will have a software framebuffer that stores both a 2D array of pixel colors and a 2D array of z (depth) values. Your rasterization routine will write into this software framebuffer.

Rasterization and z-buffer depth test

Implement a routine that draws a filled triangle specified by three vertices into your software framebuffer. You can assume that the vertices are given in device coordinates, so that the z value is the depth value from the near viewing plane. The routine should write its result to the software framebuffer, doing the appropriate z-buffer check.

Clipping (Optional; extra credit)

If you don't want to implement clipping, you can just rasterize all primitives and check that the mapped pixel value is a valid one before writing into the framebuffer. Clipping is an optimization which avoids unnecessarily processing geometry that is outside the view volume. Implement a routine clips a triangle against a rectangular box, generating 0, 1, or more triangles as a result. You can assume that the box is axis-aligned with a Cartesian grid.

Vertex and viewing transformations

Similar to OpenGL, you will maintain both a projection matrix stack and a modelview stack. When the user draws a vertex you will apply the modelview and projection ( projection * (modelview * vertex) ) to obtain the transformed geometry. You will then store this transformed geometry for rasterization. The reason for this is that the transformations are part of the current state and will not necessarily persist. You may find this link helpful: OpenGL Transformation


Project

Past and possible topics