Assignment 1
Assignment 2
Project
Assignment 1 : Simplified rendering pipeline
Overview
In this assignment, you will be implementing a simplified 3D rendering pipeline (with flat 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)
The assignment will be given in two parts, corresponding to the lecture schedule.
Code
Skeleton code is now available on ilearn.ucr.edu. Once you have gone to the
CS230 area of ilearn, click on "Course Materials" to obtain the tar file. If you have trouble obtaining the code via
ilearn because you are auditing, please send me an email and I will send the code to you.
Submission Instructions
The assignment is due Monday, Jan. 30, 11:59pm. Your assignment is to implement the functions in minigl.cpp. To submit your assginment, email me with:
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.
Assignment 2 : Ray Tracing
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. Once you have gone to the CS230 area
of ilearn, click on "Course Materials" to obtain the tar file. If you have trouble obtaining the code via ilearn
because you are auditing, please send me an email and I will send the code to you.
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, and shading, and the 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 Wednesday, Feb. 22, 11:59pm. To submit your assginment, email me with:
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.
Extra Credit
There are several options for extra credit:
1. Implement texture mapping. E.g., map a checkboard texture onto the ground plane.
2. Implement environment mapping. Use a background image for the environment and render a scene where we can see the
reflection of the background image in a reflective surface, or
3. Implement a transparent shader.
You can earn up to 15% and 25% extra credit on the assignment for implementing one and two of these, respectively.
Project
There are several steps in the project:
1. Preproposal: Monday, Feb. 20. Submit short paragraph with the main idea for the project by email. This should be
a concrete idea, but the main details of the project will be in the full proposal. I will give feedback and any changes
should be agreed by Wed. You may email me well before Monday, Feb. 20 to discuss possibilities if you like. You can
also submit more than one idea. People working in groups of 2 can send one email indicating who the team members are.
2. Proposal: Monday, Feb. 27. 2-3 pages. List the group (1-2 people). Give detailed background on the problem.
Enumerate the concrete project goals and deliverables.
3. Project: Thursday, Mar. 22. Our final exam period will consist of presentations about the projects. You will
also submit a write-up about the project.