Transcript Document

Advanced Computer Graphics 컴퓨터그래픽스특론

Spring 2013 2013 학년도 /1 학기 Brian J. d’Auriol 경희대학교 국제캠퍼스 용인시

• • • • • • • • • • • • • Course Outline

Definitions, terms, history, graphics pipeline, graphics systems Basic line and curve drawing, raster algorithms Graphical elements: points, lines, curves, surfaces, parametric curves (cubic, Hermite, Bezier) Graphical elements: points, lines, curves, surfaces, parametric curves continued set of drawing algorithms (convex hull, etc.) 2D and 3D transformations and projections Camera color theory color transformation algorithms lighting and shading.

ray tracing, volume rendering, CSG multimedia graphics in practice

Overview of Graphics Pipeline

object/model space

Model transforming

world space

View transformation

eye/camera/ view space

Object coordinates used for individual mathematical object models. Local properties World coordinates that all objects are placed into; establishes spatial relationships of all objects.

Viewing/eye coordinates , eye is placed at origin in direction of z-axis Culling, lighting, shading Projection

Display screen device raster window space

Window/screen coordinates (2D) , Rasterization, hidden surface removal, Fragment operations (coloring) Viewport transformation

device screen space

Perspective divide normalized device coordinates (NDC) [-1,-1,-1] to [1,1,1] transformation

clip space

Clip coordinates , clipping, viewable objects from the eye,

Vector Graphics

• Vector graphics – Mathematical primitives

• Points, lines, curves shapes, polygons • Localized primitive properties – Color, thickness, coordinate origin Postscript example newpath 10 10 moveto 100 100 lineto 100 200 lineto closepath stroke showpage

Raster

• Artifacts

– Smoothness decreases as sampling distance increases • Jagged lines – Non-uniform luminance – Non-uniform line thickness

Raster Technology

• Light emitting

Phosphors

– CRT • Phosphor coated screen • (color) Shadow mask (square) • (color) Beam penetration • (color) Aperture grille (stripes) – LCD • E.g.: Apple iPhone Retina display [1] – 960-by-640 pixel resolution, pixel density = 326 pixels per inch

Source (electron gun)

Shadow-mask method common in color CRT displays (round pixels shown only for illustration purpose) • Light absorbance – Light-emitting Diode (LED) – Organic Light-emitting Diode (OLED) • E.g.: Google’s Nexus One [2] – 800-by-480 pixel resolution, uses subpixel alternating tiled technology – Printers • Vector (non-raster) – Plotters – Plasma – Thin-film [1] Chris Brandrick, IPhone 4’s Retina Display Explained, PCWorld, June 7, 2010, 4:01pm, online [2] Sarah Jacobsson, Nexus One’s Screen is Gorgeous, But with Issues, PCWorld, Feb. 23, 2010, 11:00pm, online.

Pixel

• Pixel geometries

– Geometry of pixel • Square • rectangular – Geometry of primary arrangement • Delta • Stripes – Most: RGB ordering, but some: BRG ordering • diagonal Clockwise from top left: a standard definition CRT television. "Palsonic" brand. (this image is significantly reduced compared to others) A CRT computer monitor. Diamond View 19" (18" viewable). Model 1995SL. A laptop LCD: Lenovo X61, 12" 1024 ×768. The OLPC XO-1 LCD display. (Test-B2) [modified from source: http://commons.wikimedia.org/wiki/File:Pixel_geometr y_01_Pengo.jpg, accessed 2013.03.09] This image is copyrighted Peter Halasz and licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license; obtained from http://commons.wikimedia.org/wiki/File:Pixel_geometry_01_Pengo.jpg accessed on 2013.03.09 (March). The copyright holder neither endorses nor uses the collective work of this presentation. Notwithstanding the copyright of this presentation, and in accordance with the license, subsequent uses of this figure are governed by its license.

Pixel

• Subpixel rendering

– Suitable for LCD-based displays • Note, stripes-based pixel geometries. – Addressable primary-color selections – Increases smoothness – Current application • Font display (common) • Rasterization (not common)

