Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Graphics Chapter 6 Andreas Savva. 2 Interactive Graphics Graphics provides one of the most natural means of communicating with a computer. Interactive.

Similar presentations


Presentation on theme: "Computer Graphics Chapter 6 Andreas Savva. 2 Interactive Graphics Graphics provides one of the most natural means of communicating with a computer. Interactive."— Presentation transcript:

1 Computer Graphics Chapter 6 Andreas Savva

2 2 Interactive Graphics Graphics provides one of the most natural means of communicating with a computer. Interactive computer graphics permits user- computer interaction.

3 3 Graphics Software Programming packages (OpenGL) Designed for programmers General-Purpose Applications packages (Paint) Designed for non-programmers

4 4 Graphics Functions A general-purpose graphics package provides users with a variety of functions for creating and manipulating pictures. These routines can be categorized according to whether they deal with: Output Input Attributes Transformations Viewing General control

5 5 Output Primitives basic tools for constructing pictures Character strings Geometric entities Points Straight lines Curved lines Filed areas (Polygons, Circles, etc) Shapes defined with arrays or color points

6 6 Attributes properties of the output primitives Intensity Color specifications Line styles Text styles Area-filling patterns

7 7 Geometric Transformations size, position and orientation of an object within the scene Translate Scale Rotate

8 8 Control Operations Clearing a display screen Initialize a parameter

9 9 Software Standards Primary goal – portability Software can be moved easily from one hardware system to another Software can be used in different implementations and applications Without standards, software need to be rewritten for different systems

10 10 A simple Paint Program It should have the ability to work with geometric objects such as line segments and polygons. Given that geometric objects are defined through vertices, the program should allow us to enter vertices interactively. It should have the ability to manipulated pixels, and thus to draw directly into the frame buffer. It should provide control of attributes such as color, line type, and fill patterns. It should include menus for controlling the application. It should behave correctly when the window is moved or resized.

11 11 Coordinate Representations Modeling coordinates: (x m, y m ) World coordinates: (x w, y w ) Normalized coordinates (Range: 0 - 1): (x n, y n ) Device coordinates: (x d, y d )

12 12 World to Device (x w,y w ) (x d,y d ) Display area

13 13 World to Normalized Normalized to Device

14 14 Device Coordinates (x w,y w ) (x d,y d ) Display area (x d,DeviceHeight-y d ) (0,0)

15 15 Exercises Assume that the screen monitor has 1200  800 pixels. Find and display: (0,0) (1200,800) 1.the device coordinates for the point (-18,12) if the display area is -25 ≤ x ≤ 8 and -8 ≤ y ≤ 16, as shown below: 2.the device coordinates for the point (-18,12) if the display area is -216 ≤ x ≤ -2 and -30 ≤ y ≤ 30. (-18,12) Display area 8-25 -8 16

16 3.the device coordinates for the triangle shown in the figure below, by using the normalized coordinates which you should calculate first. 4.the device coordinates for the triangle shown above if the display area is 25 ≤ x ≤ 100 and -5 ≤ y ≤ 40. You should also find the device coordinates for the two points where the triangle sides intersect the line x = 25. 5.the world coordinate of the pixel (400,167) for the display area in question 1. (35,30) Display area 5010 -5 40 (43,15) (18,10)

17 17 Pipeline Vs Parallelism Multiprocessing has two basic forms: A pipeline processor contains a number of processing elements (PEs) arranged such that the output of one becomes the input of the next, in pipeline fashion. The PEs of a parallel processor are arranged side-by-side and operate simultaneously on different portions of the data.

18 18 Drawing Pipeline Standard drawing process uses a pipeline of computations Starts with: Collection of polygons Ends with: Image stored in frame buffer (Desired result)

19 19 Pipeline Input device Model traversal new view of the model Model transform Viewing transform Clipping Project & Map to Viewport Lighting Shading Rasterization Display

20 20 Model Traversal Data structure of Polygons Each polygon in own coordinate system List: 01230123

21 21 Modeling Transformations Move each polygon to its desired location Operations: Translate, Scale, Rotate 01230123 x y

22 22 Clipping Viewport is the area of the Frame Buffer where the new image is to appear Clipping eliminates geometry outside the viewport Viewport Clipping Resulting Polygon

23 23 Project & Map to Viewport Projection takes 3D data and flattens it to 2D Eye Projection Plane (Screen)

24 24 Lighting Simulate effects of light on surface of objects Each polygon gets some light independent of other objects

25 25 Shading Lighting could be calculated for each pixel, but that’s expensive Shading is an approximation: Gouraud shading: Light each vertex Interpolate color across pixels

26 26 Rasterization Find which pixels are covered by polygon: Plane Sweep: For each polygon go line-by-line from min to max go from left boundary to right boundary pixel by pixel Fill each pixel (color & density) 2D Process


Download ppt "Computer Graphics Chapter 6 Andreas Savva. 2 Interactive Graphics Graphics provides one of the most natural means of communicating with a computer. Interactive."

Similar presentations


Ads by Google