computer graphics notes

13
1 | Page By Er Gurpreet Singh Visit: http://gsb-programming.blogspot.in BTCS 504 Computer Graphics OBJECTIVES: Understanding the fundamental graphical operations and the implementation on computer, Get a glimpse of recent advances in computer graphics, Understanding user interface issues that make the computer easy for the novice to use. COURSE CONTENTS: 1. Introduction: Computer Graphics and its applications, Elements of a Graphics, Graphics Systems: Video Display Devices, Raster Scan Systems, Random Scan Systems, Input devices. 2. Basic Raster Graphics: Scan conversion- Point plot technique, Line drawing, Circle generating and Ellipse generating algorithms. 3. Two-dimensional Geometric Transformations : Basic Transformations-Translation, Rotation and Scalling, Matrix Representation and Homogeneous Coordinates, Composite Transformations, Reflection and Shearing transformations. 4. Clipping: Window to viewport transformation, Clipping Operations- Point Clipping, Line Clipping, Polygon Clipping and Text Clipping. 5. Filling Techniques: Scan line algorithms, Boundary-fill algorithm, Flood-fill algorithm, Edge fill and fence fill algorithms, 6. Elementary 3D Graphics: Plane projections and its types, Vanishing points, Specification of a 3D view. 7. Visibility: Image and object precision, Hidden edge/surface removal or visible edge/surface determination techniques; z buffer algorithms, Depth sort algorithm, Scan line algorithm and Floating horizon technique. 8. Advance Topics: Introduction of Rendering, Raytracing, Antialiasing, Fractals, Gourard and Phong shading.

Upload: gurpreet-singh

Post on 13-Aug-2015

184 views

Category:

Engineering


3 download

TRANSCRIPT

Page 1: Computer Graphics Notes

1 | P a g e B y E r G u r p r e e t S i n g h

Visit: http://gsb-programming.blogspot.in

BTCS 504 Computer Graphics

OBJECTIVES:

Understanding the fundamental graphical operations and the implementation on

computer, Get a glimpse of recent advances in computer graphics, Understanding user

interface issues that make the computer easy for the novice to use.

COURSE CONTENTS:

1. Introduction: Computer Graphics and its applications, Elements of a Graphics,

Graphics Systems: Video Display Devices, Raster Scan Systems, Random Scan

Systems, Input devices.

2. Basic Raster Graphics: Scan conversion- Point plot technique, Line drawing, Circle

generating and Ellipse generating algorithms.

3. Two-dimensional Geometric Transformations : Basic Transformations-Translation,

Rotation and Scalling, Matrix Representation and Homogeneous Coordinates, Composite

Transformations, Reflection and Shearing transformations.

4. Clipping: Window to viewport transformation, Clipping Operations- Point Clipping, Line

Clipping, Polygon Clipping and Text Clipping.

5. Filling Techniques: Scan line algorithms, Boundary-fill algorithm, Flood-fill algorithm,

Edge fill and fence fill algorithms,

6. Elementary 3D Graphics: Plane projections and its types, Vanishing points,

Specification of a 3D view.

7. Visibility: Image and object precision, Hidden edge/surface removal or visible

edge/surface determination techniques; z buffer algorithms, Depth sort algorithm, Scan

line algorithm and Floating horizon technique.

8. Advance Topics: Introduction of Rendering, Raytracing, Antialiasing, Fractals, Gourard

and Phong shading.

Page 2: Computer Graphics Notes

2 | P a g e B y E r G u r p r e e t S i n g h

Visit: http://gsb-programming.blogspot.in

Computer graphics are pictures and movies created using computers - usually referring

to image data created by a computer specifically with help from specialized graphical hardware

and software. It is a vast and recent area in computer science. The phrase was coined by

computer graphics researchers Verne Hudson and William Fetter of Boeing in 1960. Another

name for the field is computer-generated imagery, or simply CGI

Computer graphics are visual representations of data displayed on a monitor made on

a computer. Computer graphics can be a series of images (most often called video) or a single

image.

Computer graphics are very useful. Computer-generated imagery is used for movie making, video

game and computer program development, scientific modeling, and design for catalogs and

other commercial art. Some people even make computer graphics as art.

Computer graphics can be 2D or 3D. They are made differently and used differently. People use

different computer programs to make different types of graphics

