Courses‎ > ‎Computer Graphics‎ > ‎Konstantinovich‎ > ‎

2019-04-09 ScanLine-ZBuffer

posted Apr 10, 2019, 12:14 PM by Konstantinovich Samuel   [ updated Apr 10, 2019, 12:15 PM ]
Add scanline conversion and z-buffering to your graphics engine.
  • Parser Note:
    • In the previous assignment, I noted that the clear command was no longer needed, because we immediately clear the polygon/edge matrix after a shape is drawn. In order to test Scanline conversion on multiple shapes, a different version of clear is useful. Now, clear will clear the screen and zbuffer, allowing us to reset and test multiple shapes in the same script. 
    • I have added this command to the provided source code, but everyone should implement it.
  • Scanline conversion
    • Create a new function that handles the scanline conversion.
    • Call this in your draw_polygons function.
    • Make sure that you change color values for each triangle.
  • z-buffering
    • In the base files provided, I've added a z-buffer argument to the necessary functions, but have not done anything with it.
    • The z-buffer should only be modified in your plot function, or when clear_zbuffer is called.
    • You will need to calculate z values in both scanline_convert and draw_line.
      • Your z values are not limited to the integers.
GitHub repository:
mks66-solids
Comments