Homework 6: Depth Conversion of 3D Triangles


Tasks

  1. For the first task, we changed our polyFill algorithm to use a Z-buffer to correctly overlap polygons. We added calculations for dzPerColumn, dzPerScan, and zIntersect. When a pixel was plotted, these variables were used to calculate the current depth of the polygon. If the depth was less than the corresponding depth in the z-buffer, the pixel was plotted and the z-buffer location was updated.
  2. The first required image was a couple of intersecting triangles:
  3. For our extension, we integrated the Z-buffer algorithm with our hierarchical modeling system and made a pretty animated picture:

Questions

  1. How can you/did you connect your Z-buffer algorithm with the rest of your 3D modeling system?
    We added a z-buffer to our image structure and altered the polyFill function to check it before rendering each point. To change other primitives, we'd just have to add in checks for them, too (which also involves keeping track of the current Z value of the primitive).
  2. Is there any problem with using a linear representation of depth across a polygon? When does it matter?
    Since we limit ourselves to using triangles, it doesn't matter for us. However, if we used polygons with more corners, problems arise when the vertices don't lie all in the same plane. Then, the interpolation across a polygon shouldn't be linear, but it's not clear what it should be, either. It could be several linear fits between vertices, or it could be something like a spline fit.
  3. What extensions did you do for this assignment, how did you do them, and how well did they work?
    We integrated our z-buffer algorithm with our hierarchical modeling system. It works just fine. We added a z-buffer to our image structure, and put in calculations for dzPerCol, dzPerScan, and zIntersect in our polyFill algorithm. When polyFill tries to plot a pixel, it first checks to see if its z-value is less than the z-value on the z-buffer (which is initialized to infinity). If it is, it plots it and updates the buffer. If not, it doesn't. We also made the pretty animation above.