• Subpixel rendering (continued)

– Issues • Color Fringe Error – Noticeable colorizations can appear at edges • Display hardware variations – Standardized & wide applicability of software more difficult • Software raster editors not well developed for subpixel editing support

Pixel

• Multi-primary-color (MPC) display

– Additional color sub-pixels: • E.g.: RGBCMY [1] – Advantages: wider color gamut, reduce power consumption [2] [1] Young-Chol Yang, Keunkyu Song, SooGuy Rho, Nam-Seok Rho,SungJin Hong, Kang Beo Deul, Munpyo Hong, Kyuha Chung, WonHee Choe, Sungdeok Lee, Chang Yong Kim,Sung-Hee Lee and Hyong-Rae Kim, Development of Six Primary-Color LCD, SID Symposium Digest of Technical Papers, Vol. 36, Issue 1, pp 1210-1213, 2005, online. [2] Masatsugu Teragawa, Akiko Yoshida, Kazuyoshi Yoshiyama, Shinji Nakagawa, Kazunari Tomizawa and Yasuhiro Yoshida, Display Imaging (Color) You have full text access to this contentReview Paper: Multi-primary-color displays: The latest technologies and their benefits, Journal of the Society for Information Display, Vol. 20, Issue 1, pp. 1-11,january 2012, online.

Raster

• Device – Physical light emitting point • Aspect ratios – Storage aspect ratio (SAR) • Ratio of width to height of image – (Display) Aspect ratio (DAR) • Ratio of width to height when image is displayed • Common 4:3 (older), 16:9 or 16:10 (newer) – Pixel aspect ratio (PAR) • Ratio of width to height of pixel • Pixel density – pixels per linear unit of length, e.g. PPI pixels per inch – Measures input resolution of devices • Higher value, larger file size • Viewing direction (sometimes referred to as viewing angle) – Maximum inclination and azimuth angles • Viewing cone – The region of viewing directions for acceptable viewing

Bresenham’s Line Algorithm

Assumption: simple square and regular orthogonal grid of pixels. Horizontal. vertical and diagonal lines have co-linear pixels, all other lines do not.

9 11 10 2 3 4 1 12 5 13 6 8 0 7 15 14 O 1 2 3 4 5 6 7 8 9 Lines can be located in one of 16 different regions: 8 regional spaces (0-7) or aligned along one of 4 lines (8-12, 9-13,10-14 and 11-15). Lines have directions and therefore each of these four line placements has two direction for a total of 8 placement combinations

Bresenham’s Line Algorithm

Slope and increment definition for all regions National Semiconductor Application Note 611, Rick Pelleg, Bresenham’s Line Algorithm Implemented for the NS32Gx32, Technical Specification Sheet, Sept. 1989, online.

Bresenham’s Line Algorithm

O 1 2 3 4 5 6 7 8 9 Develop algorithms for bounded region, positive quadrant, slope < 1 Mel Slater, Anthony Steed and Yiorgos Chrysanthou, Computer Graphics and Virtual Environments From Realism to Real-Time, Addison Wesley, 2002

Bresenham’s Line Algorithm

Assumptions origin Not horizontal Not vertical Slope less than one O 1 2 3 4 5 6 7 8 9 Line: 2-point equation y i +1 U I: point of intersection between line and x=i+1 Line: point-slope equation y i i i+1 L Each iteration: Given: selected pixel at column i Compute: pixel at column i+1

Bresenham’s Line Algorithm

Set error term for incremental column by column calculation.

U I: point of intersection y i +1 between line and x=i+1 y i i i+1 L Each iteration: Given: selected pixel at column i Compute: pixel at column i+1 Mel Slater, Anthony Steed and Yiorgos Chrysanthou, Computer Graphics and Virtual Environments From Realism to Real-Time, Addison Wesley, 2002

Edge Coords

Polygon Rasterization

