INT 840E Computer graphics Introduction & Graphic’s Architecture.

21
INT 840E Computer graphics Introduction & Graphic’s Architecture

Transcript of INT 840E Computer graphics Introduction & Graphic’s Architecture.

INT 840EComputer graphics

Introduction & Graphic’s Architecture

Computer graphics

The art of producing images and animations in the computer.

This includes the software and hardware that generates images.

Application: The object is an artist’s rendition of the sun for an animation to be shown in a domed environment (planetarium)

Software: Graphics are built on top of a software e.g OpenGL

Hardware: PC with graphics card for modeling and rendering

Model: An mathematical representation of a scene suitable for graphical representation. A scene can be represented in shapes, texture, layout and material.

Rendering: Projecting the objects (perspective), handling visibility(identifying which parts to be hidden) and computing their appearance and lighting interactions.

Pixel: Discrete representation of picture elements which determines the image resolution.

Components of Computer Graphics

Modeling: Defining objects in terms of primitives, coordinates and characteristics

Storing: Storing scenes and images in memory and on disk

Manipulating: Changing the shape, position and characteristics of objects

Viewing: Displaying images from various viewpoints on various devices

The coordinate systems

OpenGL places the origin in the lower left corner of the screen

The coordinate system is defined by (x,y) Color data is stored in frame buffers Primitive operations

setpixel (x,y,color) Sets the pixel at position (x,y) to the given color

getpixel(x,y) Gets the color at position (x,y)

Basic line Drawing

Set the color of the pixel to approximate the appearance of a line from (x0,y0) to (x1,y1)

Lines are the basic unit of drawing polygons

Color set before rendering

2D-Graphics

Screen coordinate system Pixels Regular Cartesian grid Origin (0,0)

World coordinate system Scene space Application specific, flexibility(Zoom) Represents real world distance and space

Viewpoint Rectangular region of the screen used to

display drawing

Elements of a Picture There are four common elements of a picture:

polylines, filled regions, text, raster images.

Polylines A polyline is a finite sequence of line segments

(edges) joined end to end to vertices. A single line segment is a special case. A polyline is closed if it ends where it starts. A polyline is simple if it does not self-intersect. A simple, closed polyline is also called a simple

polygon.

Polyline cont’d

A polyline in the plane is a sequence of the (x; y) coordinates of its vertices.

Polyline representation1. Graphical attributes (color, line width

2. Line style (solid, dotted, dashed),

3. How consecutive segments are joined (rounded, mitered or beveled.

 Many graphics systems support common special cases of curves e.g circles, ellipses, circular and arcs.

Filled regions Filled polylines with a color or repeating pattern. A polyline with embedded “holes” also naturally

defines a region that can be filled. Even if a polyline is not simple, it is possible to

generalize the notion of interior

Texts Text can be thought of as a sequence of

characters in some font. Attributes of a text includes:

The font’s face (Times-Roman, Courier) The weight (normal, bold, light) The style or slant (normal, italic, oblique) The size, measured in points The color.

Example

Face: Times New Roman Style: Slanted

Weight :Bold Size : 10 points

Raster Images

Any computer generated 2-dimensional array of square cells called pixels.

Also called pixel maps. Image made up of black and white pixels is

called a bitmap. For gray-scale (or monochrome) raster

images , each pixel is represented by assigning it a numerical value from 0 to 255, ranging from black to white). 

Graphics Devices Raster Display: The display consists of a

two-dimensional array of pixels. There are two types of raster displays.

1. Video displays: Screen with a phosphor coating, that allows each pixel to be illuminated momentarily when struck by an electron beam.

2. Liquid crystal displays (LCD’s): use an electronic field to alter polarization of crystalline molecules in each pixel.

Image Generation The computer program stores the image in a

two-dimensional array in RAM of pixel values called a frame buffer.

The display hardware produces the image line-by-line (called raster lines).

A hardware device called a video controller constantly reads the frame buffer and produces the image on the display.

A program modifies the display by writing into the frame buffer, and thus instantly altering the image that is displayed.

Display Processor

Display processor (graphics card) is used to accelerate graphics display by maintaining the frame buffer.

A display processor does the following: Transformation: Rotations and scalings

used for moving objects and the viewer’s location.

Clipping: Removing elements that lie outside the viewing window.

Projection: Applying the appropriate perspective transformations.

Shading and Coloring: The color of a pixel may be altered by increasing its brightness.

Texturing: Coloring objects by “painting” textures onto their surface.

Hidden-surface elimination: Determines which of the various objects that project to the same pixel is closest to the viewer and hence is displayed.

Color In Graphics Color: The method chosen for representing color

depends on the characteristics of the graphics output device (e.g., additive as are video displays or subtractive as are printers). It also depends on the number of bits per pixel that are provided, called the pixel depth. e.g a 24-bit RGB.

Each pixel is represented as a mixture of red, green and blue components, and each of these three colors is represented as a 8-bit quantity (0 for black and 255 for the brightest color).

In many graphics systems it is common to add a fourth component, sometimes called alpha to represent the transparency.

Color map or color look-up-table (LUT) is used to achieve smaller pixel color buffer . Each pixel is represented by an 8-bit quantity in the range from 0 to 255.

This number is an index to a 256-element array, each of whose entries is a 234-bit RGB value. To represent the image, we store both the LUT and the image itself.

The 256 different colors are usually chosen so as to produce the best possible reproduction of the image.

Digital halftoning. Colors are approximated by putting combinations of similar colors in the same area. The human eye averages them out.

How do we represent reality1. Meshes

2. Points

3. Sub division of surfaces

4. Geometry