Real-Time Graphics Architecture

Similar documents
8/5/2012. Introduction. Transparency. Anti-Aliasing. Applications. Conclusions. Introduction

Scan line algorithm. Jacobs University Visualization and Computer Graphics Lab : Graphics and Visualization 272

Computer Graphics. Attributes of Graphics Primitives. Somsak Walairacht, Computer Engineering, KMITL 1

Computer Graphics. Chapter 4 Attributes of Graphics Primitives. Somsak Walairacht, Computer Engineering, KMITL 1

Parallel Triangle Rendering on a Modern GPU

CS4620/5620: Lecture 14 Pipeline

Real-Time Graphics Architecture

Z 3 : An Economical Hardware Technique for High-Quality Antialiasing and Order-Independent Transparency

Real-Time Graphics Architecture

COMP371 COMPUTER GRAPHICS

POWERVR MBX. Technology Overview

Sampling and Monte-Carlo Integration

Buffers, Textures, Compositing, and Blending. Overview. Buffers. David Carr Virtual Environments, Fundamentals Spring 2005 Based on Slides by E.

Parallelizing Graphics Pipeline Execution (+ Basics of Characterizing a Rendering Workload)

CS559: Computer Graphics. Lecture 12: Antialiasing & Visibility Li Zhang Spring 2008

Filtering theory: Battling Aliasing with Antialiasing. Department of Computer Engineering Chalmers University of Technology

Lecture 9: Deferred Shading. Visual Computing Systems CMU , Fall 2013

Real-Time Graphics Architecture

Soft shadows. Steve Marschner Cornell University CS 569 Spring 2008, 21 February

Filtering theory: Battling Aliasing with Antialiasing. Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology

Aliasing. Can t draw smooth lines on discrete raster device get staircased lines ( jaggies ):

The simplest and most obvious method to go from a continuous to a discrete image is by point sampling,

GeForce4. John Montrym Henry Moreton

Real-Time Buffer Compression. Michael Doggett Department of Computer Science Lund university

Parallelizing Graphics Pipeline Execution (+ Basics of Characterizing a Rendering Workload)

Page 1. Area-Subdivision Algorithms z-buffer Algorithm List Priority Algorithms BSP (Binary Space Partitioning Tree) Scan-line Algorithms

Pipeline Operations. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 11

COMPUTER GRAPHICS COURSE. Rendering Pipelines

28 SAMPLING. ALIASING AND ANTI-ALIASING

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Lets assume each object has a defined colour. Hence our illumination model is looks unrealistic.

Advanced Shading and Texturing

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Shadow Techniques. Sim Dietrich NVIDIA Corporation

Discrete Techniques. 11 th Week, Define a buffer by its spatial resolution (n m) and its depth (or precision) k, the number of

Morphological: Sub-pixel Morhpological Anti-Aliasing [Jimenez 11] Fast AproXimatte Anti Aliasing [Lottes 09]

Theoretically Perfect Sensor

PowerVR Hardware. Architecture Overview for Developers

CS452/552; EE465/505. Clipping & Scan Conversion

Pipeline Operations. CS 4620 Lecture 14

Hidden surface removal. Computer Graphics

Parallel Rendering. Johns Hopkins Department of Computer Science Course : Rendering Techniques, Professor: Jonathan Cohen

Theoretically Perfect Sensor

CS 543: Computer Graphics. Rasterization

The Traditional Graphics Pipeline

Drawing Fast The Graphics Pipeline

Drawing Fast The Graphics Pipeline

Pipeline Operations. CS 4620 Lecture 10

Acknowledgement: Images and many slides from presentations by Mark J. Kilgard and other Nvidia folks, from slides on developer.nvidia.

Last Time: Acceleration Data Structures for Ray Tracing. Schedule. Today. Shadows & Light Sources. Shadows

Topic #1: Rasterization (Scan Conversion)

Rendering Grass Terrains in Real-Time with Dynamic Lighting. Kévin Boulanger, Sumanta Pattanaik, Kadi Bouatouch August 1st 2006

CSCI 420 Computer Graphics Lecture 14. Rasterization. Scan Conversion Antialiasing [Angel Ch. 6] Jernej Barbic University of Southern California

Fall CSCI 420: Computer Graphics. 7.1 Rasterization. Hao Li.

CS 563 Advanced Topics in Computer Graphics QSplat. by Matt Maziarz

3D Rasterization II COS 426

Computer Graphics. - Rasterization - Philipp Slusallek

Real-Time Graphics Architecture

