220 likes | 599 Views
Computer Graphics Raster Devices Transformations. Areg Sarkissian. Raster Devices. Most displays used for computer graphics are raster displays. The surface of raster displays has a certain number of pixels that it can show, such as 640 X 480 ~ 307,000 pixels
E N D
Computer GraphicsRaster DevicesTransformations Areg Sarkissian
Raster Devices • Most displays used for computer graphics are raster displays. • The surface of raster displays has a certain number of pixels that it can show, such as 640 X 480 ~ 307,000 pixels • All raster displays have a built-in coordinate system that associates a given pixel in an image with a given physical position on the display surface. • The horizontal coordinate Sx increases from left to right, and the vertical coordinate Sy increases from top to bottom. They have an upside-down coordinate system. (0,0) (639,0) (0,479) Consist of three main parts: 1) Frame Buffer 2) Scan Controller 3) Digital to Analog Converter (DAC)
Frame Buffer • A region of memory sufficiently large to hold all of the pixel values for display. • A graphic card that is installed in a personal computer actually houses the memory required for the frame buffer. • The display memory can be thought of a two dimensional array: mem[x][y]
Scan Controller & DAC • The scan controller causes the frame buffer to send each pixel through a converter to the appropriate physical spot on the display surface. • The scan controller addresses one pixel value, mem[x][y], in the frame buffer at the same time it addresses one position, (x, y), on the face of CRT. • The converter takes a pixel value such as 010010 and converts it to the corresponding quantity that produces a spot for each red, green, and blue colors on the display. • The dots are so close together that eye sees one composite dot and a single color that is the sum of the three component colors. Thus, the composite dot can be made glow in a total of 4x4x4=64 different colors.
Scan Controller & DAC Some of the more expensive systems have a frame buffer that support 24 planes of memory. Each of the DACs has eight input bits, so there are 256 level of red, green, blue. (16 million colors) Monochrom A single DAC converts pixel values in the frame buffer to voltage levels, which drive a single electron-beam gun. Note that 6 planes in frame buffer give 64 levels of gray.
Indexed Color and the Lookup Table • A color lookup table (LUT), which offers a programmable association between a pixel value and the final displayed color • The color depth is again six, but the 6 bits stored in each pixel go through an intermediate step before they drive the CRT. • These bits are used as an index into a table of 64 values (LUT[0]…LUT[63]) • Each LUT[i] contains a 15-bit value, which every five bits drives corresponding DAC. (Red, Green, Blue) • The set of 2^15 possible colors that the system is capable of displaying is called its palette, so the palette for this system is 32K colors • Since LUT has only 64 bits index, so it can only show 64 different color at a time on the screen.
Coordinates Translation Usually the upside-down coordinates of raster displays are translated to a more familiar coordinates (Cartesian Coordinates) in programming languages, such as OpenGL. y x (0, 0)
Transformations Transformations are very useful in computer graphics in a number of situations: • A scene can be fashioned by placing a number of instances of an object at different places and with different sizes using proper transformation. • A single motif can be designed and then fashion the whole shape of an object by reflection, rotation, and translation of the motif. (ex. Snowflake) • Helps a designer to view an object from different vantage points and make a picture from each one. • In a computer animation, several objects must move relative to one another from frame to frame.
Transformations • A transformation alters each point P in space (2D or 3D) into a new point Q by means of a specific formula or algorithm. • An arbitrary point P in the plane is mapped to another point Q. We say that Q is the image of P under the mapping T. • An object is being transformed by transforming each of its points using the same function T(P) for each point. Points are represented as: y Q=T(P) y Q=T(P) P P x x z
Affine (or Linear) Transformations Types of Affine Transformations: • Translation • Scaling • Reflection • Rotation An affine transformation is represented by matrices.
Translation • Translates a picture into a different position on a graphics display. • The translation part of the affine transformation arises from the third column of the matrix for 2D and forth column for 3D. 2D 3D Example: 2D translation
Scaling Changes the size of a picture and involves two scale factors Sx and Sy for the x- and y-coordinates (Qx, Qy) = (SxPx, SyPy) Thus, the matrix for scaling is simply: 3D 2D Example:
Reflection If a scale factor is negative, then there is also a reflection about a coordinate axis. About x-axis About y-axis P Example: reflection about x-axis x Q=T(P)
2D Rotation The rotation of a figure about a given point through some angle. The matrix for 2D rotation about origin: Example: P=(x, y) and Q=T(P) 60 P
3D Rotation The 3D rotation matrices about each coordinate: About x-axis (x-roll) About y-axis (y-roll) About z-axis (z-roll)
Rotation about an arbitrary point The result of this rotation will be product of three matrices. Step 1) Translation (a, b) to (0, 0) Step 2) Rotation point P about origin (0, 0) Step 3) Translation (0, 0) to (a, b) Example: (a, b) is an arbitrary point and P=(x, y) T(P)=Q P (a, b) (0,0) Step 3 Step 2 Step 1
References Computer Graphics – Using OpenGL F.S Hill, Jr