1 1. 2. 3. 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. 2 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 3 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. 4 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 called reconstruction 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 5 6 7 Increasing Resolution Increase resolution of the raster display. Improvement comes at the price of memory, bandwidth of memory and scan – conversion time. 1. 8 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. 9 10 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. 11 Point Smoothing Line Smoothing glEnable (GL_POINT_SMOOTH); glEnable (GL_LINE_SMOOTH); (no need for blending) glEnable (GL_BLEND); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPH A); 12 13 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. 14