Rasterization - PowerPoint PPT Presentation

1 / 45
About This Presentation
Title:

Rasterization

Description:

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL. Tree. Each pixel has a one-bit ALU ... First for stamp edge, are one or both probes inside all triangle edges? ... – PowerPoint PPT presentation

Number of Views:118
Avg rating:3.0/5.0
Slides: 46
Provided by: anselmo9
Category:
Tags: hill | one | rasterization | tree

less

Transcript and Presenter's Notes

Title: Rasterization


1
Rasterization
  • Anselmo Lastra
  • COMP290
  • Fall 2003

2
Administrative
  • When to have the final project presentations?

Last Class
Candidate days circled. Could go as late as 17th.
Last Day of Exams
3
Next Time
  • Hakura and Gupta, "The design and analysis of a
    cache architecture for texture mapping", ISCA
    1997.
  • Homan Igehy, Matthew Eldridge , Kekoa Proudfoot,
    "Prefetching in a texture cache architecture",
    Graphics Hardware 98 (HWWS).
  • Links on web page

4
Rasterization
  • Identify pixels/samples covered by a primitive
  • Generate fragment parameters
  • Z
  • Color
  • Normals
  • Texture coordinates
  • etc.

5
Outline
  • Historical order
  • Skip scan line rasterizer
  • Pixel-Planes
  • Pineda

6
Rasterization on Pixel-Planes
  • Processing built into frame buffer, a processor
    per pixel.
  • Each processor used linear expression, Ax By
    C, for each edge
  • 0 on edge, positive/negative indicate which side
  • Look at all edges to decide whether processor on
    or off

7
Enable All Processors
8
Edge 1
_

Ax By C
9
Edge 2
Ax By C

_
10
Edge 3
_

Ax By C
11
Depth and Color Interpolation
z F(x, y) and color F(x, y) for each of
red, green, and blue
12
Tree
  • Each pixel has a one-bit ALU
  • Henry came up with a clever way to parallelize
    the computation of Ax By C

ALUs
Memory
A, B, C
13
C3
C2
C1
C0
A1
A0
0
A3
0
A2
C0
C1
C0
C1A0
14
More Details
  • Actually 2 trees
  • one for A, the other for B
  • Each chip had a register to select starting x,y
    screen position
  • Supertree on each chip to compute what upper
    levels of tree would have done

15
Pinedas Approach
  • Extended edge equation approach to systems that
    did not compute all pixels in parallel
  • Incremental computation
  • Traversal

16
Different Formulation
  • Explicit formulas
  • E(x,y) (x-X) dY (y-Y) dX
  • Can compute incrementally
  • E(x 1, y) E(x,y) dY
  • E(x, y 1) E(x,y) dX
  • Test Ei for all edges i

17
Traversing the Polygon
  • Simplest way test pixels in BBox
  • Wasteful

18
More Efficient
  • Find top vertex
  • Begin to left of edge
  • How to find edge?
  • Has problems
  • Edge search next

19
Edge Search
  • Could step back into triangle when incrementing
  • Then need to search

20
Bidirectional Search
  • Must save context so can return to center line

21
Parallel Implementation
  • E is linear, so can compute incrementally for any
    offset
  • E(xL,y) E(x) L dY
  • for some horizontal offset L
  • Test block of pixels

22
Olano and Greer
  • First look at interpolation
  • Then pixel inclusion test
  • Caps (like X) non-homogeneous
  • Lower case (x) homogeneous

23
Interpolation
  • Parameter varies linearly
  • u a X b Y c Z (1)
  • In homogeneous coordinates
  • u a x b y c w (2)
  • Perspective-correct interpolation
  • u/w a x/w b y/w c a X b Y c
  • a, b, and c same in all eqns

24
Their Observation
  • From eqn (2)
  • u a x b y c w (2)
  • From u at each vertex, we can solve for a, b, and
    c

25
Implications
  • The matrix that needs to be inverted just the
    vertex coords
  • Then just one vector-matrix multiply for a, b, c
    for each param
  • No division by w!
  • So no problem when 0 or negative

26
Computational Cost
  • Perspective-correct params computed (u/w)
  • Need to also compute 1/w at each pixel
  • Then take reciprocal and multiply
  • (u/w) ? w

