![Page 1: CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing](https://reader035.vdocument.in/reader035/viewer/2022062318/551c5acd550346a66a8b50e2/html5/thumbnails/1.jpg)
CS 445 / 645Introduction to Computer Graphics
Lecture 18Lecture 18
AntialiasingAntialiasing
Lecture 18Lecture 18
AntialiasingAntialiasing
![Page 2: CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing](https://reader035.vdocument.in/reader035/viewer/2022062318/551c5acd550346a66a8b50e2/html5/thumbnails/2.jpg)
Environment Mapping
Used to model a object that reflects surrounding textures Used to model a object that reflects surrounding textures to the eyeto 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 environmentTexture is distorted fish-eye view of environment
Spherical texture mapping creates texture coordinates Spherical texture mapping creates texture coordinates that correctly index into this texture mapthat correctly index into this texture map
Used to model a object that reflects surrounding textures Used to model a object that reflects surrounding textures to the eyeto 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 environmentTexture is distorted fish-eye view of environment
Spherical texture mapping creates texture coordinates Spherical texture mapping creates texture coordinates that correctly index into this texture mapthat correctly index into this texture map
![Page 3: CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing](https://reader035.vdocument.in/reader035/viewer/2022062318/551c5acd550346a66a8b50e2/html5/thumbnails/3.jpg)
Sphere Mapping
![Page 4: CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing](https://reader035.vdocument.in/reader035/viewer/2022062318/551c5acd550346a66a8b50e2/html5/thumbnails/4.jpg)
Blinn/Newell Lattitude Mapping
![Page 5: CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing](https://reader035.vdocument.in/reader035/viewer/2022062318/551c5acd550346a66a8b50e2/html5/thumbnails/5.jpg)
Cube Mapping
![Page 6: CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing](https://reader035.vdocument.in/reader035/viewer/2022062318/551c5acd550346a66a8b50e2/html5/thumbnails/6.jpg)
The q-coordinate
Remember, texture coordinate interpolation is linearRemember, texture coordinate interpolation is linear
Texture coordinates Texture coordinates can contain an can contain an optional q-parameteroptional q-parameter
q scales texture q scales texture coordinates by coordinates by dividing each dividing each coordinate by qcoordinate by q
This captures perspective transformationsThis captures perspective transformations
Remember, texture coordinate interpolation is linearRemember, texture coordinate interpolation is linear
Texture coordinates Texture coordinates can contain an can contain an optional q-parameteroptional q-parameter
q scales texture q scales texture coordinates by coordinates by dividing each dividing each coordinate by qcoordinate by q
This captures perspective transformationsThis captures perspective transformations
Z – into the scene
Imageplane
![Page 7: CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing](https://reader035.vdocument.in/reader035/viewer/2022062318/551c5acd550346a66a8b50e2/html5/thumbnails/7.jpg)
Multitexturing
Pipelining of multiple texture applications to one Pipelining of multiple texture applications to one polygonpolygon
The results of each texture unit application is The results of each texture unit application is passed to the next texture unit, which adds its passed to the next texture unit, which adds its effectseffects
More bookkeeping is required to pull this offMore bookkeeping is required to pull this off
Pipelining of multiple texture applications to one Pipelining of multiple texture applications to one polygonpolygon
The results of each texture unit application is The results of each texture unit application is passed to the next texture unit, which adds its passed to the next texture unit, which adds its effectseffects
More bookkeeping is required to pull this offMore bookkeeping is required to pull this off
![Page 8: CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing](https://reader035.vdocument.in/reader035/viewer/2022062318/551c5acd550346a66a8b50e2/html5/thumbnails/8.jpg)
Antialiasing
![Page 9: CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing](https://reader035.vdocument.in/reader035/viewer/2022062318/551c5acd550346a66a8b50e2/html5/thumbnails/9.jpg)
What is a pixel?
A pixel is not…A pixel is not…
• A boxA box
• A diskA disk
• A teeny tiny little lightA teeny tiny little light
A pixel is a pointA 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 pixel is not…
• A boxA box
• A diskA disk
• A teeny tiny little lightA teeny tiny little light
A pixel is a pointA 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
![Page 10: CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing](https://reader035.vdocument.in/reader035/viewer/2022062318/551c5acd550346a66a8b50e2/html5/thumbnails/10.jpg)
Samples
Most things in the real world are Most things in the real world are continuouscontinuous
Everything in a computer is Everything in a computer is discretediscrete
The process of mapping a continuous function to a The process of mapping a continuous function to a discrete one is called discrete one is called samplingsampling
The process of mapping a continuous variable to a The process of mapping a continuous variable to a discrete one is called discrete one is called quantizationquantization
Rendering an image requires sampling and Rendering an image requires sampling and quantizationquantization
Most things in the real world are Most things in the real world are continuouscontinuous
Everything in a computer is Everything in a computer is discretediscrete
The process of mapping a continuous function to a The process of mapping a continuous function to a discrete one is called discrete one is called samplingsampling
The process of mapping a continuous variable to a The process of mapping a continuous variable to a discrete one is called discrete one is called quantizationquantization
Rendering an image requires sampling and Rendering an image requires sampling and quantizationquantization
![Page 11: CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing](https://reader035.vdocument.in/reader035/viewer/2022062318/551c5acd550346a66a8b50e2/html5/thumbnails/11.jpg)
Samples
![Page 12: CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing](https://reader035.vdocument.in/reader035/viewer/2022062318/551c5acd550346a66a8b50e2/html5/thumbnails/12.jpg)
Samples
![Page 13: CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing](https://reader035.vdocument.in/reader035/viewer/2022062318/551c5acd550346a66a8b50e2/html5/thumbnails/13.jpg)
Line Segments
We tried to sample a line segment so it would map We tried to sample a line segment so it would map to a 2D raster displayto a 2D raster display
We quantized the pixel values to 0 or 1We quantized the pixel values to 0 or 1
We saw stair steps, or jaggiesWe saw stair steps, or jaggies
We tried to sample a line segment so it would map We tried to sample a line segment so it would map to a 2D raster displayto a 2D raster display
We quantized the pixel values to 0 or 1We quantized the pixel values to 0 or 1
We saw stair steps, or jaggiesWe saw stair steps, or jaggies
![Page 14: CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing](https://reader035.vdocument.in/reader035/viewer/2022062318/551c5acd550346a66a8b50e2/html5/thumbnails/14.jpg)
Line Segments
Instead, quantize to many shadesInstead, quantize to many shades
But what sampling algorithm is used?But what sampling algorithm is used?
Instead, quantize to many shadesInstead, quantize to many shades
But what sampling algorithm is used?But what sampling algorithm is used?
![Page 15: CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing](https://reader035.vdocument.in/reader035/viewer/2022062318/551c5acd550346a66a8b50e2/html5/thumbnails/15.jpg)
Area SamplingShade pixels according to the area covered by thickened Shade pixels according to the area covered by thickened
lineline
This is This is unweightedunweighted area sampling area sampling
A rough approximation formulated by dividing each pixel A rough approximation formulated by dividing each pixel into a finer grid of pixelsinto a finer grid of pixels
Shade pixels according to the area covered by thickened Shade pixels according to the area covered by thickened lineline
This is This is unweightedunweighted area sampling area sampling
A rough approximation formulated by dividing each pixel A rough approximation formulated by dividing each pixel into a finer grid of pixelsinto a finer grid of pixels
![Page 16: CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing](https://reader035.vdocument.in/reader035/viewer/2022062318/551c5acd550346a66a8b50e2/html5/thumbnails/16.jpg)
Unweighted Area Sampling
Primitive cannot affect intensity of pixel if it does Primitive cannot affect intensity of pixel if it does not intersect the pixelnot intersect the pixel
Equal areas cause equal intensity, regardless of Equal areas cause equal intensity, regardless of distance from pixel center to areadistance from pixel center to area
Primitive cannot affect intensity of pixel if it does Primitive cannot affect intensity of pixel if it does not intersect the pixelnot intersect the pixel
Equal areas cause equal intensity, regardless of Equal areas cause equal intensity, regardless of distance from pixel center to areadistance from pixel center to area
![Page 17: CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing](https://reader035.vdocument.in/reader035/viewer/2022062318/551c5acd550346a66a8b50e2/html5/thumbnails/17.jpg)
Weighted Area Sampling
Unweighted sampling colors two pixels identically Unweighted sampling colors two pixels identically when the primitive cuts the same area through when the primitive cuts the same area through the two pixelsthe two pixels
Intuitively, pixel cut through the center should be Intuitively, pixel cut through the center should be more heavily weighted than one cut along more heavily weighted than one cut along cornercorner
Unweighted sampling colors two pixels identically Unweighted sampling colors two pixels identically when the primitive cuts the same area through when the primitive cuts the same area through the two pixelsthe two pixels
Intuitively, pixel cut through the center should be Intuitively, pixel cut through the center should be more heavily weighted than one cut along more heavily weighted than one cut along cornercorner
![Page 18: CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing](https://reader035.vdocument.in/reader035/viewer/2022062318/551c5acd550346a66a8b50e2/html5/thumbnails/18.jpg)
Weighted Area Sampling
Weighting function, W(x,y)Weighting function, W(x,y)
• specifies the contribution of primitive passing through specifies the contribution of primitive passing through the point (x, y) from pixel centerthe point (x, y) from pixel center
Weighting function, W(x,y)Weighting function, W(x,y)
• specifies the contribution of primitive passing through specifies the contribution of primitive passing through the point (x, y) from pixel centerthe point (x, y) from pixel center
x
IntensityW(x,y)
![Page 19: CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing](https://reader035.vdocument.in/reader035/viewer/2022062318/551c5acd550346a66a8b50e2/html5/thumbnails/19.jpg)
Images
An image is a 2D function An image is a 2D function II(x, y) that specifies (x, y) that specifies intensity for each point (x, y)intensity for each point (x, y)
An image is a 2D function An image is a 2D function II(x, y) that specifies (x, y) that specifies intensity for each point (x, y)intensity for each point (x, y)
![Page 20: CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing](https://reader035.vdocument.in/reader035/viewer/2022062318/551c5acd550346a66a8b50e2/html5/thumbnails/20.jpg)
Sampling and Image
Our goal is to convert the continuous image to a Our goal is to convert the continuous image to a discrete set of samplesdiscrete set of samples
The graphics system’s display hardware will The graphics system’s display hardware will attempt to reconvert the samples into a attempt to reconvert the samples into a continuous image: continuous image: reconstructionreconstruction
Our goal is to convert the continuous image to a Our goal is to convert the continuous image to a discrete set of samplesdiscrete set of samples
The graphics system’s display hardware will The graphics system’s display hardware will attempt to reconvert the samples into a attempt to reconvert the samples into a continuous image: continuous image: reconstructionreconstruction
![Page 21: CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing](https://reader035.vdocument.in/reader035/viewer/2022062318/551c5acd550346a66a8b50e2/html5/thumbnails/21.jpg)
Point Sampling an Image
Simplest sampling is on a gridSimplest sampling is on a grid
Sample dependsSample dependssolely on valuesolely on valueat grid pointsat grid points
Simplest sampling is on a gridSimplest sampling is on a grid
Sample dependsSample dependssolely on valuesolely on valueat grid pointsat grid points
![Page 22: CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing](https://reader035.vdocument.in/reader035/viewer/2022062318/551c5acd550346a66a8b50e2/html5/thumbnails/22.jpg)
Point Sampling
Multiply sample grid by image intensity to obtain a Multiply sample grid by image intensity to obtain a discrete set of points, or samples.discrete set of points, or samples.
Multiply sample grid by image intensity to obtain a Multiply sample grid by image intensity to obtain a discrete set of points, or samples.discrete set of points, or samples.
Sampling Geometry
![Page 23: CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing](https://reader035.vdocument.in/reader035/viewer/2022062318/551c5acd550346a66a8b50e2/html5/thumbnails/23.jpg)
Some objects missed entirely, others poorly Some objects missed entirely, others poorly sampledsampled
Some objects missed entirely, others poorly Some objects missed entirely, others poorly sampledsampled
Sampling Errors
![Page 24: CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing](https://reader035.vdocument.in/reader035/viewer/2022062318/551c5acd550346a66a8b50e2/html5/thumbnails/24.jpg)
Fixing Sampling Errors
SupersamplingSupersampling• Take more than one sample for each pixel and combine Take more than one sample for each pixel and combine
themthem
– How many How many samples is samples is enough?enough?
– How do we How do we know no know no features are features are lost?lost?
SupersamplingSupersampling• Take more than one sample for each pixel and combine Take more than one sample for each pixel and combine
themthem
– How many How many samples is samples is enough?enough?
– How do we How do we know no know no features are features are lost?lost?
150x15 to 100x10
200x20 to 100x10
300x30 to 100x10
400x40 to 100x10
![Page 25: CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing](https://reader035.vdocument.in/reader035/viewer/2022062318/551c5acd550346a66a8b50e2/html5/thumbnails/25.jpg)
Unweighted Area Sampling
Average supersampled pointsAverage supersampled points
All points are weighted equallyAll points are weighted equally
Average supersampled pointsAverage supersampled points
All points are weighted equallyAll points are weighted equally
![Page 26: CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing](https://reader035.vdocument.in/reader035/viewer/2022062318/551c5acd550346a66a8b50e2/html5/thumbnails/26.jpg)
Weighted Area Sampling
Points in pixel are weighted differentlyPoints in pixel are weighted differently
• Flickering occurs as object movesFlickering occurs as object movesacross displayacross display
Overlapping regions eliminates flickerOverlapping regions eliminates flicker
Points in pixel are weighted differentlyPoints in pixel are weighted differently
• Flickering occurs as object movesFlickering occurs as object movesacross displayacross display
Overlapping regions eliminates flickerOverlapping regions eliminates flicker
![Page 27: CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing](https://reader035.vdocument.in/reader035/viewer/2022062318/551c5acd550346a66a8b50e2/html5/thumbnails/27.jpg)
How is this done today?Full Screen Antialiasing
Nvidia GeForce2Nvidia 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 GeForce3Nvidia GeForce3• MultisamplingMultisampling but with fancy overlaps but with fancy overlaps
– Don’t render at higher resolutionDon’t render at higher resolution
– Use one image, but combine values of neighboring pixelsUse one image, but combine values of neighboring pixels
– Beware of recognizable combination artifactsBeware of recognizable combination artifacts
Human perception of patterns is too goodHuman perception of patterns is too good
Nvidia GeForce2Nvidia 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 GeForce3Nvidia GeForce3• MultisamplingMultisampling but with fancy overlaps but with fancy overlaps
– Don’t render at higher resolutionDon’t render at higher resolution
– Use one image, but combine values of neighboring pixelsUse one image, but combine values of neighboring pixels
– Beware of recognizable combination artifactsBeware of recognizable combination artifacts
Human perception of patterns is too goodHuman perception of patterns is too good
![Page 28: CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing](https://reader035.vdocument.in/reader035/viewer/2022062318/551c5acd550346a66a8b50e2/html5/thumbnails/28.jpg)
GeForce3
MultisamplingMultisampling
• After each pixel is rendered, write pixel value to two After each pixel is rendered, write pixel value to two different places in frame bufferdifferent places in frame buffer
MultisamplingMultisampling
• After each pixel is rendered, write pixel value to two After each pixel is rendered, write pixel value to two different places in frame bufferdifferent places in frame buffer
![Page 29: CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing](https://reader035.vdocument.in/reader035/viewer/2022062318/551c5acd550346a66a8b50e2/html5/thumbnails/29.jpg)
GeForce3 - Multisampling
After rendering two copies of entire frameAfter 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 frameAfter 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)
![Page 30: CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing](https://reader035.vdocument.in/reader035/viewer/2022062318/551c5acd550346a66a8b50e2/html5/thumbnails/30.jpg)
GeForce3 - Multisampling
Resolve the two samples into one image by Resolve the two samples into one image by computing average between each pixel from computing average between each pixel from Sample 1 (black) and the four pixels from Sample 1 (black) and the four pixels from Sample 2 (red) that Sample 2 (red) that are 1/ sqrt(2) pixels are 1/ sqrt(2) pixels awayaway
Resolve the two samples into one image by Resolve the two samples into one image by computing average between each pixel from computing average between each pixel from Sample 1 (black) and the four pixels from Sample 1 (black) and the four pixels from Sample 2 (red) that Sample 2 (red) that are 1/ sqrt(2) pixels are 1/ sqrt(2) pixels awayaway
![Page 31: CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing](https://reader035.vdocument.in/reader035/viewer/2022062318/551c5acd550346a66a8b50e2/html5/thumbnails/31.jpg)
GeForce3 - Multisampling
No AA MultisamplingNo AA MultisamplingNo AA MultisamplingNo AA Multisampling
![Page 32: CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing](https://reader035.vdocument.in/reader035/viewer/2022062318/551c5acd550346a66a8b50e2/html5/thumbnails/32.jpg)
GeForce3 - Multisampling
• 4x Supersample Multisampling
![Page 33: CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing](https://reader035.vdocument.in/reader035/viewer/2022062318/551c5acd550346a66a8b50e2/html5/thumbnails/33.jpg)
ATI Smoothvision
ATI SmoothVisionATI SmoothVision• Programmer selects Programmer selects
samping patternsamping pattern
ATI SmoothVisionATI SmoothVision• Programmer selects Programmer selects
samping patternsamping pattern
![Page 34: CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing](https://reader035.vdocument.in/reader035/viewer/2022062318/551c5acd550346a66a8b50e2/html5/thumbnails/34.jpg)
3dfx
3dfx Multisampling3dfx Multisampling• 2- or 4-frame shift and average2- or 4-frame shift and average
Tradeoffs?Tradeoffs?
3dfx Multisampling3dfx Multisampling• 2- or 4-frame shift and average2- or 4-frame shift and average
Tradeoffs?Tradeoffs?