1 / 12

Scan Conversion

Scan Conversion. Scan Conversion. Last step in the graphics pipeline Efficiency is a central issue Common primitives Lines (done last class) Polygons (fill polygons, today) Circles Hardware implementations preferable. Filling Polygons: Scan Line Algorithm. 14. 12. 10. 8. 6. 4. 2.

kalil
Download Presentation

Scan Conversion

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Scan Conversion

  2. Scan Conversion • Last step in the graphics pipeline • Efficiency is a central issue • Common primitives • Lines (done last class) • Polygons (fill polygons, today) • Circles • Hardware implementations preferable

  3. Filling Polygons:Scan Line Algorithm 14 12 10 8 6 4 2 0 0 2 4 6 8 10 12 14

  4. 14 12 10 8 6 4 2 0 0 2 4 6 8 10 12 14 Filling Polygons:Special Cases Edge Table (ET) Entry

  5. 11 10 9 8 7 6 5 4 3 2 1 0 Scan Line Polygon Fill Algorithm N N 14 N D 12 N EF DE F 10 -5/2 6/4 N 9 7 7 12 CD N 8 N 12 13 0 E 6 C FA N 4 N 9 2 0 A 2 N AB BC B 0 6/4 N -5/2 7 3 7 5 0 2 4 6 8 10 12 14 N Scan Line

  6. AET • AET at scanline y=8 • AET at Scanline y =9 ET Record format : (Ymax, Xmin, 1/m) AET Records format: (Ymax, Xcurrent, 1/m)

  7. Scan Line Polygon Fill:The Algorithm • Set y to smallest y coordinate that has an entry in ET • Initialize the active edge table (AET) to empty • Repeat until the ET and AET are both empty: • Move from ET bucket at y to AET those edges whose ymin = y. (entering edges) • Remove from AET those edges for which y = ymax. • Sort AET on x • Fill in desired pixels on scan line using even-odd parity from AET • Increment y by one (next scan line) • For each edge in the AET, update x by adding Dx/Dy

  8. What color to fill? Recall Shading in OpenGL:Smooth Shading Requested by: glShadeModel(GL_SMOOTH); Lighting calculations will be done at each vertex using the material properties, and the vectors v and lcalculated for that vertex. Bilinear interpolation is used to determine color values in the interior of the polygon.

  9. Bilinear Interpolation • Cp = ? • Cq= ? • Ck = ? • Xa Ya, Xb, Yb, Xk, Yk • Need to calculate Xp, Xq. • Cp, Cq, Xp, Xq can all use incremental methods • Rate of color change!! C

  10. Using Incremental Methods • Cx • Cx+1 = Cx + (Cp –Cq)/(Xq-Xp)

More Related