2D graphics

2D computer graphics are usually split into two categories: vector graphics and raster graphics.

Vector graphics

Vector graphics use lines, shapes, and text to create a more complex image. If a vector graphic

image is made very big on the monitor, it will still be as good as its regular size. This is one of the

reasons vector graphics are liked so much. Vector graphics are made with programs like Adobe

Illustrator and Inkscape, and were used for some older computer games. Today, they are often

used for when computer graphics have to be printed out.

Examples of vector graphics

A car.

Page 3: Computer Graphics Notes

3 | P a g e B y E r G u r p r e e t S i n g h

Visit: http://gsb-programming.blogspot.in

A compact fluorescent light bulb.

Figure: Vector Scan System

Page 4: Computer Graphics Notes

4 | P a g e B y E r G u r p r e e t S i n g h

Visit: http://gsb-programming.blogspot.in

Raster graphics

Raster graphics use pixels to make up a larger image. This does not mean the artist has to change

a single pixel at a time - raster programs often have tools like paintbrushes, paint buckets, and

erasers to make a picture. Programs used to make these include Adobe Photoshop and Corel

Paint Shop Pro. These are often used as part of what the user sees when she uses a computer

program.

Sometimes people do use only pixels to make an image. This is called pixel art and it has a very

unique style.

Examples of raster graphics

A pixel art image of "The Gunk."

Photographs are raster images.

Page 5: Computer Graphics Notes

5 | P a g e B y E r G u r p r e e t S i n g h

Visit: http://gsb-programming.blogspot.in

Figure: Raster Scan System

Base of

Difference

Raster Scan System Random ( Vector ) Scan System

Electron

Beam

The electron beam is swept across the

screen, one row at a time, from top to

bottom.

The electron beam is directed only to the

parts of screen where a picture is to be

drawn.

Resolution Its resolution is poor because raster system

in contrast produces zig-zag lines that are

plotted as discrete point sets.

Its resolution is good because this

system produces smooth lines drawings

because CRT beam directly follows the

line path.

Picture

Definition

Picture definition is stored as a set of

intensity values for all screen points, called

pixels in a refresh buffer area.

Picture definition is stored as a set of line

drawing instructions in a display file.

Page 6: Computer Graphics Notes

6 | P a g e B y E r G u r p r e e t S i n g h

Visit: http://gsb-programming.blogspot.in

Realistic

Display

The capability of this system to

store intensity values for pixel makes it well

suited for the realistic display of scenes

contain shadow and color pattern.

These systems are designed for line-

drawing and can’t display realistic

shaded scenes.

Draw an

Image

Screen points/pixels are used to draw an

image.

Mathematical functions are used to draw

an image.

Cost It is less expensive than Random Scan

System.

It is Costlier than Raster Scan System.

Line

Drawing

Zig – Zag line is produced because plotted

value are discrete.

Smooth line is produced because directly the line path is followed by electron beam

Refresh

Rate

Refresh rate is 60 to 80 frame per second. Refresh Rate depends on the number of

lines to be displayed i.e 30 to 60 times

per second.

3D graphics

3D graphics are graphics that look like objects because they are three-dimensional. This means

the computer thinks it has a height, a length, and a depth, and displays them as this. Some

programs used to make 3D graphics are Bryce, 3D Studio Max, Maya and Blender, and 3D

graphics are used many times in movies and TV shows and video games.

Pixel: Short for Picture Element, a pixel is a single point in a graphic image. Graphics monitors

display pictures by dividing the display screen into thousands (or millions) of pixels, arranged in

rows and columns. The pixels are so close together that they appear connected.

The number of bits used to represent each pixel determines how many colors or shades of gray

can be displayed. For example, in 8-bit color mode, the color monitor uses 8 bits for each pixel,

making it possible to display 2 to the 8th power (256) different colors or shades of gray.

Persistence: The major difference between phosphors is their persistence. It decides how long

they continue to emit light after the electron beam is removed. Persistence is defined as the time

Page 7: Computer Graphics Notes

7 | P a g e B y E r G u r p r e e t S i n g h

Visit: http://gsb-programming.blogspot.in

it takes the emitted light from the screen to decay to one-tenth of its original intensity. Lower

persistence phosphors require higher refreshing rates to maintain a picture on the screen without

flicker. However it is useful for displaying animations. On the other hand higher persistence

