Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing.

Similar presentations


Presentation on theme: "CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing."— Presentation transcript:

1 CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing

2 Environment Mapping Used to model a object that reflects surrounding textures to the eye Polished sphere reflects walls and ceiling texturesPolished sphere reflects walls and ceiling textures Cyborg in Terminator 2 reflects flaming destructionCyborg in Terminator 2 reflects flaming destruction Texture is distorted fish-eye view of environment Spherical texture mapping creates texture coordinates that correctly index into this texture map Used to model a object that reflects surrounding textures to the eye Polished sphere reflects walls and ceiling texturesPolished sphere reflects walls and ceiling textures Cyborg in Terminator 2 reflects flaming destructionCyborg in Terminator 2 reflects flaming destruction Texture is distorted fish-eye view of environment Spherical texture mapping creates texture coordinates that correctly index into this texture map

3 Sphere Mapping

4 Blinn/Newell Lattitude Mapping

5 Cube Mapping

6 The q-coordinate Remember, texture coordinate interpolation is linear Texture coordinates can contain an optional q-parameter q scales texture coordinates by dividing each coordinate by q This captures perspective transformations Remember, texture coordinate interpolation is linear Texture coordinates can contain an optional q-parameter q scales texture coordinates by dividing each coordinate by q This captures perspective transformations Z – into the scene Image plane

7 Multitexturing Pipelining of multiple texture applications to one polygon The results of each texture unit application is passed to the next texture unit, which adds its effects More bookkeeping is required to pull this off Pipelining of multiple texture applications to one polygon The results of each texture unit application is passed to the next texture unit, which adds its effects More bookkeeping is required to pull this off

8 Antialiasing

9 What is a pixel? A pixel is not… A boxA box A diskA disk A teeny tiny little lightA teeny tiny little light A pixel is a point It has no dimensionIt has no dimension It occupies no areaIt occupies no area It cannot be seenIt cannot be seen It can have a coordinateIt can have a coordinate A pixel is not… A boxA box A diskA disk A teeny tiny little lightA teeny tiny little light A pixel is a point It has no dimensionIt has no dimension It occupies no areaIt occupies no area It cannot be seenIt cannot be seen It can have a coordinateIt can have a coordinate A pixel is more than a point, it is a sample

10 Samples Most things in the real world are continuous Everything in a computer is discrete The process of mapping a continuous function to a discrete one is called sampling The process of mapping a continuous variable to a discrete one is called quantization Rendering an image requires sampling and quantization Most things in the real world are continuous Everything in a computer is discrete The process of mapping a continuous function to a discrete one is called sampling The process of mapping a continuous variable to a discrete one is called quantization Rendering an image requires sampling and quantization

11 Samples

12

13 Line Segments We tried to sample a line segment so it would map to a 2D raster display We quantized the pixel values to 0 or 1 We saw stair steps, or jaggies We tried to sample a line segment so it would map to a 2D raster display We quantized the pixel values to 0 or 1 We saw stair steps, or jaggies

14 Line Segments Instead, quantize to many shades But what sampling algorithm is used? Instead, quantize to many shades But what sampling algorithm is used?

15 Area Sampling Shade pixels according to the area covered by thickened line This is unweighted area sampling A rough approximation formulated by dividing each pixel into a finer grid of pixels Shade pixels according to the area covered by thickened line This is unweighted area sampling A rough approximation formulated by dividing each pixel into a finer grid of pixels

16 Unweighted Area Sampling Primitive cannot affect intensity of pixel if it does not intersect the pixel Equal areas cause equal intensity, regardless of distance from pixel center to area Primitive cannot affect intensity of pixel if it does not intersect the pixel Equal areas cause equal intensity, regardless of distance from pixel center to area

17 Weighted Area Sampling Unweighted sampling colors two pixels identically when the primitive cuts the same area through the two pixels Intuitively, pixel cut through the center should be more heavily weighted than one cut along corner Unweighted sampling colors two pixels identically when the primitive cuts the same area through the two pixels Intuitively, pixel cut through the center should be more heavily weighted than one cut along corner

18 Weighted Area Sampling Weighting function, W(x,y) specifies the contribution of primitive passing through the point (x, y) from pixel centerspecifies the contribution of primitive passing through the point (x, y) from pixel center Weighting function, W(x,y) specifies the contribution of primitive passing through the point (x, y) from pixel centerspecifies the contribution of primitive passing through the point (x, y) from pixel center x Intensity W(x,y)

