82f724fad64f29f0e55b49d67346fe31.ppt
- Количество слайдов: 62
Attributes of Output Primitives Definition Parameter that affects the way a primitive will be displayed Line Attribute. Type. Width. Color. Pen & Brush
Line Attribute Type. Solid. Dotted – very short dash with spacing equal to or greater than dash itself. Dashed – displayed by generating an interdash spacing Pixel count for the span and interspan length is specified by the mask. Ex. 11110001111 Note : Fixed pixel with dashes can produce unequal length dashes. It depend on line orientation. So, need to adjust the number of plotted pixels for different slopes.
Line Attribute Width. Specify in pixels and proportion of a standard line width. . Thicker line can be produced by. . Adding extra pixel vertically when |m| < 1. Adding extra pixel horizontally when |m| > 1. Issues: . Line have different thickness on the slope. Problem with . End of the line . Joining the two lines (polygon)
Attributes of Output Primitives
Attributes of Output Primitives
Line Attribute Pen and Brush. The selected “pen” or “brush” determine the way a line will be drawn. . Pens and brushes have size, shape, color and pattern attribute. . Pixel mask is applied in both of them.
Curve Attribute Similar to line : type + width Thicker curves can be produced by: 1. Plotting additional pixel 2. Filling the space between two concentric circles. 3. Using thicker pen or brush
Attributes for characters/strings • • style font (typeface) color size (width/height) orientation path spacing alignment
Text attributes
Text attributes, cont’d
Text attributes, cont’d
Text attributes, cont’d
Color as attribute Each color has a numerical value, or intensity, based on some color model. A color model typically consists of three primary colors, in the case of displays Red, Green and Blue (RGB) For each primary color an intensity can be given, either 0 -255 (integer) or 0 -1 (float) yielding the final color 256 different levels of each primary color means 3 x 8=24 bits of information to store
Color representations Two different ways of storing a color value: 1) a direct color value storage/pixel 2) indirectly via a color look-up table index/pixel (typically 256 or 512 different colors in the table)
COLOR AND GRAY SCALE LEVEL Color q Colors are represented by colors codes which are positive integers. q Color information is stored in frame buffer or in separate table and use pixel values as index to the color table. q Two ways to store color information : 1. Direct 2. Indirect
Direct COLOR
Indirect COLOR
Color Look-up Table
Exercise: COLOR What is the size of frame buffer required for the following cases: Case 1 (Direct): Resolution of 1024 * 1024 with 24 bits per pixel Case 2 (Indirect): Same resolution with 8 bit per pixel that indexed out of 16 million available colors Conclusion CLUT is good for storage but cant give a very high resolution picture.
GRAY SCALE LEVEL . Apply for monitor that have no color . Shades of grey (white->light grey->dark grey->black). Color code mapped onto grayscale codes. 2 bits can give 4 level of grayscale. 8 bits per pixel will allow 256 combination. Dividing the actual code with 256 will give range of 0 and 1 Ex: Color code in color display is 118 light gray Shade Binary code 0 black 00 0. 33 Dark grey 01 0. 67 To map to nearest grayscale then 118/256 = 0. 45 Scale Light Grey 10 1 White 11
AREA FILLED ATTRIBUTE. Option for filling a defined region is whether solid , pattern and colors. Fill Styles. Three basic fill styles are: . hollow with color border. . interior color is same with background
AREA FILLED ATTRIBUTE. filled with a solid color. . color up to and including the border pattern . . control by other table
AREA FILLED ATTRIBUTE. Color-Blended Fill Region -Soft-fill -Tint-fill P = t. F + (1 -t)B where 0 < t < 1 If t < 0. 5 , background color contributes more to the interior color of the region than does the fill color.
Filled-Area Primitives
Filled-Area Primitives
Filled-Area Primitives
Filled-Area Primitives
Filled-Area Primitives
Filled-Area Primitives
Filled-Area Primitives
Filled-Area Primitives Refer to CG(Hearn and Baker) Some special need handling on polygons intersection. - Where vertex is the meeting point of two edges. - If the two edges of vertex is on the same side – filling is no problem. - If the two edges are on the opposite – will cause some filling problem
Filled-Area Primitives Some special need handling on polygons intersection. Solution - Shorten the pixel so the two edges do not meet. - If the value of y is decreasing then y coordinate of the upper endpoint of the edge following current edges. - If the value of y is increasing then, value of y of the upper endpoint for the current edges is decreased by 1.
Filled-Area Primitives
Filled-Area Primitives
Filled-Area Primitives
Pattern Fill Ex: Table with two dimensional array of color codes. Index 1: Cpa[1, 1] = 4 Cpa[2, 2] = 4 | 4 0 | Cpa[1, 2] = 0 | 0 4 | Cpa[2, 1] = 0 Index 2: Cpb[1, 1] = 4 Cpb[2, 2] = 4 Cpb[3, 3] = 4 Cpb[1, 2] = 6 Cpb[2, 1] = 6 Cpb[2, 3] = 6 Cpb[1, 3] = 4 Cpb[3, 1] = 4 Cpb[3, 3] = 4 | 4 6 4 | | 6 4 6 | | 4 6 4 |
Pattern Fill So to set the pattern: ex command is Set. Pattern. Representation (ws, pi, nx, ny, cp) Where ws is polygon edges pi is set the pattern index cp is a 2 -dimensional array color code of nx and ny. . Filling an area with rectangular pattern is called tiling. . Some pattern been generated based on and, or, xor, replace logic which result based on the foreground and background color. . Soft Fill is a method where factor is given in order to control the transparency of background and foreground P = t. F+(1 -t)B {here, F is foreground color, B is background color, t is transparency factor between 0 and 1 for each pixel & F ≠ B}
• P=(PR, PG, PB), F=(FR, FG, FB), B=(BR, BG, BB) • t = (PK-Bk)/(FK-Bk), k= R, G or B
Bundled Attributes When each function reference a single attribute that specify exactly how primitive to be displayed ; then its called individual (unbundled attribute). . Bundled attributes is where a set of attributes value can be chosen by specifying the appropriate index table. . The table for each primitive that defines group of attribute values is called bundled table. . Attribute that can be bundled are: . Bundled Line Attribute. Bundled Area-Fill Attribute. Bundled Text Attribute. Bundled Marker Attribute
Antialiasing Aliasing ≈ the fact that exact points are approximated by fixed pixel positions Antialiasing = a technique that compensates for this (more than one intensity level/pixel is required)
ANTIALIASING
ANTIALIASING
ANTIALIASING This distortion is due to low-frequency sampling and it is called aliasing. . To improve the appearance is called antialiasing method. . The straight line. circle and ellipse drawing algorithms have to decide which pixel are closest to line. . Scan conversion samples a line and choose which of the much smaller number of pixel on the screen to plot to represent a line.
Aliasing • Distortion of information due to low-frequency sampling frequency What we “see” • In raster images – leads to jagged edges with staircase effect. Commonly occurs when a pattern has details that are smaller than a pixel in width • We can reduce effects by antialiasing methods to compensate for undersampling
Antialiasing Simple perspective projected texture With some antialiasing
Antialiasing Effectively: BLUR edges to make them look smooth
Nyquist sampling frequency • Set sampling frequency to at least twice that of the highest frequency occuring in the object to avoid information loss from periodic objects. fs = 2 fmax
Nyquist sampling interval • Sampling interval should be no more than one-half cycle interval xs = xcycle / 2 Where ∆xcycle = 1 / fmax
ANTIALIASING Increasing Screen Resolution
ANTIALIASING Supersampling
ANTIALIASING
ANTIALIASING
ANTIALIASING
ANTIALIASING
Supersampling Example Use twice the available resolution 4 pixels (2 x 2 square) for every 1 in the original
But we don’t actually render this hi-res line. Instead we downsample it using a “trick” Average out the colours in the 4 pixel squares
Antialiasing by polygon boundary
ANTIALIASING
Antialiasing, a method A polygon will be studied (as an example). Area sampling (prefiltering): a pixel that is only partly included in the exact polygon, will be given an intensity that is proportional to the extent of the pixel area that is covered by the true polygon
Area sampling P = polygon intensity B = background intensity f = the extent of the pixel area covered by the true polygon pixel intensity = P*f + B*(1 - f) Note! Time consuming to calculate f
ANTIALIASING
ANTIALIASING
82f724fad64f29f0e55b49d67346fe31.ppt