Rasterization. Rasterization (scan conversion) Digital Differential Analyzer (DDA) Rasterizing a line. Digital Differential Analyzer (DDA)

The Traditional Graphics Pipeline

Pipeline and Rasterization. COMP770 Fall 2011

Drawing a Triangle (and an introduction to sampling)

PowerVR Series5. Architecture Guide for Developers

CS130 : Computer Graphics Lecture 2: Graphics Pipeline. Tamar Shinar Computer Science & Engineering UC Riverside

DEFERRED RENDERING STEFAN MÜLLER ARISONA, ETH ZURICH SMA/

Drawing a Triangle (and an Intro to Sampling)

Renderer Implementation: Basics and Clipping. Overview. Preliminaries. David Carr Virtual Environments, Fundamentals Spring 2005

Real-Time Rendering (Echtzeitgraphik) Dr. Michael Wimmer

Rendering. Converting a 3D scene to a 2D image. Camera. Light. Rendering. View Plane

Standard Graphics Pipeline

Rasterization Overview

Advanced Ray Tracing

Real-Time Reyes: Programmable Pipelines and Research Challenges. Anjul Patney University of California, Davis

The graphics pipeline. Pipeline and Rasterization. Primitives. Pipeline

Lecture 6: Texturing Part II: Texture Compression and GPU Latency Hiding Mechanisms. Visual Computing Systems CMU , Fall 2014

Lecture 6: Texture. Kayvon Fatahalian CMU : Graphics and Imaging Architectures (Fall 2011)

Lecture 13: Reyes Architecture and Implementation. Kayvon Fatahalian CMU : Graphics and Imaging Architectures (Fall 2011)

Shadow Rendering EDA101 Advanced Shading and Rendering

Surface shading: lights and rasterization. Computer Graphics CSE 167 Lecture 6

Shadows in the graphics pipeline

Graphics Performance Optimisation. John Spitzer Director of European Developer Technology

CS230 : Computer Graphics Lecture 4. Tamar Shinar Computer Science & Engineering UC Riverside

Reading. 18. Projections and Z-buffers. Required: Watt, Section , 6.3, 6.6 (esp. intro and subsections 1, 4, and 8 10), Further reading:

Triangle Rasterization

CS488. Visible-Surface Determination. Luc RENAMBOT

Rasterization. CS4620 Lecture 13

FROM VERTICES TO FRAGMENTS. Lecture 5 Comp3080 Computer Graphics HKBU

CS 431/636 Advanced Rendering Techniques

Rasterization and Graphics Hardware. Not just about fancy 3D! Rendering/Rasterization. The simplest case: Points. When do we care?

Sampling, Aliasing, & Mipmaps

Visibility: Z Buffering

COMP30019 Graphics and Interaction Scan Converting Polygons and Lines

Level of Details in Computer Rendering

CSE 167: Introduction to Computer Graphics Lecture #9: Visibility. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2018

Next-Generation Graphics on Larrabee. Tim Foley Intel Corp

Overview. A real-time shadow approach for an Augmented Reality application using shadow volumes. Augmented Reality.

Visible-Surface Detection Methods. Chapter? Intro. to Computer Graphics Spring 2008, Y. G. Shin

White Paper. Solid Wireframe. February 2007 WP _v01

Chapter IV Fragment Processing and Output Merging. 3D Graphics for Game Programming

CEng 477 Introduction to Computer Graphics Fall 2007

Transcription:

Real-Time Graphics Architecture Lecture 8: Antialiasing Kurt Akeley Pat Hanrahan http://graphics.stanford.edu/cs448-07-spring/ Antialiasing Outline Aliasing and antialiasing Taxonomy of antialiasing approaches Some details Emphasis is on geometry antialiasing Will not cover image resampling explicitly But good texture filtering may be more important than geometry antialiasing: Crawling textures are really horrible Users sometimes experience texture filtering as fullscene antialiasing 1

What is aliasing? Result of sampling below the Nyquist rate = aliasing For example: More generally it is imperfect signal reconstruction Reconstruction without sinc basis Low-precision arithmetic Other sloppiness Prefiltering Graphics primitives have infinite frequency content For example, the cross section of a line is a box The filtered cross section is much smoother And could be sampled correctly, but how to do it? 2

Integration We implement prefiltering with an integration filter So antialiased frame buffer contents are high-quality samples, to be reconstructed by the visual system Unfortunately the ideal filter has infinite extent So we approximate with imperfect filters Finite domain Incomplete sampling Antialiasing = no more jaggies 3

