260 likes | 361 Views
Aliasing and Anti-Aliasing Techniques. What is Aliasing? Effects of Aliasing Anti-Aliasing Techniques. Images. an image is a 2D function I(x, y) that specifies intensity for each point (x, y). Aliasing. Consider a diagonal line represented as a raster graphic…. Aliasing.
E N D
Aliasing and Anti-Aliasing Techniques • What is Aliasing? • Effects of Aliasing • Anti-Aliasing Techniques
Images • an image is a 2D function I(x, y) that specifies intensity for each point (x, y)
Aliasing • Consider a diagonal line represented as a raster graphic…
Aliasing • The simplest way to rasterise would be to fill only those pixels with >50% coverage.
Aliasing • This is not a particularly good representation of the original line. • Aliasing creates a jagged, ‘stepped’ appearance. • The aliasing also makes lines appear to have different intensities depending on their angle.
Vector representation of a circle Jagged edges due to aliasing during the rasterisation process Effects of Aliasing in Graphics • Jagged effect in rasterised graphics:
Antialiasing Techniques 1. Super sampling 2. Area sampling 3. Pixel Phasing
Super-Sampling • Split single pixel into sub-pixels. • Pixel’s final color is a mixture of sub-pixels’ colors. • Simple method: Sample at the middle of each sub-pixel. • Then, pixel’s color is the average of the sub-pixels’ color. Sub-divide into sub-pixels Pixels
Super-Sampling a Zero-Width Line Apply Bresenham’s algorithm at sub-pixel level Sub-divide each pixel into sub-pixels, for example 4x4 sub-pixels Each pixel can have a maximum of 4 colored sub-pixels 0.0 0.0 0.0 1.0 0.5 1.0 1.0 0.0 0.5 0.0 0.0 0.0 0 0 0 4 2 4 4 0 2 0 0 0 Assign color Fraction of pixel’s color to be line’s color How many sub-pixels are colored?
Super-Sampling a Line with Non-Zero Width A line that is one-pixel wide. For every pixel: Maximum number of sub-pixels inside line = 16 A sub-pixel is considered in if its lower-left corner is inside the line 0 0 5/16 9/16 10/16 15/16 13/16 7/16 8/16 2/16 0 0 Fraction of sub-pixels are in = fraction of color of the pixel should be line color
Super sampling (post filtering) • Super sampling performs calculations on a virtual image ‘n’ times the resolution of the desired output. • Filtering is applied to each of these virtual pixels and the resultant average value is used to shade the corresponding pixel in the output image. • Greater accuracy and more graphically impressive results can be obtained by a technique known as super sampling.
Supersampling • Super sampling is expensive computationally, but many high-end video cards provide on-board functionality to speed the process up. • Modern video games strive for smooth, realistic edges and make extensive use of anti-aliasing techniques. • Many games provide the user with options to select the level of super sampling used (2x, 4x, 8x) to balance the desired graphics level with the computing power available.
90% 15% 65% 50% Anti-Aliasing Techniques(Area sampling/pre-filtering) • Un-weighted filtering:A better method would be to determine the strength of the colour used to fill each individual pixel according to the percentage covered by the line.
Circle with aliasing Pre-filtering applied Anti-Aliasing Techniques • This technique (known as pre-filtering) creates a much smoother appearance.
Anti-Aliasing Techniques • In the method seen on the previous slides, the amount of coverage given to each pixel is determined irrespective of the distance from the centre of the line. • The filter used to calculate the % coverage of each pixel in this method can be thought of as a cube covering an area of 1x1 pixels, as explained in the following slides…
Unweighted Filtering • Consider the line on a plane surface in a 3D space…
Unweighted Filtering • A cube is extrapolated up from the plane for each pixel that the line intersects…
Unweighted Filtering • The line is then extrapolated to fill a portion of this cube…
Unweighted Filtering • The percentage of the cube filled by the line can now be calculated and used to shade this pixel. • Unweighted filtering is computationally simple, but better results can be achieved by using a weighted filter.
Weighted Filtering • In weighted filtering, a cone is used in place of the cube.
Weighted Filtering • The line is extrapolated into the cone and the percentage of the cone filled is calculated.
Weighted Filtering • This weighted filtering gives a more accurate result by taking into account the pixels around the one currently being investigated. • The use of a cone means that priority is given to line coverage closest to the center of the pixel in question.
Pixel Phasing • Hardware based technique. • System incorporating this technique are designed so that individual pixel position can be shifted by a fraction of a diameter. • The electron beam is typically shifted by ¼ ,½ , ¾ of a pixel diameter to plot points closer to true line path0
Antialiasing Example • With anti-aliasing: • Without anti-aliasing: