University of Babylon College of Computer Technology Department of Information Network Day: Thursday Date: 12-12-2013 Stage: Second Topic: Introduction to Computer Graphics Lecture8: Rendering and Projections By Suad Abdullelah Alasadi 1. Vector and Raster Data Computer images are classified into two general types: those defined as a pixel map and those defined as one ormore vector commands. In the first case we refer to raster graphics and in the second case to vector graphics. Figure 2-1, on the following page, shows two images of a cross, first defined as a bitmap, and then as a set of vector commands. The left-side image of Figure 2-1 shows the attribute of each pixel encoded in a bitmap. The simplest scheme consists of using a 0-bit to represent a white pixel and a 1-bit to represent a black pixel. Vector commands, on the other hand, refer to the geometrical elements in the image. The vector commands in Figure 2-1 define the image in terms of two intersecting straight lines. Each command contains the start and end points of the corresponding line in a Cartesian coordinate plane that represents the system’s video display. An image composed exclusively of geometrical elements, such as a line drawing of a building, or a machine part, can usually be defined by vector commands. On the other hand, a naturalistic representation of a landscape may best be done with a © 2003 by CRC Press LLC bitmap. Each method of image encoding, raster- or vector-based, has its advantages and drawbacks. One fact often claimed in favor of vector representation is the resulting memory savings. For example, in a video surface of 600-by-400 screen dots, the bitmap for representing two intersecting straight lines encodes the individual states of 240,000 pixels. If the encoding is in a two-color form, as in Figure 2-1, then 1 memory byte is required for each 8 screen pixels, requiring a 30,000-byte memory area for the entire image. This same image can be encoded in two vector commands that define the start and end points of each line. By the same token, to describe in vector commands a screen image of Leonardo’s Mona Lisa would be more complicated and memory consuming than a bitmap. Figure 2-1 Raster and Vector Representation of a Graphics Object In the 3D graphics rasterized images are mostly used as textures and backgrounds. 3D rendering is based on transformations that require graphics objects defined by their coordinate points. Software operates mathematically on these points to transform the encoded images. For example, a geometrically defined object can be moved to another screen location by adding a constant to each of its coordinate points. In Figure 2-2 the rectangle with its lower left-most vertex at coordinates x = 1, y = 2, is translated to the position x = 12, y = 8, by adding 11 units to its x coordinate and 6 units to its y coordinate. 2. The Rendering Pipeline A common interpretation of the rendering process is to consider it as a series of trans formations that take the object from the coordinate system in which it is encoded, into the coordinate system of the display surface. This process, sometimes referred to as the rendering pipeline, is described as a series of spaces through which the object mi- grates in its route from database to screen. Waterfall model of the rendering pipeline is shown in The rendering can be defined as transform the image from 3D world coordinate to 2D image coordinate , the following figures shows the steps of rendering 3D Primitives 3D Modeling Coordinates Modeling Transformation Lighting Viewing Transformation Projection Transformation Clipping View Port Transformation Scan Conversation 2 D Image Coordinates Image Display 3. PROJECTIONS Transform 3D objects on to a 2D plane using projections. 3.1 types of projections *Perspective projection *Parallel projection In parallel projection, coordinate positions are transformed to the view plane along parallel lines. In perspective projection, object position is transformed to the view plane along lines that converge to a point called projection reference point (center of projection). Perspective Projection Parallel Projection