phosphors are useful for displaying static and highly complex pictures

Resolution: For graphics monitors, the screen resolution signifies the number of dots (pixels)

on the entire screen, expressed in terms of the number of pixels on the horizontal axis and the

number on the vertical axis. Some common resolutions are:

CGA (Color Graphics Adapter): 320 x 200

EGA (Enhanced Graphics Adapter): 640 x 350

VGA (Video Graphics Array): 640 x 480

SVGA (Super VGA): 800 x 600

XGA (Enhanced Graphics Array): 1024 x 768

720p: 1280 x 720

1080p: 1920 x 1080

Aspect Ratio: The aspect ratio of a geometric shape is the ratio of its sizes in different

dimensions. For example, the aspect ratio of a rectangle is the ratio of its longer side to its shorter

side - the ratio of width to height when the rectangle is oriented as a "landscape".

The aspect ratio is expressed as two numbers separated by a colon ( x : y ). The values x and y

do not represent actual width and height but, rather, the "relation" between width and height. As

an example, 8:5, 16:10 and 1.6:1 are the same aspect ratio. An aspect ratio of 4:5 means that a

vertical line plotted with four points has the same length as a horizontal line plotted with five points

Input Devices:

Following are few of the important input devices which are used in a computer:

Keyboard

Mouse

Joy Stick

Page 8: Computer Graphics Notes

8 | P a g e B y E r G u r p r e e t S i n g h

Visit: http://gsb-programming.blogspot.in

Light pen

Track Ball

Scanner

Graphic Tablet

Microphone

Magnetic Ink Card Reader(MICR)

Optical Character Reader(OCR)

Bar Code Reader

Optical Mark Reader(OMR)

Video Display Devices:

Cathode-Ray-Tubes: A CRT is an evacuated glass tube. An electron gun at the rear of the tube

produces a beam of electrons which is directed towards the front of the tube (screen). The inner

side of the screen is coated with phosphor substance which gives off light when it is stroked by

electrons. It is possible to control the point at which the electron beam strikes the screen, and

therefore the position of the dot upon the screen, by deflecting the electron beam. The fig below

shows the electrostatic deflection of the electron beam in a CRT.

Page 9: Computer Graphics Notes

9 | P a g e B y E r G u r p r e e t S i n g h

Visit: http://gsb-programming.blogspot.in

The deflection system of the cathode-ray-tube consists of two pairs of parallel plates, referred to

as the vertical and horizontal deflection plates. The voltage applied to vertical plates controls the

vertical deflection of the electron beam and voltage applied to the horizontal deflection plates

controls the horizontal deflection of the electron beam. There are two techniques used for

producing image on the CRT screen: Vector scan / random scan and Raster scan.

Rendering: Rendering is the process of generating an image from a 2D or 3D model (or models

in what collectively could be called a scene file), by means of computer programs. Also, the results

of such a model can be called a rendering. A scene file contains objects in a strictly defined

language or data structure; it would contain:

geometry,

viewpoint,

texture,

lighting,

shading information as a description of the virtual scene.

The data contained in the scene file is then passed to a rendering program to be processed

and output to a digital image or raster graphics image file.

When the pre-image (a wireframe sketch usually) is complete, rendering is used, which adds

in bitmap textures or procedural textures, lights, bump mapping and relative position to other

objects. The result is a completed image the consumer or intended viewer sees.

For movie animations, several images (frames) must be rendered, and stitched together in a

program capable of making an animation of this sort. Most 3D image editing programs can do

this.

A rendered image can be understood in terms of a number of visible features:

shading – how the color and brightness of a surface varies with lighting

texture-mapping – a method of applying detail to surfaces

bump-mapping – a method of simulating small-scale bumpiness on surfaces

Page 10: Computer Graphics Notes

10 | P a g e B y E r G u r p r e e t S i n g h

Visit: http://gsb-programming.blogspot.in

fogging/participating medium – how light dims when passing through non-clear atmosphere

or air

shadows – the effect of obstructing light

soft shadows – varying darkness caused by partially obscured light sources

reflection – mirror-like or highly glossy reflection

transparency (optics), transparency (graphic) or opacity – sharp transmission of light

through solid objects

translucency – highly scattered transmission of light through solid objects

refraction – bending of light associated with transparency

