We were able to create hardware that would take and draw polygons, and a microcontroller that most works with perspective transforms. We reached 20 fps with one polygon, and have 10 fps with decent quality and little artifacting with six moving polygons.
We used Terasic verilog code for the subunits like the VGA controller, and Bruce Landís template for the overarching structure. The math was found in the public domain, which we converted to Matlab to test concepts. Finally we had to convert our Matlab code to C and verilog.
Unresolved issues that we faced were a lack of memory to hold a large Z-buffer and a second large buffer to hold a copy of SRAM for the VGA to read to. Had we more available memory, we certainly could have seen higher refresh rates and less noise on screen. Secondly, faster polygon calculations could have been attained by streamlining our code more, or perhaps adding a second, dedicated microcontroller to perform floating point calculations. In the end, we decided against this approach because of time and size constraints.
Our final output worked well, however. We met our expectations in a number of area of design. Our hardware did Z-buffering and depth calculations beautifully. The only benchmark it fell short on was speed, and that was mainly due to a lack of memory. On the microcontroller side, we were able to mostly get the perspective transforms working.. though, once again, the speed at which it was calculating left something to be desired.
Features that we had planned on adding, but later abandoned due to time constraints were texturing and lighting. Since textures could be loaded into flash memory, it was not infeasible to map the textures onto the polygon. Compared to the mathematical work invovled in depth and point-inside-polygon calculations, it would not have taken too much additional logic. Similarly, lighting would only require a calculation from the point to nearby lightsources to figure out how much to lighten or darken the pixel. Both of these features would really have just been modifications to the data being outputted, and can be performed in the future as extensions to this core. Either addition would require very little change to the pipeline itself.
Our ultimate goal of this project was to create a system that could allow a programmer to make a very simple 3-D game, and let supporting software and hardware perform all the perspective and VGA work needed. While we were not really able to implement a full game, a programmer could spin or move around in a three-dimensional room with very little computation on the user-end of things.
CS559: Computer Graphics at University of Wisconsin, lectures 10-12
Rogers, David. Procedural Elements for Computer Graphics. New York: 1985.
Determining Whether A Point Is Inside A Complex Polygon. http://alienryderflex.com/polygon. Last accessed 30 November 2007.
Sutherland-Hodgman Polygon Clipper. http://hpcc.engin.umich.edu/CFD/users/charlton/Thesis/html/node90.html. Last accessed 30 November 2007.