13
Accumulation Buffer Algorithm
•Allows us to successively render multiple “scenes” and have them additively blend as we go. Each image ends up with an equal weighting of 1/n, where n is the number of samples taken.
•
•(Appendix A in project 2 handout)
•Let "canvas" and "temp" be 24-bit pixel arrays. Let "polygon color" be a 24-bit color unique to each polygon.
•
•1   clear canvas to black;
•2   n = 0  (number of samples taken so far)
•3   for (i=1; i<=s; i++)  (for s subpixel positions)
•4      for (j=1; j<=t; j++)  (for t fractional frame times)
•5         clear temp to black
•6         n = n + 1
•7         for each polygon
•8            translate vertices for this subpixel position and fractional frame time
•9            for each pixel in polygon (using your scan converter)
•10              temp color <-- polygon color
•11        for each pixel in canvas
•12           canvas color <-- canvas color + temp color
•13  canvas color <-- canvas color / n
•14  convert canvas to 8x3 bits and display on screen (by exiting from your rasterizer)