Ben Newton - Rasterization
The source code for Part I and Part II of the assignment is in a zip
For Part I of the assignment I wrote a program that could transform the
given vertices into fragments, and then rasterize the lines and
triangles to the output image. The image below shows that the
color of each vertex is interpolated across the triangle.
This example image demonstrates the ability to handle multiple
I didn't implement any of the extra credit options for part 1.
My program basically scans the input file, and produces a vector of
triangles and a vector of lines. A loop then trasforms the
vertices for a triangle or line, and then calles the RasterizeTriangle
or RasterizeLine method passing it the Triangle and the ImageBuffer.
These methods set the appropriate pixels to the correct values.
I used some of the Triangle, Vertex, etc code from the ray
tracing assignment as a starting place for model representation.
I created a new Matrix class for performing transformations.
Also for Part I, I implemented the same rasterizer in Open GL.
The code is included in the zip archive above, as GLTri2. The
following is a screenshot from the Open GL implementation.
For part II, I introduced Z buffering, and shading.
I implemented only orthographic viewing. Below are images of
several large models which I rasterized with my program:
The design of my program is much the same as that for Part I, except
that I introduced the z buffer, and included the Z values in the
transformation matrices, and vertices.