Antialiasing system goals Good static and dynamic image quality Avoid sudden frame-to-frame changes Avoid false motion (crawling) Avoid negative-training (e.g., pulsing aircraft on horizon) Reasonable Hardware and performance costs Implementation and application complexity Integration with other GPU features Depth buffer for occlusion computation Stencil buffer Transparency? Taxonomy of antialiasing methods Two fundamental approaches, based on what coverage info is Contained in each fragment, and Stored in each pixel in the frame buffer Fractional No geometric information, just coverage percentages Note: coverage may be weighted OpenGL smooth antialiasing Geometric Some geometric information Point sampling Area sampling OpenGL multisample antialiasing Each approach has strengths and weaknesses 4

Taxonomy Fractional Antialiasing Point Sampled Geometric Area Sampled Ideal jaggie removal - integration Define a 2-D spatial filter function for a pixel Probably not a box filter (though may be) Finite, otherwise unworkable Empirical, depends on display properties Render image into an infinite-precision shapes buffer Hidden geometry is somehow eliminated, Leaving exact geometry and color information Integrate filter function with geometry/color info for each pixel 5

Fractional antialiased points Compute weighted coverage by integrating: Point geometry With the filter function of each pixel that intersects the point geometry Pixel filter function Fractional antialiased points Compute weighted coverage by integrating: Point geometry With the filter function of each pixel that intersects the point geometry Pixel filter function 6

Fractional antialiased points Compute weighted coverage by integrating: Point geometry With the filter function of each pixel that intersects the point geometry Pixel filter function Fractional antialiased points Compute weighted coverage by integrating: Point geometry With the filter function of each pixel that intersects the point geometry Pixel filter function 7

Hardware implementation For each point size and sub-pixel point location Pre-integrate for each affected pixel Store results in a hardware table Point size X screen frac bits screen Y screen frac bits Pixel index 3 4 4 4 32K x 8 8 Weighted coverage (A f ) Hardware implementation Reduce table size by Limiting the number of supported point sizes Small maximum point size reduces pixel count too Limiting x screen,y screen sub-pixel resolution Exploiting symmetry Horizontal Vertical Diagonal Normalize total t point intensity it for each point size Same sum of pixel weights for each x screen,y screen offset Avoid frame-to-frame strobe effects for moving points Gamma correction is critical for optimal image quality! 8

Frame buffer operations Point on background Blend point color with background color Use fragment alpha to specify blend weights C p = Af Cf + (1 Af) Cp Point intersecting point Geometric relationship is unknown Best guess is random relationship Use same blend function! Call this blend function uncorrelated Works recursively for all points No need to retain alpha in pixels Fractional antialiased points Strengths Excellent static and dynamic image quality Point overlaps are stable if not accurate Strobing effects are eliminated by aggregate intensity normalization Simple and inexpensive to implement and use Frame buffer gets blend function, no added storage Operates with depth and stencil buffers Weaknesses Depth buffer yields non-optimal results Nearer small coverage replaces farther large coverage 9

Fractional antialiased lines Table is larger Line width, offset to pixel center, slope Must exploit symmetry for reasonable table size End-of-line filtering can be very expensive Iterate 1 x n function Offset Pixel filter function Fractional antialiased lines Table is larger Line width, offset to pixel center, slope Must exploit symmetry for reasonable table size End-of-line filtering can be very expensive Iterate 1 x n function Pixel filter function 10

Fractional antialiased lines Table is larger Line width, offset to pixel center, slope Must exploit symmetry for reasonable table size End-of-line filtering can be very expensive Iterate 1 x n function Pixel filter function Fractional antialiased lines Table is larger Line width, offset to pixel center, slope Must exploit symmetry for reasonable table size End-of-line filtering can be very expensive Iterate 1 x n function Pixel filter function 11

Fractional antialiased lines Strengths Very good static and dynamic image quality Line overlaps are stable if not accurate Roping effects are eliminated by aggregate intensity normalization Simple and inexpensive to implement and use Frame buffer gets blend function, no added storage (Barely) operates with depth and stencil buffers Weaknesses Depth buffer yields very non-optimal results Nearer small coverage replaces farther large coverage Colors interact badly (especially depth cueing) Fractional antialiased triangles Difficult to pre-compute coverage integrations Edge slopes OK, but Vertexes introduce two edge slopes, and Small triangles have all 3 edges in play! Blending approximation breaks down completely Uncorrelated blend leaves visible seams Adjacent triangles are anti-correlated, not uncorrelated 12

