Project3Fall13

From Immersive Visualization Lab Wiki
Revision as of 11:13, 12 October 2013 by Jschulze (Talk | contribs)

Jump to: navigation, search

Project 3: Rasterization

In this project you will need to implement your own software rasterizer. This means that you are going to implement the entire graphics pipeline from 3D vertices to filled triangles in a software frame buffer yourself. We provide a code template for the interface between your software rasterizer and OpenGL, which is needed to display the frame buffer on the screen.

This assignment is due Friday, October 18th. It will be discussed by TA Matteo on Monday, October 14th at 3pm in Center Hall 105.

This assignment is currently under construction. Feel free to start working on it, but it won't be finalized until early afternoon on Oct 12th when this message will have disappeared.

We provide a code template for you which displays a software frame buffer on the screen. Your task is to rasterize your scene (described below) into this frame buffer. Throughout this assignment do not use any OpenGL routines which aren't already in the base code! Instead, use your own vector and matrix classes from assignment #1 and add your own rasterization code.

1. Rendering Vertices (30 points)

The goal of the first step towards building your software rasterizer is to project vertices of given geometry to the correct locations in the output image (frame buffer). Use the house geometry from homework assignment 2 as your geometry.

You can re-use your model (M), camera (C), and projection (P) matrices from the previous assignment. Add a viewport matrix (D). Implement a method to set the viewport matrix based on the window size (window_width and window_height) and call it from the reshape function. Your program must correctly adjust projection and viewport matrix, as well as frame buffer size when the user changes the window size. Correctly means that the house needs to remain centered in the window and get uniformly scaled to match the window size. (5 points)

Then write a method to rasterize a vertex. You can use drawPoint from the base code to set the values in the frame buffer. Call this method from the draw callback (display function in base code) for every vertex in the sample scene. For this part of the assignment, create a method rasterizeVertex which projects each vertex of the house to image coordinates and sets the color of the corresponding pixel to white using drawPoint. (15 points)

To verify that your implementation is correct, use the same values for camera and projection matrix as in Image 2 of Exercise 1c of homework assignment 2, and compare the result of your rasterized vertices to that image. (10 points)