27
Scan Conversion
  • Compute pseudo-parameter
  • One thats positive on one side of vertex,
    negative on the other
  • Parameter thats zero at 2 verts of an edge, one
    at the third vert
  • So on side of triangle
  • Again test for 3 s

0

0
1
28
Matrix Inverse?
  • What if its not invertible?
  • Either triangle is edge-on, or very small
  • Didnt want to render it anyway

29
Precision
  • Black line is edge
  • Rounded to orange
  • Pixel centers sampled differently
  • Pixels that should have been on left side now on
    right
  • Can minimize with fractional bits

30
Frac Bits
  • Easy on Pixel-Planes tree
  • Just add cycles to computation
  • Configurable
  • On a pixel-parallel design would have to decide
    ahead of time

31
Snap to Grid
  • On Pixel-Planes we snapped vertices to a subpixel
    grid
  • 1/64th of a pixel
  • Choose fractional bits to guarantee numerical
    results

32
Another Issue
  • What to do about edges?
  • Edges that fall right on pixels
  • Rules to keep from rendering twice

33
Tiled Traversal
  • Texture or frame buffer caches that are
    rectangular (tiled) make sense
  • How can you traverse triangles in tiled order to
    make use of cache?
  • GH2000 paper by McCormack and McNamara

34
Stamps vs. Tiles
  • They first talk about stamps a rectangular
    block of candidate pixels tested at a time
  • Then they look at larger tiles (multiple of stamp
    size)

35
Stamp, here 2 x 4
  • Thin lines show pixel grid
  • X pixel sample point candidate fragment
  • Circle called probes sites tested for
    traversal (next)

36
Traversal
  • Test whether any part of stamp edge is in
    triangle
  • First for stamp edge, are one or both probes
    inside all triangle edges?
  • A single probe does not have to be in triangle
    (right)
  • Case where this is true, but triangle does not
    cross edge
  • Edge RT-RB above right

37
Second Test
  • Is stamp edge in bounding box?
  • Example at right RT and RB (together) inside
    all tri edges
  • Stamp edge crosses shadow of triangle

38
Note
  • Note that these stamp tests do not have to be
    correct, just conservative
  • False stamp movement just inefficient

39
Centerline Traversal
Circle RightSave Octagon - DownSave
  • Start at topmost vertex
  • Is right position valid?
  • If so, store context
  • Context edge functions, interpolated values at
    RT
  • Traverse left until not valid
  • If right was valid, restore context and traverse
  • Always looking for valid down position
  • If one found, save in down context
  • Go down after traversing whole line
  • Context not saved for invalid positions (L of 16)

40
Alternate Starting Position
  • They point out that starting at vertex on corner
    of BBox would eliminate need for rightSave
  • Only one sideways direction to move
  • Would then need to be able to traverse
    top-to-bottom or bottom-to-top

41
Alternate Traversal
  • Step to tiled traversal
  • Keep DownSave (octagonal) and UpSave (diamond)
  • When no more UpSave, pop DownSave

Diamond UpSave Octagon - DownSave
42
Tiling Traversal
  • Stamps visited by rows
  • Tiles visited by columns
  • Now need RightTileSave context in addition to
    UpSave and DownSave
  • Right to end of tile
  • Pop DownSave
  • Pop UpSave
  • Pop RightTileSave

Diamond UpSave Octagon DownSave Triangle
RightTileSave
43
Tiling Traversal 2
  • Phase 0
  • Right to end of tile, save next valid position in
    RightTileSave
  • Repeat phase 0 while DownSave is in tile
  • Phase 1
  • Trace right again, respecting right boundary
  • Now go up, but ignore up tile boundaries
  • Phase 2
  • Like phase 1, but go down
  • When reach bottom, go to Phase 0

Diamond UpSave Octagon DownSave Triangle
RightTileSave
White Phase 0 Rose Phase 1 Lavender Phase 2
44
Frame Buffer Tiling
  • FB divided into pages
  • Two bank checkerboard
  • Allows precharge other bank
  • Serpentine version of algorithm increases
    frequency of bank changes

45
Texture Cache Tiling
  • Texture cache a little different than frame
    buffer pages because uses texels from adjacent
    blocks
  • Paper also discusses metatiling, multiple levels
    of tiles
  • To stay in FB pages
  • And also increase use of texture cache
Write a Comment
User Comments (0)
About PowerShow.com