diffraction – bending, spreading and interference of light passing by an object or aperture

that disrupts the ray

indirect illumination – surfaces illuminated by light reflected off other surfaces, rather than

directly from a light source (also known as global illumination)

motion blur – objects appear blurry due to high-speed motion, or the motion of the camera

non-photorealistic rendering – rendering of scenes in an artistic style, intended to look like a

painting or drawing

RayTracing: In computer graphics, ray tracing is a technique for generating an image by

tracing the path of light through pixels in an image plane and simulating the effects of its

encounters with virtual objects. The technique is capable of producing a very high degree of visual

realism, usually higher than that of typical scanline rendering methods, but at a

greater computational cost. This makes ray tracing best suited for applications where the image

can be rendered slowly ahead of time, such as in still images and film and television visual effects,

and more poorly suited for real-time applications like video games where speed is critical. Ray

tracing is capable of simulating a wide variety of optical effects, such

as reflection and refraction, scattering, and dispersion phenomena (such as chromatic

aberration).

Ray tracing's popularity stems from its basis in a realistic simulation of lighting over other

rendering methods (such as scanline rendering or ray casting). Effects such as reflections

and shadows, which are difficult to simulate using other algorithms, are a natural result of the ray

Page 11: Computer Graphics Notes

11 | P a g e B y E r G u r p r e e t S i n g h

Visit: http://gsb-programming.blogspot.in

tracing algorithm. The computational independence of each ray makes ray tracing amenable

to parallelization.

A serious disadvantage of ray tracing is performance. Scanline algorithms and other algorithms

use data coherence to share computations between pixels, while ray tracing normally starts the

process anew, treating each eye ray separately. However, this separation offers other

advantages, such as the ability to shoot more rays as needed to perform spatial anti-aliasing and

improve image quality where needed.

Although it does handle inter reflection and optical effects such as refraction accurately, traditional

ray tracing is also not necessarily photorealistic. True photorealism occurs when the rendering

equation is closely approximated or fully implemented. Implementing the rendering equation gives

true photorealism, as the equation describes every physical effect of light flow. However, this is

usually infeasible given the computing resources required

AntiAliasing:

In computer graphics, antialiasing is a software technique for diminishing jaggies - stairstep-like

lines that should be smooth. Jaggies occur because the output device, the monitor or printer,

doesn't have a high enough resolution to represent a smooth line. Antialiasing reduces the

prominence of jaggies by surrounding the stairsteps with intermediate shades of gray (for gray-

scaling devices) or color (for color devices). Although this reduces the jagged appearance of the

lines, it also makes them fuzzier.

Another method for reducing jaggies is called smoothing, in which the printer changes the size

and horizontal alignment of dots to make curves smoother. Antialiasing is sometimes

called oversampling.

Fractals: The term "fractal" was coined by Benoit Mandelbrot in 1975. It comes from the

Latin fractus, meaning an irregular surface like that of a broken stone. Fractals are non-regular

geometric shapes that have the same degree of non-regularity on all scales. Just as a stone at

the base of a foothill can resemble in miniature the mountain from which it originally tumbled

down, so are fractals self-similar whether you view them from close up or very far away.

Page 12: Computer Graphics Notes

12 | P a g e B y E r G u r p r e e t S i n g h

Visit: http://gsb-programming.blogspot.in

Fractals are the kind of shapes we see in nature. We can describe a right triangle by the

Pythagorean theorem, but finding a right triangle in nature is a different matter altogether. We find

trees, mountains, rocks and cloud formations in nature, but what is the geometrical formula for a

cloud? How can we determine the shape of a dollop of cream in a cup of coffee? Fractal geometry,

chaos theory, and complex mathematics attempt to answer questions like these. Science

continues to discover an amazingly consistent order behind the universe's most seemingly chaotic

phenomena.

Mathematicians have attempted to describe fractal shapes for over one hundred years, but with

the processing power and imaging abilities of modern computers, fractals have enjoyed a new

popularity because they can be digitally rendered and explored in all of their fascinating beauty.

Fractals are being used in schools as a visual aid to teaching math, and also in our popular culture

as computer-generated surfaces for landscapes and planetary

Page 13: Computer Graphics Notes

13 | P a g e B y E r G u r p r e e t S i n g h

Visit: http://gsb-programming.blogspot.in