1. 2 Blending: tells you how to specify a blending function that combines color values from a source...

14
1 Dr. Aree Ali Mohammed Assistant Professor 2014-2015 3 rd Stage [email protected] University of Sulaimani – Computer Science Dept. Blending and Antialiasing

Transcript of 1. 2 Blending: tells you how to specify a blending function that combines color values from a source...

1

Dr. Aree Ali Mohammed Assistant Professor2014-20153rd [email protected]

University of Sulaimani – Computer Science Dept.

Blending and Antialiasing

2

1. Add extra details and polish your scene

2. Blend colors to achieve such effects as making objects appear translucent

3. Smooth jagged edges of lines and polygons with antialiasing

Objectives

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.

3

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

Color Blending

4

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.

Aliasing versus Antialiasing

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 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

6

Example

7

Aliasing Examples

1. Texture Minification2. Small triangles3. Stair stepping4. Moiré Patterns

8

1. Increasing Resolution

Increase resolution of the raster display. Improvement comes at the price of memory, bandwidth of memory and scan – conversion time.

Methods of Antialiasing I

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.

10

Methods of Antialiasing II

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.

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)

13

Polygon Antialiasing

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.