19 Images An image is a 2D function I (x, y) that specifies intensity for each point (x, y)

20 Sampling and Image Our goal is to convert the continuous image to a discrete set of samples The graphics system’s display hardware will attempt to reconvert the samples into a continuous image: reconstruction Our goal is to convert the continuous image to a discrete set of samples The graphics system’s display hardware will attempt to reconvert the samples into a continuous image: reconstruction

21 Point Sampling an Image Simplest sampling is on a grid Sample depends solely on value at grid points Simplest sampling is on a grid Sample depends solely on value at grid points

22 Point Sampling Multiply sample grid by image intensity to obtain a discrete set of points, or samples. Sampling Geometry

23 Some objects missed entirely, others poorly sampled Sampling Errors

24 Fixing Sampling Errors Supersampling Take more than one sample for each pixel and combine themTake more than one sample for each pixel and combine them –How many samples is enough? –How do we know no features are lost? Supersampling Take more than one sample for each pixel and combine themTake more than one sample for each pixel and combine them –How many samples is enough? –How do we know no features are lost? 150x15 to 100x10 200x20 to 100x10 300x30 to 100x10 400x40 to 100x10

25 Unweighted Area Sampling Average supersampled points All points are weighted equally Average supersampled points All points are weighted equally

26 Weighted Area Sampling Points in pixel are weighted differently Flickering occurs as object moves across displayFlickering occurs as object moves across display Overlapping regions eliminates flicker Points in pixel are weighted differently Flickering occurs as object moves across displayFlickering occurs as object moves across display Overlapping regions eliminates flicker

27 How is this done today? Full Screen Antialiasing Nvidia GeForce2 OpenGL: render image 400% larger and supersampleOpenGL: render image 400% larger and supersample Direct3D: render image 400% - 1600% largerDirect3D: render image 400% - 1600% larger Nvidia GeForce3 Multisampling but with fancy overlapsMultisampling but with fancy overlaps –Don’t render at higher resolution –Use one image, but combine values of neighboring pixels –Beware of recognizable combination artifacts  Human perception of patterns is too good Nvidia GeForce2 OpenGL: render image 400% larger and supersampleOpenGL: render image 400% larger and supersample Direct3D: render image 400% - 1600% largerDirect3D: render image 400% - 1600% larger Nvidia GeForce3 Multisampling but with fancy overlapsMultisampling but with fancy overlaps –Don’t render at higher resolution –Use one image, but combine values of neighboring pixels –Beware of recognizable combination artifacts  Human perception of patterns is too good

28 GeForce3 Multisampling After each pixel is rendered, write pixel value to two different places in frame bufferAfter each pixel is rendered, write pixel value to two different places in frame bufferMultisampling

29 GeForce3 - Multisampling After rendering two copies of entire frame Shift pixels of Sample #2 left and up by ½ pixelShift pixels of Sample #2 left and up by ½ pixel Imagine laying Sample #2 (red) over Sample #1 (black)Imagine laying Sample #2 (red) over Sample #1 (black) After rendering two copies of entire frame Shift pixels of Sample #2 left and up by ½ pixelShift pixels of Sample #2 left and up by ½ pixel Imagine laying Sample #2 (red) over Sample #1 (black)Imagine laying Sample #2 (red) over Sample #1 (black)

30 GeForce3 - Multisampling Resolve the two samples into one image by computing average between each pixel from Sample 1 (black) and the four pixels from Sample 2 (red) that are 1/ sqrt(2) pixels away

31 GeForce3 - Multisampling No AA Multisampling

32 GeForce3 - Multisampling 4x Supersample Multisampling

33 ATI Smoothvision ATI SmoothVision Programmer selects samping patternProgrammer selects samping pattern ATI SmoothVision Programmer selects samping patternProgrammer selects samping pattern

34 3dfx 3dfx Multisampling 2- or 4-frame shift and average2- or 4-frame shift and averageTradeoffs? 3dfx Multisampling 2- or 4-frame shift and average2- or 4-frame shift and averageTradeoffs?


Download ppt "CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing."

Similar presentations


Ads by Google