# Blending and Antialiasing - PowerPoint PPT Presentation

Blending and Antialiasing

1 / 14

## Blending and Antialiasing

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
##### Presentation Transcript

1. Blending and Antialiasing Dr. Aree Ali Mohammed Assistant Professor 2013-2014 3rd Stage aree.ali@univsul.net University of Sulaimani - School of Science - Computer Dept.

2. Objectives • Add extra details and polish your scene • Blend colors to achieve such effects as making objects appear translucent • Smooth jagged edges of lines and polygons with antialiasing Blending: tells you how to specify a blending function that combines color values from a source and a destination. The final effect is that parts of your scene appear translucent. Antialiasing: explains this relatively subtle technique that alters colors so that the edges of points, lines, and polygons appear smooth rather than angular and jagged. University of Sulaimani - School of Science - Computer Dept.

3. Color Blending • With blending, the foreground color is combined with the background color (translucent) • Without blending, each foreground color overwrites the existing background color (opaque) - Linear soft-fill algorithm University of Sulaimani - School of Science - Computer Dept.

4. Aliasing versus Antialiasing • In the drawing algorithms, all rasterized locations do not match with the true line, an optimal location is selected to represent a straight line. This problem is severe in low resolution screens. In such screens line appears like a stair-step. The effect is known as aliasing. • This effect can be reduced by adjusting intensities of the pixels along the line. The process of adjusting intensities of the pixels along the line to minimize the effect of aliasing is called antialiasing. University of Sulaimani - School of Science - Computer Dept.

5. Sampling • 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 discrete function to a continuous one is calledreconstruction • the process of mapping a continuous variable to a discrete one is called discretization • rendering an image requires sampling and discretization • displaying an image involves reconstruction University of Sulaimani - School of Science - Computer Dept.

6. Example University of Sulaimani - School of Science - Computer Dept.

7. Aliasing Examples Texture Minification Small triangles Stair stepping Moiré Patterns University of Sulaimani - School of Science - Computer Dept.

8. Methods of Antialiasing I • Increasing Resolution Increase resolution of the raster display. Improvement comes at the price of memory, bandwidth of memory and scan – conversion time. University of Sulaimani - School of Science - Computer Dept.

9. Methods of Antialiasing II • 2. Unweighted Area Sampling For sloped lines, many times the line passes between two pixels. Line drawing algorithms select the pixel which is closer to the true line. This leads to perform antialiasing. In antialiasing instead of picking closest pixel, both pixels are highlighted. However, their intensity values may differ. University of Sulaimani - School of Science - Computer Dept.

10. Methods of Antialiasing II University of Sulaimani - School of Science - Computer Dept.

11. Methods of Antialiasing III 3. Weighted Area Sampling In weighted area sampling equal areas contribute unequally i.e. a small area closer to the pixel center has greater intensity than does one at a greater distance. Thus, in weighted area sampling the intensity of the pixel is dependent on the line area occupied and the distance of area from the pixel’s center. University of Sulaimani - School of Science - Computer Dept.

12. Point – Line Antialiasing • Line Smoothing glEnable (GL_LINE_SMOOTH); glEnable (GL_BLEND); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); • Point Smoothing glEnable (GL_POINT_SMOOTH); (no need for blending) University of Sulaimani - School of Science - Computer Dept.

13. Polygon Antialiasing University of Sulaimani - School of Science - Computer Dept.

14. Review Questions • Explain any two Antialiasing Techniques • How color blending works? • What is aliasing and antialiasing? • Propose some techniques to antialiasing point, line and polygon.