Sang Il Park Sejong University

Slides:



Advertisements
Similar presentations
Sampling and Reconstruction
Advertisements

Technische Universität München Fakultät für Informatik Computer Graphics SS 2014 Sampling Rüdiger Westermann Lehrstuhl für Computer Graphik und Visualisierung.
CS 450: COMPUTER GRAPHICS FILLING POLYGONS SPRING 2015 DR. MICHAEL J. REALE.
Efficient access to TIN Regular square grid TIN Efficient access to TIN Let q := (x, y) be a point. We want to estimate an elevation at a point q: 1. should.
David Luebke 1 4/28/2015 Aliasing & Antialiasing.
Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.
David Luebke1/19/99 CS 551/651: Antialiasing David Luebke
CS 551 / CS 645 Antialiasing. What is a pixel? A pixel is not… –A box –A disk –A teeny tiny little light A pixel is a point –It has no dimension –It occupies.
Aliasing & Antialiasing
Different types of Polygons Simple Convex Simple Concave Non-simple : self-intersecting With holes ConvexConcaveSelf-intersecting.
Implementation III Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Graphics Programming: Polygon Filling
Now Playing: Big Bird Eddie Floyd from The Complete Stax-Volt Singles Volume 1 ( ) Released April 30, 1991.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Sampling Week 7, Fri 17 Oct 2003 p1 demos sampling.
CS 4731: Computer Graphics Lecture 22: Raster Graphics Part 3 Emmanuel Agu.
CIS 681 Distributed Ray Tracing. CIS 681 Anti-Aliasing Graphics as signal processing –Scene description: continuous signal –Sample –digital representation.
Sampling and Antialiasing CMSC 491/635. Abstract Vector Spaces Addition –C = A + B = B + A –(A + B) + C = A + (B + C) –given A, B, A + X = B for only.
Filtering theory: Battling Aliasing with Antialiasing Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology.
CS 431/636 Advanced Rendering Techniques
© Chun-Fa Chang Sampling Theorem & Antialiasing. © Chun-Fa Chang Motivations “ My ray traced images have a lot more pixels than the TV screen. Why do.
Image Processing 고려대학교 컴퓨터 그래픽스 연구실 cgvr.korea.ac.kr.
Antialiasing CptS 548 Advanced Computer Graphics John C. Hart.
Ray Tracing Primer Ref: SIGGRAPH HyperGraphHyperGraph.
Attributes of Graphics Primitives Sang Il Park Sejong University.
David Luebke 1 9/4/2015 CS 551/651: Advanced Computer Graphics Antialiasing Continued: Prefiltering and Supersampling.
Computer Graphics Inf4/MSc Computer Graphics Lecture 9 Antialiasing, Texture Mapping.
March Shape Drawing Algorithms Shmuel Wimer Bar Ilan Univ., Engineering Faculty.
CGMB 314 Intro to Computer Graphics Fill Area Primitives.
Polygon Scan Conversion and Z-Buffering
Geometric Objects Computer Graphics Lab. Sun-Jeong Kim.
Antialiasing CAP4730: Computational Structures in Computer Graphics.
3/4/04© University of Wisconsin, CS559 Spring 2004 Last Time Clipping Lines –Cohen-Sutherland: The use of outcodes and early reject/accept tests –Liang-Barsky:
CSC418 Computer Graphics n BSP tree n Z-Buffer n A-buffer n Scanline.
Introduction to Computer Graphics with WebGL
CS 480/680 Computer Graphics Implementation III Dr. Frederick C Harris, Jr. Fall 2011.
10/26/04© University of Wisconsin, CS559 Fall 2004 Last Time Drawing lines Polygon fill rules Midterm Oct 28.
10/15/02 (c) 2002 University of Wisconsin, CS559 Last Time Clipping.
CS 450: COMPUTER GRAPHICS ANTIALIASING SPRING 2015 DR. MICHAEL J. REALE.
Week 6 - Wednesday.  What did we talk about last time?  Light  Material  Sensors.
Image Processing Basics. What are images? An image is a 2-d rectilinear array of pixels.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Lecture Fall 2001 From S. Zeki, Inner Vision.
Duy & Piotr. How to reconstruct a high quality image with the least amount of samples per pixel the least amount of resources And preserving the image.
10/15/02 (c) 2002 University of Wisconsin, CS559 Who Am I? Prof Stephen Chenney These notes will be online after the lecture – in fact they’re online already.
Attributes of Graphics Primitives Hearn & Baker Chapter 4 Some slides are taken from Robert Thomsons notes.
Lecture 6 Rasterisation, Antialiasing, Texture Mapping,
Sampling Pixel is an area!! – Square, Rectangular, or Circular? How do we approximate the area? – Why bother? Color of one pixel Image Plane Areas represented.
Computer Graphics Filling. Filling Polygons So we can figure out how to draw lines and circles How do we go about drawing polygons? We use an incremental.
Sampling Theorem & Antialiasing
Attributes of Graphics Primitives
Graphics Output Primitives
David Luebke 3/17/2016 Advanced Computer Graphics Antialiasing David Luebke
CS552: Computer Graphics Lecture 17: Scan Conversion (Special Cases)
COMPUTER GRAPHICS CS 482 – FALL 2015 NOVEMBER 10, 2015 VISIBILITY CULLING HIDDEN SURFACES ANTIALIASING HALFTONING.
Rasterization Overview Raster Display Device. Scan Conversion / Rasterization: converting vector graphics into raster graphics (determining pixels in.
Computer Graphics CC416 Week 14 Filling Algorithms.
Attributes of Graphics Primitives Chapter 4
Computer Graphics I, Fall 2010 Scan conversion algorithms.
Sampling Week 7, Fri 17 Oct 2003 p1 demos sampling.
Attributes of Graphics Primitives Hearn & Baker Chapter 4
Computer Graphics Filling.
Introduction to Polygons
(c) 2002 University of Wisconsin, CS559
Fill Area Algorithms Jan
Advanced Computer Graphics:
Joshua Barczak CMSC435 UMBC
Agenda Polygon Terminology Types of polygons Inside Test
Agenda Polygon Terminology Types of polygons Inside Test
Primitive Drawing Algorithm
Primitive Drawing Algorithm
Presentation transcript:

Sang Il Park Sejong University Scan Conversion Sang Il Park Sejong University

Line Attributes Butt cap Round cap Projecting square cap Miter join Round Join Bevel join

Area Filling How can we generate a solid color/patterned polygon area?

How to decide interior -Parity Fill Approach For each pixel determine if it is inside or outside of a given polygon. Approach from the point being tested cast a ray in an arbitrary direction if the number of crossings is odd then the point is inside if the number of crossings is even then the point is outside

How to decide interior -Parity Fill Approach Very fragile algorithm Ray crosses a vertex Ray is coincident with an edge Commonly used in CAD Suitable for H/W

How to decide interior -Winding Number A winding number is an attribute of a point with respect to a polygon that tells us how many times the polygon encloses (or wraps around) the point. It is an integer, greater than or equal to 0. Regions of winding number 0 (unenclosed) are obviously outside the polygon, and regions of winding number 1 (simply enclosed) are obviously inside the polygon. Initially 0 +1: edge crossing the line from right to left -1: left to right use cross product of line and edge vectors No cross vertices

Area Filling (Scan line Approach) Take advantage of Span coherence: all pixels on a span are set to the same value Scan-line coherence: consecutive scan lines are identical Edge coherence: edges intersected by scan line i are also intersected by scan line i+1

Area Filling (Scan line Approach) For each scan line (1) Find intersections (the extrema of spans) Use Bresenham's line-scan algorithm (2) Sort intersections (increasing x order) (3) Fill in between pair of intersections

Area Filling (Scan line method)

Area Filling (Seed Fill Algorithm) basic idea Start at a pixel interior to a polygon Fill the others using connectivity seed

Seed Fill Algorithm (Cont’) 4-connected 8-connected Need a stack. Why?

Seed Fill Algorithm (Cont’) start position

Seed Fill Algorithm (Cont’) 8 6 4 2 0 2 4 6 8 10 0 2 4 6 8 10 8 6 4 2 interior-defined boundary-defined flood fill algorithm boundary fill algorithm

Seed Fill Algorithm (Cont’) 0 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 hole boundary pixel interior pixel seed pixel The stack may contain duplicated or unnecessary information !!!

Boundary Filling

Scan Line Seed Fill scan line conversion seed filling + Shani, U., “Filling Regions in Binary Raster Images: A Graph-Theoretic Approach”, Computer Graphics, 14, (1981), 321-327

Boundary Filling Efficiency in space! finish the scan line containing the starting position process all lines below the start line process all lines above the start line

Flood Filling : Start a point inside the figure, replace a specified interior color only.

Problems of Filling Algorithm What happens if a vertex is shared by more than one polygon, e.g. three triangles? What happens if the polygon intersects itself? What happens for a “sliver”? Solutions? Redefine what it means to be inside of a triangle Different routines for nasty little triangles

Aliasing in CG Which is the better?

Aliasing in CG Digital technology can only approximate analog signals through a process known as sampling The distortion of information due to low-frequency sampling (undersampling) Choosing an appropriate sampling rate depends on data size restraints, need for accuracy, the cost per sample… Errors caused by aliasing are called artefacts. Common aliasing artefacts in computer graphics include jagged profiles, disappearing or improperly rendered fine detail, and disintegrating textures.

The Nyquist Theorem the sampling rate must be at least twice the frequency of the signal or aliasing occurs

Aliasing Effects

Artifacts - Jagged profiles Jagged silhouettes are probably the most familiar effect caused by aliasing. Jaggies are especially noticeable where there is a high contrast between the interior and the exterior of the silhouette

Artefacts - Improperly rendered detail

Artefacts - Disintegrating textures The checkers should become smaller as the distance from the viewer increases.

Antialiasing Antialiasing methods were developed to combat the effects of aliasing. The two major categories of antialiasing techniques are prefiltering and postfiltering.

Prefiltering Eliminate high frequencies before sampling (Foley & van Dam p. 630) Convert I(x) to F(u) Apply a low-pass filter A low-pass filter allows low frequencies through, but attenuates (or reduces) high frequencies Then sample. Result: no aliasing!

High Frequency

Prefiltering

Prefiltering

Basis for Prefiltering Algorithms

Catmull’s Algorithm A2 A1 AB A3 Find fragment areas Multiply by fragment colors Sum for final pixel color

Prefiltering Example

Prefiltering So what’s the problem? Problem: most rendering algorithms generate sampled function directly e.g., Z-buffer, ray tracing

Supersampling The simplest way to reduce aliasing artifacts is supersampling Increase the resolution of the samples Average the results down Or sometimes, it is called “Postfiltering”.

Supersampling The process: Create virtual image at higher resolution than the final image Apply a low-pass filter Resample filtered image

Supersampling: Limitations Q: What practical consideration hampers super-sampling? A: Storage goes up quadratically Q: What theoretical problem does supersampling suffer? A: Doesn’t eliminate aliasing! Supersampling simply shifts the Nyquist limit higher

Supersampling: Worst Case Q: Give a simple scene containing infinite frequencies A: A checkered ground plane receding into infinity See next slide…

Supersampling Despite these limitations, people still use super-sampling (why?) So how can we best perform it?

Sampling in the Postfiltering method Supersampling from a 4*3 image. Sampling can be done randomly or regularly. The method of perturbing the sample positions is known as "jittering."

Stochastic Sampling Stochastic: involving or containing a random variable Sampling theory tells us that with a regular sampling grid, frequencies higher than the Nyquist limit will alias Q: What about irregular sampling? A: High frequencies appear as noise, not aliases This turns out to bother our visual system less!

Stochastic Sampling An intuitive argument: In stochastic sampling, every region of the image has a finite probability of being sampled Thus small features that fall between uniform sample points tend to be detected by non-uniform samples

Stochastic Sampling Integrating with different renderers: Ray tracing: It is just as easy to fire a ray one direction as another Z-buffer: hard, but possible Notable example: REYES system (?) Using image jittering is easier (more later) A-buffer: nope Totally built around square pixel filter and primitive-to-sample coherence

Stochastic Sampling Idea: randomizing distribution of samples scatters aliases into noise Problem: what type of random distribution to adopt? Reason: type of randomness used affects spectral characteristics of noise into which high frequencies are converted

Stochastic Sampling Problem: given a pixel, how to distribute points (samples) within it? Grid Random Poisson Disc Jitter

Stochastic Sampling Poisson distribution: Completely random Add points at random until area is full. Uniform distribution: some neighboring samples close together, some distant

Stochastic Sampling Poisson disc distribution: Poisson distribution, with minimum- distance constraint between samples Add points at random, removing again if they are too close to any previous points Very even-looking distribution

Stochastic Sampling Jittered distribution Start with regular grid of samples Perturb each sample slightly in a random direction More “clumpy” or granular in appearance

Nonuniform Supersampling Adaptive Sampling

Adaptive Sampling Problem: Final Samples Many more blue samples than white samples But final pixel actually more white than purple! Simple filtering will not handle this correctly Final Samples

Filters

Antialiasing http://www.siggraph.org/education/materials/HyperGraph/aliasing