Introduction to Computer Graphics 05

Document Sample
Introduction to Computer Graphics 05 Powered By Docstoc
					Introduction to Computer Graphics 05
●
    Full Screen Anti-Aliasing
●
    Photo-Effects and other stuff we cannot do.
●
    Vertex and Fragment programming.
●
    Curves and Splines.
Screen based Antialiasing
●
    FSAA
●
    Quincunx method
●
    Accumulation buffer
●
    A-buffer
●
    T-buffer
●
    Stochastic sampling
●
    See RTR 4.4.2
Full Screen AntiAliasing (FSAA)
●
    Supersampling: render at 2x, 4x or higher
    resolution in a back buffer, then average
    (low pass filter).
●
    Sends geometry only once, but uses 2x,
    4x,... more framebuffer RAM.
Nvidias quincunx method
●
    Uses 2x memory bandwidth (fill rate), but
    simulates 4x AA by re-using samles.
●
    Generates image1 offset (0,0) pixel (centers)
    and image2 offset (0.5, 0.5) pixel (corners).
●
    The corner samples are re-used in 4
    neighboring pixels.
●
    Weights ½ and 1/8.
Accumulation buffer
●
    Use a accumulation buffer the size of the
    output image, but at higher precision (uses
    more memory)
●
    Draw scene several times, each time shifting
    the viewpoint eg. 0.25 pixel.
●
    Sum the contributions from each pass and
    divide (box filter), or use better filter.
●
    Uses more geometry bandwidth.
●
    Supported in OpenGL (slow).
The 3dfx T-buffer
●
    Has several hardware screen buffers in
    parallel: uses more memory and fill rate
●
    Can rasterize in hardware into several of
    these at once.
●
    Use special video hardware to combine the
    buffers into a displayed image.
●
    Does not use extra geometry bandwidth.
Carpenters A-buffer
●
    Multisampling.
●
    Rasterize locally at sub-pixel precision (eg.
    4X4 or 8x8), and compute per-pixel
    coverage mask. Save this bitmask per pixel
    in the A-buffer. Keep multiple such fragment
    converage masks per pixel!
●
    Use coverage masks to modulate the color.
●
    Basic A-buffer good for edge AA, but not for
    texture AA, only one texture sample/pixel.
Stochastic sampling
●
    Fixed sub-pixel sampling patters can also
    yield artifacts: repeated patterns across the
    screen.
●
    Stochastic sampling uses random sub pixel
    patterns instead.
●
    Even more hardware intensive.
Room for improvement
●
    All of the above AA algorithms typically use
    box filters, except the quincunx method
    (approx. tent filter).
Buzz Break
●
    Explain 3 kind of AA techniques to your
    mate.
●
    Which kind of AA technique would you want
    ot implement?
Transparency Overview
●
    Alpha values
●
    Alpha buffer
●
    The [over] operator
●
    Sorting for transparency
●
    See RTR 4.5
Alpha values
●
    Used to represent the “ opaqueness” of
    materials. Alpha = 1 means fully opaque,
    alpha = 0 means fully transparent (invisible).
●
    How would you use this to render semi-
    transparent materials?
●
    How to combine the semi-transparent color
    with the opaque background?
Alpha Buffer
●
    Let each pixel in the back buffer have not
    only a RGB value and a depth value, but
    also a transparency value. (called
    “ destination alpha” ).
●
     If we're rendering front-to-back we can use
     the stored alpha with the [under] operator.
●
     The alpha buffer can also be used to store
     coverage values for polygon and line AA.
Blending Operators
●
    [over]: Cd = AsCs + (1-As)Cd
●
    [min]: Cd = min(Cs, Cd) componentwise
●
    [max]: Cd = max(Cs, Cd)
●
    [under]: Cd = (1-Ad)Cs + Cd
●
    [in]: Cd = AdCs “ stencil then image”
●
    Many more, see glBlendFunc,
    glBlendEquation, and glBlendColor man-
    pages, and Foley&van Dam 17.6 pp. 835.
The [over] operator
●
    Note that (A [over] B) is not the same as B
    [over] A:
●
    A [over] B = AaCa + (1-Aa)Cb
●
    B [over] A = AbCb + (1-Ab)Ca
●
    Unless Aa = Ab = 0.5.
●
    Note also that semi-transparent objects
    should not affect the Z buffer as you can see
    the objects behind.
Transparency Sorting
●
    Because the [over] operator is order
    dependent we should sort the semi-
    transparent fragments going to a pixel so
    they can be blended correctly.
●
    Ordinary hardware does not do this.
●
    The SGI InfiniteReality system does this
    together with an A-buffer.
Sorting Geometry
●
    We can attempt to sort the geometry (only
    the semi-transparent objects) back-to-front,
    but remember the Painters algorithm.
●
    Then render the opaque objects with Z
    buffering, write-protect the Z buffer, and
    render the semi-transparent parts back-to-
    front.
Transparency Sorting 2
●
    We could sort per pixel:
●
    If a fragment f at x,y passes the depth test
    –   if f is opaque
         ●
             write pixel and update depth buffer
    –   else
         ●
             put fragment with depth into a depth-sorted list per
             pixel.
●
    In a final pass over the buffer collapse the
    lists using the [over] operator in back-to-front
    order.
Buzz Break
●
    How will you implement transparency
    support in your renderer?
●
    Can we do better than a sorted list per pixel?
●
    How much memory will this require?