Perspectively-Correct Color and Texture-Coordinate
Interpolation
COMP-236 : homework #6
Spring 2000
At this point, you have implemented the following for SoftGL:
-
2 homogeneous polygon clippers
-
2 triangle rasterizers
The goal in this assignment is to implement the following additions to
SoftGL:
For texture-mapping, you will need to implement the following variations:
-
clamp and repeat wrapping modes : Wrapping={0,1}
-
nearest and bilinear filtering: Filtering={0,1}
-
replace and modulate application modes: Function={0,1}
These flags will be passed into your texture-mapping triangle rasterization
routines.
In addition, in order to test your new implementations, write your own
mini-SoftGL (no API support) that tests out all of the clippers and rasterizers
using the above files and the following:
Here is the location of the complete source tree.
You will only need to modify the main.cpp file to implement your mini-SoftGL
pipeline. You will need to create some geometry, run the geometry through
a "Modelview" and "Projection" transformation pipeline, perform clipping,
perspective divide, and setup for perspectively correct interpolation.
This exercise will test your knowledge of how to organize the components
of the standard graphics pipeline in order to correctly transform, clip,
and render a scene. You will not be required to support any front-end OpenGL-like
API. Just implement enough to thoroughly test the components.
We will be integrating these new components into SoftGL later (after
the infrastructure has been built).
After completing and testing the new components in your mini-SoftGL,
do the following:
-
create and render a quadrilateral with a different color at each vertex
(RGB quad from previous tests). Compare the results for perspectively incorrect
and correct color interpolation for your triangle rasterizers using a perspective
projection with a 45 degree field-of-view for the following cases:
-
quad is perpendicular to the viewing direction and completely in the viewing
frustum
-
quad is at a 45 degree angle to the viewer (about the Y-axis - UP vector)
What is the difference? Why?
-
repeat the previous test, but using a checkboard texture-mapped quadrilateral
-
explain the steps in obtaining a perspectively-correct screen-space interpolation
of vertex values. Why does this work? Is the depth (or z values) perspectively
correct? Why or why not? Does it matter? Why?
-
use your mini-SoftGL to generate a single interesting, high-resolution
(1600x1200) image using all of your new components. This image should focus
on showing the different texturing options. Everything should be rendered
with a perspective projection with perspectively-correct interpolation.
Turn in the answers to these questions on paper and email the location
of the new files (including your mini-SoftGL) and the final image. Please
have a readme file explaining the effects shown in the image.