Anti-correlated blend functions Assuming perfect tiling, depth complexity 1.0 E.g., 2-D rendering (a clock face, for example) C p = Af Cf + Cp Assuming nearest-to-farthest primitive sorting Special case of 3-D rendering Requires addition of alpha channel in frame buffer i = min(af, (1 Ap)) A p = Ap + i C p = i Cf + Cp Fractional antialiased triangles Strengths Produces useful results in very specialized circumstances Requires minimal frame buffer additions Weaknesses Anti-correlated (saturation) blend, alpha buffer Filter quality is poor Table is impossible to implement, so Convolution is typically with a box filter Difficult and expensive to implement Fails entirely with depth buffer or stencil buffer Imposes unreasonable sorting burden on application Cannot handle polygon interpenetrations 13

Demonstration Fractional antialiasing summary Great for single-colored dot clouds Good for lines High-quality filtering, but Problems with line-line intersections Almost useless for triangles Expensive to implement Filtering quality is poor Depth buffer fails completely Application burden is unacceptable 14

Taxonomy Fractional Antialiasing Point Sampled Geometric Area Sampled Multi-pass accumulation buffer AA Advantages Linear performance/quality ratio Simple to implement Simple to use (no sort, interpenetration OK, ) Point sample pattern is arbitrary Free anisotropic texture filtering. Disadvantages Solves jaggies, but not aliasing Shading is too expensive REYES shades just once or twice per pixel Perception: NTSC chroma vs. luminance bandwidth 15

Multi-pass accumulation buffer AA Key Disadvantage Computation and bandwidth are replicated Computation: application, geometry, esp. shading Bandwidth Application GPU GPU frame buffer Transistors are cheap, communication is expensive Multisample antialiasing Specify the location of multiple sample points per pixel Patterns may differ spatially, but not temporally Rasterize fragments that include A bitmask of occluded samples Appropriate color, depth, and texture coords Evaluate texture once per fragment (not per sample) Store color and depth for each sample in frame buffer Resolve samples to final pixel value either Each time the pixel is modified, or Once, before the buffer is displayed 16

Multisample vs. supersample Terminology is not agreed upon I prefer Supersample Shading computed for each sample Multisample Shading computed once per fragment Sample pattern is implementation dependent Supersample implementations can be Multipass, or Single pass, but repeated shading operations Multisample sample pattern Trade-off Random (pseudo random) Better, more efficient filtering Uniform Easier, more efficient rasterization Compromise: subset(s) of uniform Manageable sample count Empirically best Optimal for horizontal and vertical Good for everything else Pixar owns patent on this 8-rooks pattern Single Pixel 17

Multisample sample pattern Trade-off Box filter No sharing of samples Full utilization of each sample Good quality with low sample counts No boundary issues Shaped filter Best for higher sample count May require pixel-pixel communication How does sample sharing affect filtering? (e.g., Quincunx) 8-queens pattern Single Pixel Rasterization fragment selection Box sampled, as in tiled rasterization The bitmask is composed of point samples Pixel s box must enclose all sample locations Might be outside the 1 x 1 ideal pixel area Look how pixel depth complexity has increased! Area is 5.0, but 13 fragments are generated 18

Rasterization attribute assignment Sample depth at each occluded sample location Depth buffer controls geometry of final image Sample color once per fragment Do not sample outside the triangle! Choose a sample location in a repeatable manner Occluded sample nearest to pixel center Occluded sample nearest to fragment center Sample texture coordinates once per fragment Pixel center optimizes for adjacent triangles Color sample location optimizes for silhouette Multisample frame buffer Store full depth and color values for each sample Various clever compressions are possible Execute full fragment operations for each sample Depth buffer Stencil buffer Blending Resolve to final color Only final color buffers are double buffered Examples: high-end SGI machines 19

8-Sample multisample frame buffer typedef struct { int red, green, blue, alpha; } Color; typedef struct { Color c; int depth; int stencil; } Sample; typedef struct { Color front, back; Sample s[8]; } Pixel; Ideal Multisample Summary Strengths Good full-scene antialiasing quality Works seamlessly with depth/stencil buffers Even works for interpenetrating triangles Operation is predictable and reliable Weaknesses Frame buffer is very expensive Bandwidth Memory requirements Point and line filter quality is mediocre Fractional approach has higher filter quality But multisample correctly resolves intersections 20

