CS 5620: Computer Graphics

Wireframe Renderer

You may work in pairs.

In this assignment you will develop the first part of a 3D rendering pipeline which renders a scene of 3D models in wireframe (edges only). The emphasis in this assignment is on the implementation and manipulation of coordinate systems, transformations, and basic line scan-conversion.

If you would like to see an example of the first assignment, try this:

assignment1-osx.zip
assignment1-linux64.tar.gz

We will provide a code skeleton for your renderer. The skeleton is only a suggestion and you may change its structure or ignore it completely. You will be working primarily with seven classes/files:

  • canvas.h/canvas.cpp This is the renderer. Here you should implement all of the coordinate transformations, the rasterization algorithms, and buffer management. As you will realize in the future, this emulates a small subset of the OpenGL functionality.
  • scene.h/scene.cpp This class manages the 3D objects and other required entities. It facilitates rendering of multiple objects and cameras and their normals.
  • object.h/object.cpp This is the object base class. Here you will implement their rendering methods.
  • model.h/model.cpp Here you will implement the methods necessary to load .obj and .mtl data files.
  • primitive.h/primitive.cpp Here you will "hardcode" a few basic primitive shapes.
  • camera.h/camera.cpp This class manages the camera and its movement around the 3D world.
  • main.cpp Main handles the GUI and interfaces everything with glut.

We will also provide a few convenient classes that you may use. They provide support for some of the basic mathematical functionality you will need, the documentation for which is provided in the references section.

  • core/vector.h A basic vector class.
  • core/matrix.h A basic matrix class.
  • core/geometry.h Some typedefs to make your life easier.
  • core/color.h A set of constant variables that define the colors of the rainbow in RGB values.

The skeleton is provided as a GIT repo. If there are any bugs in the skeleton, they will be fixed here and an announcement will be posted in the Announcements section. The skeleton is located here:

git clone https://github.com/cornell-cs5620/skeleton.git

If you see that there has been a bug fix in the Announcements section, make sure to run the following and merge in the changes.

git pull

Requirements

All of the requirements for this assignment are listed in the comments of the skeleton and labelled "TODO Assignment 1". Make sure you cover them all. The following is a summary of those TODO's.

  1. Canvas
    • Implement all of the matrix transformation functions (movement, projection, etc).
    • Implement basic vertex and fragment shaders. Vertex shaders are responsible for transforming a 3D vertice into window coordinates, and fragment shaders are responsible for determining the final color of a pixel.
    • Implement a line scan-converter using Bresenham's algorithm.
  2. Scene
    • Render all of the objects and cameras.
  3. Object
    • Render the object.
    • Render the bounding box of the object.
    • Render a representation of the per vertex normals and the per face normals.
  4. Primitive
    • Implement methods to generate a box, a cylinder, and a pyramid. The method to generate a sphere is given to you.
  5. Camera
    • Be able to move and orient the camera in first person view and in orbit (focus) around an object.

Submission

The submission deadline is September 28th 2015 at 10:00am. Submission involves a face-to-face session with Ned. We will schedule timeslots for the sessions, which will last up to 20 minutes, during which you will present your work and answer questions. Your grade, which is 20% of your final course grade, will reflect your effort in solving the problems posed by the assignment in terms of software engineering, performance, and completeness.

Grading

You will be graded on your implementation of three basic algorithms and features. The grade for each is split into three: Correctness, Performance, and Readability. A good score in Correctness means that you implemented the correct algorithm, all of the corner cases for the algorithm are covered and the algorithm has no errors. A good score in Performance means that you took the time to optimize your code, it runs decently fast on an i7, and there is no glaring issue (like a recursion depth of hundreds of thousands). A good score in Readability means that your code is well architected, is easy for me to read and is well documented. The grading rubric will be posted upon assignment.

CorrectnessPerformanceReadabilityTotal
Bresenham's12%12%6%30%
Transformations18%18%9%45%
Primitives10%10%5%25%
Total40%40%20%100%

Final Notes

  • DO NOT use any external code or borrow code from friends, family or colleagues without permission. If in doubt, please contact Ned. If you do use external code - please cite the source clearly. Plagiarism of any kind will not be tolerated!
  • You are welcome and encouraged to experiment with your program and add features. Previous experience shows this assignment can be addicting! Impressive extra features can earn you a bonus in your grade.
  • You have ample time to complete this exercise, but do not wait until the last moment. You are strongly encouraged to start working on it immediately.
  • We are aware that this assignment can be intimidating, and possibly one of the largest assignments you will encounter during your studies. You are welcome to come ask us if anything is not clear. We will periodically publish hints and advice on the Web site and by email.