y1 structure a (1,1) to (4,7) 1 (7,1,3/6) b (7,2) to (4,7) 2 (7,7, -3/5) dx/dy = (4-1)/(7-1) = 3/6 Algorithm c (7,2) to (4,4) 2 (4,7, -3/2) 1. Initialize Active Edge Table (AET) to empty d (1,1) to (4,4) 1 (4,1,3/3) 2. for (i=ymin, i<=ymax, i++) // for each scan line e = (x1,y1)(x2,y2) | y1 < y2, x1 != x2 (y2, x1, dx/dy) line direction ordered Edge Table not horizontal 1. Delete from AET entries with y=i 2. Compute x1 += dx/dy for rest of entries y1 Edge sequences 1 (7, 1, 3/6), (4, 1 ,3/3) (a),(d) 3. Join ET[i] to AET 4. Sort AET by x1 5. Join horizontal lines between pairs of x1, 2 (7, 7,-3/5), (4, 7,-3/2) (b),(c) at height i a d c b O 1 2 3 4 5 6 7 8 9

Edge Coords

Polygon Rasterization

y1 structure a (1,1) to (4,7) 1 (7,1,3/6) b (7,2) to (4,7) 2 (7,7, -3/5) dx/dy = (4-1)/(7-1) = 3/6 Algorithm c (7,2) to (4,4) 2 (4,7, -3/2) 1. Initialize Active Edge Table (AET) to empty d (1,1) to (4,4) 1 (4,1,3/3) 2. for (i=ymin, i<=ymax, i++) // for each scan line e = (x1,y1)(x2,y2) | y1 < y2, x1 != x2 (y2, x1, dx/dy) line direction ordered Edge Table not horizontal 1. Delete from AET entries with y=i 2. Compute x1 += dx/dy for rest of entries y1 Edge sequences 1 (7, 1, 3/6), (4, 1 ,3/3) (a),(d) 3. Join ET[i] to AET 4. Sort AET by x1 5. Join horizontal lines between pairs of x1, 2 (7, 7,-3/5), (4, 7,-3/2) (b),(c) at height i a d c b O 1 2 3 4 5 6 7 8 9 Steps 1-2.2: i=1, do nothing, Step 3-4: (7,1,1/2)(4,1,1) already sorted Step 5: draw scan line 1 to 1

Edge Coords

Polygon Rasterization

y1 structure a (1,1) to (4,7) 1 (7,1,3/6) b (7,2) to (4,7) 2 (7,7, -3/5) dx/dy = (4-1)/(7-1) = 3/6 Algorithm c (7,2) to (4,4) 2 (4,7, -3/2) 1. Initialize Active Edge Table (AET) to empty d (1,1) to (4,4) 1 (4,1,3/3) 2. for (i=ymin, i<=ymax, i++) // for each scan line e = (x1,y1)(x2,y2) | y1 < y2, x1 != x2 (y2, x1, dx/dy) line direction ordered Edge Table not horizontal 1. Delete from AET entries with y=i 2. Compute x1 += dx/dy for rest of entries y1 Edge sequences 1 (7, 1, 3/6), (4, 1 ,3/3) (a),(d) 3. Join ET[i] to AET 4. Sort AET by x1 5. Join horizontal lines between pairs of x1, 2 (7, 7,-3/5), (4, 7,-3/2) (b),(c) at height i a d c b O 1 2 3 4 5 6 7 8 9 Step 2: i=2 Step 2.1: none Step 2.2: 1+=0.5, 1+=1 Step 2.3 (7,1.5,0.5),(4,2,1),(7,7,-0.6)(4,7,-1.5) Step 2.4: sorted Step 2.5: draw scan line 1.5 to 2 and 7 to 7

Masatsugu Teragawa, Akiko Yoshida, Kazuyoshi Yoshiyama, Shinji Nakagawa, Kazunari Tomizawa and Yasuhiro Yoshida, Review Paper: Multi-primary-color displays: The latest technologies and their benefits, Journal of the Society for Information Display, Volume 20, Issue 1, Article first published online: 29 JUN 2012