Merged multisample and fractional OpenGL Multisample spec designed to allow this: Enable multisample frame buffer Render triangles in multisample mode Then render points and lines in fractional mode Result is OpenGL smooth High-quality points and lines Good quality filtering i of solids No seams or cracks Proper occlusion point/line/solid to solid Point/line to point/line occlusion still poor Architectural options Store only mask in frame buffer Assume front-to-back rendering no interpenetration Intersect and accumulate masks to determine blend function Examples: early flight simulation IGs i = (Mf AND Mfb) / n i = min(af, (1 Afb)) M fb = Mfb OR Mf A fb = Afb + i C fb = i Cf + Cfb Mask rendering C fb = i Cf + Cfb Anti-correlated rendering 21

Architectural options (continued) Tiled rendering Reduces frame buffer storage requirements Multisample l buffers needed d only for active tiles But requires region binned geometry Extra frame of latency Lots of data management complexity Examples Pixel Planes 5, PixelFlow Talisman GigaPixel,. Architectural options (continued) Lossless compression One- and two-fragment special cases Saves bandwidth, d not memory Almost-lossless compression Reduced color precision per sample E.g., 16 8-bit samples reconstruct a 12-bit color value Saves bandwidth and memory Lossy compression at pixels Examples: countless research papers Watch out for failure modes! 22

System evaluation Simulate possible algorithms Run test patterns Run scenes from real applications Try to break it application developers will! Study individual images carefully More important: study sequences of images! Static images do not tell the whole story Antialiasing is a well-researched subject The standards for publication are high Document evaluation procedure when publishing Jaggies vs. aliasing Supersample/Multisample Handle jaggies well Cannot eliminate aliasing Input is not band limited, so Finely detailed geometry will alias Application LOD management addresses this problem Deliver geometry of appropriate resolution Typically done for performance reasons But provides effective prefilter as well Frame-to-frame coherence is a significant issue Close analogy here to MIPmapping 23

Taxonomy Fractional Antialiasing Point Sampled Geometric Area Sampled Area sampling How can one get the good qualities of point sampling Accurate depth comparisons Samples taken only within triangle boundaries Perfect anti-correlated blending Robust, reliable algorithms With the greater filter quality of area-based sampling Greater spatial resolution High-quality, display-tuned filter function In one algorithm? 24

I know of no general solution But there are hacks that get some value 2-fragment area filtering Optimize for special case of just two visible fragments For each fragment compute Coverage mask Weighted (filter-function-integrated) coverage value At each pixel store All multisample values One coverage value, and One extra state bit (tracks 2-fragment case) When merging fragment colors during resolution Use coverage value in 2-fragment case Use multisample values otherwise Extend to three or more fragments? 25

Schilling antialiasing Choose samples based on coverage, not just geometry Good idea, but must sample outside primitive Colors wrap T-junctions protrude Extra Sample Blue triangle occludes ¼ of the pixel s unit area, but only one sample. Select a second sample to get the best weight A-buffer and relatives Variable data structure at each pixel Strengths Handle transparency and depth occlusion Simple for applications to program Weaknesses Complex to implement Memory allocation / deallocation Fragile in operation Failure modes are unpleasant! 26

Summary Two fundamental approaches to geometry antialiasing Fractional ignore geometry at frame buffer Simple to implement Good quality filters Good for non-geometric primitives, poor for triangles Geometric maintain geometry at frame buffer Expensive to implement Mediocre filter quality for reasonable sample counts Good for triangles, mediocre for non-geometric primitives Can mix and match to get the best of both Remember, we didn t discuss image filtering! Suggested readings Filtering Edges for Gray-Scale Displays, Gupta and Sproull, SIGGRAPH Proceedings 81. Compositing Digital Images, Porter and Duff, SIGGRAPH Proceedings 84. A Parallel Algorithm for Polygon Rasterization, Pineda, Computer Graphics 22, 4 (August 88). A New Simple and Efficient Antialiasing with Subpixel Masks, Schilling, SIGGRAPH 91. Multisample extension to OpenGL. 27

Hardware workshop papers R-Buffer: A Pointerless A-Buffer Hardware Architecture, Wittenbrink, Graphics Hardware 2001. Single-Pass Full-Screen Hardware Accelerated Antialiasing, Lee and Kim, 2000. Prefiltered Antialiased Lines Using Half-Plane Distance Functions, McNamara, McCormack, Jouppi, 2000. Z3: An Economical Hardware Technique for High-Quality Antialiasing and Transparency, Jouppi, Chang, 1999. High-Quality Rendering Using the Talisman Architecture, Barkans, 1997 Real-Time Graphics Architecture Lecture 8: Antialiasing Kurt Akeley Pat Hanrahan http://graphics.stanford.edu/cs448-07-spring/ 28