SoftGL:
Homework Assignment for COMP 236
This series of homework assignments have us implementing a software rendering
engine following the OpenGL pipeline. The purpose of this project was to make
us intimately familiar with the standard polygon rendering pipeline and the
technical problems that have to be solved to make it work.
The components of the software rendering that I implemented are:
3D Clipping
Feb. 12th, 2001
- Implement 3D clipping of a convex polygon in homogeneous coordinates.
homoclip_garber.hpp, homoclip_garber.cpp
Triangle Rasterization
Feb. 20th, 2001
- Implement a triangle scan conversion and Z-buffer visibility algorithm.
tri_raster_garber
Smooth Shading
April 2nd, 2001
- Augmenting our initial triangle rasterizer to allow smooth shading
color interpolation.
softgl_trirast_smooth_garber.hpp
softgl_trirast_smooth_garber.cpp
softgl_homoclip_smooth_garber.hpp
softgl_homoclip_smooth_garber.cpp
Lighting
April 11th, 2001
- Implementing OpenGL lighting in Software for the SoftGL system.
softgl_lighting.cpp
Discussion
1) When does your software rendering not match the hardware?
The biggest problem is when the triangle being rasterized is viewed at a
very oblique angle, so that it has a lot of variation in depth.
2) Why does your software rendering not match the hardware?
In the case mentioned above the software rasterizer uses linear interpolation
in screen space to interpolate the colors while the hardware seems to use
a more perspectively correct scheme. This gives the hardware version a more
realistic effect which includes the perspective foreshortening in color information
we naturally expect.
3) How can this be fixed?
This can be fixed by either computing the real camera space intervals taken
with every step across a scanline in screen space and using those to
do our color interpolation. Or (in case the previous option is too slow)
using some approximation with a simple function based on the original camera
space vertices of the triangle, so that we get close enough to perspectively
correct interpolation to fool the eye, while keeping the rasterization loop
relatively simple and fast.