COMPUTER GRAPHICS
Prof. A.B. Gavali,
SBPCOE, Indapur. 1
Course Objective
Remembering: To acquaint the learner with the basic
concepts of Computer Graphics
Understanding: To learn the various algorithms for
generating and rendering graphical figures.
Applying: To get familiar with mathematics behind the
graphical transformations
Understanding: To understand and apply various methods
and techniques regarding projections, animation, shading,
illumination and lighting
Creating: To generate Interactive graphics using OpenGL
Prof. A.B. Gavali, SBPCOE,Indapur. 2
Course Outcomes: PO1,PO2,PO3
On completion of the course, learner will be able to–
CO1: Define basic terminologies of Computer Graphics, interpret the
mathematical foundation of the concepts of computer graphics and apply
mathematics to develop Computer programs for elementary graphic
operations.
CO2: Define the concept of windowing and clipping and apply various
algorithms to fill and clip polygons.
CO3: Explain the core concepts of computer graphics, including
transformation in two and three dimensions, viewing and projection.
CO4: Explain the concepts of color models, lighting, shading models and
hidden surface elimination.
CO5: Describe the fundamentals of curves, fractals, animation and
gaming.
Prof. A.B. Gavali, SBPCOE,Indapur. 3
PO1 , PO2, PO3
PO1 Engineering knowledge
Apply the knowledge of mathematics, science, Engineering
fundamentals, and an Engineering specialization to the solution of
complex Engineering problems .
PO2 Problem analysis
Identify, formulate, review research literature, and analyze complex
Engineering problems reaching substantiated conclusions using
first principles of mathematics natural sciences, and Engineering
sciences.
PO3 Design / Development of Solutions
Design solutions for complex Engineering problems and design
system components or processes that meet the specified needs with
appropriate consideration for the public health and safety, and the
cultural, societal, and Environmental considerations .
Prof. A.B. Gavali, SBPCOE,Indapur. 4
210244: Computer Graphics
Teaching Scheme: TH - 03 Hours/ Week
PR- 02 Hours/Week
Credit : 03
Examination Scheme:
Theory Exam – 100 Marks as follows
Mid_Semester (TH): 30 Marks
End_Semester (TH): 70 Marks
Practical Exam :
Practical Exam : 50 Marks
Term Work : 25 Marks
PR is CG+OOPL
Prof. A.B. Gavali, SBPCOE,Indapur. 5
Unit – I
Graphics Primitives and
Scan Conversion
Prof. A.B. Gavali, SBPCOE,Indapur. 6
Unit I : Syllabus
Part I
Introduction
Pixel
Frame buffer
Resolution
Aspect ratio
Applications of computer graphics
Prof. Gavali A.B., SBPCOE,Indapur. 7
Unit I : Syllabus
Part II : Display devices
Part III :
Scan Conversion:
◦ Line and line segments,
◦ Qualities of good line drawing algorithms,
Line drawing algorithms:
◦ Digital Differential Analyzer (DDA),
◦ Bresenham and parallel line algorithms,
Line styles: thick, dotted and dashed.
Circle drawing algorithm:
◦ DDA, Bresenham, Midpoint
Prof. Gavali A.B., SBPCOE,Indapur. 8
Prof. A.B. Gavali, SBPCOE,Indapur. 9
Introduction to Computer Graphics
➢ Computer Graphics –
Computer Graphics refers creation and
manipulation of pictures and images using
digital computer.
➢ “A picture is worth than a thousand words”
Prof. A.B. Gavali, SBPCOE,Indapur. 10
Introduction to Computer Graphics
➢ The term CG has been used in broad sense to
describe
“almost everything on computers that is not
TEXT or SOUND”
➢ Typically CG refers several different things –
The representation and manipulation of image data by
computer.
✓The various technologies used to create and
manipulate images.
✓The images so produced.
Prof. A.B. Gavali, SBPCOE,Indapur. 11
Major subfields in computer graphics
➢ Geometry: studies ways to represent and
process surfaces
➢ Animation: studies with ways to
represent and manipulate motion
Prof. A.B. Gavali, SBPCOE,Indapur. 12
Major subfields in computer graphics
➢ Rendering: studies algorithms to
reproduce light transport
➢ Imaging: studies image acquisition
or image editing
Prof. A.B. Gavali, SBPCOE,Indapur. 13
Computer Graphics Applications
➢ Graphs and charts
➢ Computer Aided Design (CAD)
➢ Virtual Reality Environments (Game industries)
➢ Data visualizations (business, share market)
➢ Education & Training (simulation)
➢ Computer Art (cartoon, logo, painting)
➢ Entertainment (movies)
➢ Image processing
➢ Graphical User Interfaces
Prof. A.B. Gavali, SBPCOE,Indapur. 14
Data Visualization(Charts & Graphs)
Prof. A.B. Gavali, SBPCOE,Indapur. 15
Computer Aided Design (CAD)
Prof. A.B. Gavali, SBPCOE,Indapur.
16
Entertainment (Making of AVATAR)
Prof. A.B. Gavali, SBPCOE,Indapur. 17
Virtual Reality Environments
Prof. A.B. Gavali, SBPCOE,Indapur. 18
Computer Art
Cartoon drawing, paintings, product advertisements, logo design
Prof. A.B. Gavali, SBPCOE,Indapur. 19
Computer Art
Prof. A.B. Gavali, SBPCOE,Indapur. 20
➢ Image Processing
✓Inverse of Graphics
✓Start with a picture
✓Process picture
information
➢ Graphical User Interfaces
(GUIs)
✓WIMP interface
✓HCI
Prof. A.B. Gavali, SBPCOE,Indapur. 21
Modeling and simulation
https://earth.nullschool.net/
Prof. A.B. Gavali, SBPCOE,Indapur. 22
Science and Engineering
http://sh-meet.bigpixel.cn/?from=groupmessage&isappinstalled=0
Prof. A.B. Gavali, SBPCOE,Indapur. 23
INPUT AND OUTPUT DEVICES
Input, Output and Secondary Storage
Devices are collectively known as
peripherals
Prof. A.B. Gavali, SBPCOE,Indapur. 24
Input Devices
➢ Input devices are all those hardware equipment
that are used to enter data into the computer.
➢ Keyboard : This is the most common and
widely used input device. There are different
types of keyboards. keyboard has:
✓A Numeric Keypad
✓Navigation Keys
✓Function Keys
Prof. A.B. Gavali, SBPCOE,Indapur. 25
Mouse or Trackball
The mouse helps the user to point and access items
on the computer.
Its main function is to control the cursor or pointer
on the computer’s screen.
The mouse can have 2 or 3 buttons, used according
to the software application being
used.
Prof. A.B. Gavali, SBPCOE,Indapur. 26
Light Pen
It is a pen shaped device used
to select objects on a display screen.
It is quite like the mouse (in its functionality) but
uses a light pen to move the pointer and select
any object on the screen by pointing to the object
or draw picture on screen.
Users of Computer Aided Design
(CAD) applications commonly use the light pens
to directly draw on screen.
Prof. A.B. Gavali, SBPCOE,Indapur. 27
Trackball
The trackball has the same basic functions of the
mouse.
The only difference is that the trackball is
stationary and one doesn’t need to move it on a
mouse pad.
In order to navigate with the pointer, the user must
move a ball situated at the top of
the device. Similar to the mouse,
the trackball has 2 or 3 buttons
used to select items from the screen.
Prof. A.B. Gavali, SBPCOE,Indapur. 28
Touchpad
This is a small sensitive pad used on portable
computers(laptops).
The touch pad is used as a pointing device.
The pointer is moved on screen by touching the touch
pad with the finger.
Prof. A.B. Gavali, SBPCOE,Indapur. 29
Joystick
This device is mainly used for playing computer games.
As the name implies, it is like a stick connected to a
platform, which can be moved in all directions.
These movements in turn will move something on screen
depending on the game.
Usually joysticks have buttons
also called triggers.
Prof. A.B. Gavali, SBPCOE,Indapur. 30
Output Devices
Prof. A.B. Gavali, SBPCOE,Indapur. 31
Visual Display Unit-monitor
Features :
1.Resolution
2.Refresh Rate
3.Screen Size
Video monitors are based on different technologies
like CRT, LCD , Plasma panel .
Prof. A.B. Gavali, SBPCOE,Indapur. 32
Pixel
Picture element.
Smallest addressable unit of screen.
It has intensity information.
Prof. A.B. Gavali, SBPCOE,Indapur. 33
Prof. A.B. Gavali, SBPCOE,Indapur. 34
Pixel
➢ Thecomputer stores and displays pixels, or picture
elements.
➢ A pixel
is the smallest addressable part of the
computer screen.
➢ A pixel is stored as a binary code representing a
colour.
➢ The code for a pixel can have
between 1 and 32 bits of binary code.
Prof. A.B. Gavali, SBPCOE,Indapur. 35
Pixels Example
➢ Here is the Photoshop logo at normal size.
➢ Here it is enlarged 400% so that you can see
the individual pixels.
Prof. A.B. Gavali, SBPCOE,Indapur. 36
Pixel Depth
➢ PixelDepth describes the number of bits used to
store each pixel.
➢ Thegreater the pixel depth, the more colours a
pixel can have.
➢ Colour graphics vary in realism depending on
resolution and pixel depth.
➢ The greater the pixel depth, the bigger the file.
Prof. A.B. Gavali, SBPCOE,Indapur. 37
Examples of Pixel Depth Monochrome
➢ Monochrome graphics have one-bit pixel
depth. (pure black or pure white)
Prof. A.B. Gavali, SBPCOE,Indapur. 38
Examples of Pixel Depth Gray-Scale
➢ Gray-Scalegraphics have more bit-depth
(No colours besides black, white and grey)
Prof. A.B. Gavali, SBPCOE,Indapur. 39
Examples of Pixel Depth 8 Bit Colour
➢8 bits per pixel provides 256 colour choices
(Typical of the web - that’s why web graphics
need some skilful preparation)
Prof. A.B. Gavali, SBPCOE,Indapur. 40
8 Bit Colour
8 bit color format is one of the most
famous image format. It has 256
different shades of colors in it. It is
commonly known as Grayscale
image.
The range of the colors in 8 bit vary
from 0-255.
Where 0 stands for black, and
255 stands for white, and
127 stands for gray color.
This format was used initially by early
models of the operating systems
UNIX and the early color
Macintoshes.
A grayscale image of Einstein is
shown here.
Prof. A.B. Gavali, SBPCOE,Indapur. 41
16 bit color format
Prof. A.B. Gavali, SBPCOE,Indapur. 42
24 bit color format
Prof. A.B. Gavali, SBPCOE,Indapur. 43
Examples of Pixel Depth
➢ 24or 32 bits per pixel provides thousands or
millions of colour choices. (Typical of graphics
and games software)
Prof. A.B. Gavali, SBPCOE,Indapur. 44
How do we store this?
We would like to allocate memory to hold the
results of the computation stage.
Prof. A.B. Gavali, SBPCOE,Indapur. 45
Frame buffer
➢ Frame buffer - A block of memory, dedicated
to graphics output, that holds the contents of
what will be displayed.
➢Pixel - one element of the frame buffer
Prof. A.B. Gavali, SBPCOE,Indapur. 46
Frame buffer
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0
0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0
0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0
0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0
0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Questions:
➢How much memory do we need to allocate for the framebuffer?
➢How many pixels are there?
➢How big is the framebuffer?
➢What is the largest image you can display?
Prof. A.B. Gavali, SBPCOE,Indapur. 47
Frame buffer in Memory
➢ Ifwe want a frame buffer of 640 pixels by 480
pixels, we should allocate:
Frame buffer = 640*480 bits
➢ How many bit should we allocate?
➢ Q: What do more bits get you?
➢A: More values to be stored at each pixel.
➢Why would you want to store something other
than a 1 or 0?
Prof. A.B. Gavali, SBPCOE,Indapur. 48
Framebuffer bit depth
➢ How many colors does 1 bit get you?
➢ How many colors do 8 bits get you?
Monochrome systems use this (green/gray
scale)
➢ What bit depth would you want for your frame
buffer?
bit depth - number of bits allocated per pixel in a buffer
Prof. A.B. Gavali, SBPCOE,Indapur. 49
Prof. A.B. Gavali, SBPCOE,Indapur. 50
Framebuffer bit depths
➢ Remember, we are asking
“how much memory do we
allocate to store the color at
each pixel?”
➢ Common answers:
16 and 32 bits
➢ Megapixel : a unit of graphic
resolution equivalent to one
million or (strictly) 10,48,576
(220) pixels.
➢ A megapixel is one million pixels.
➢ 7.2 megapixel camera is
capable of capturing roughly
72,00,000 pixels.
Prof. A.B. Gavali, SBPCOE,Indapur. 51
Prof. A.B. Gavali, SBPCOE,Indapur. 52
Prof. A.B. Gavali, SBPCOE,Indapur. 53
Resolution
This term refers to the clarity or sharpness of a
printout or display screen.
The more pixels there are per square inch, the
better and greater the resolution.
example: 640X480,1024X768.
Prof. A.B. Gavali, SBPCOE,Indapur. 54
Resolution
➢ Resolution refers to the density of dots on the
screen or printed image and directly affects
quality
➢ The higher the resolution, the less jagged the
image.
➢ Resolution is measured in DPI (Dots per Inch)
➢ The printing industry still uses inches because
printing measures such as the Point (172nd of
an inch) do not easily convert to metric units.
➢ The higher the resolution, the better the
potential output.
Prof. A.B. Gavali, SBPCOE,Indapur. 55
Typical Resolutions
➢ Screens generally operate at around 72-100 dpi
➢ Printed images range from 300 to 2400 dpi
➢ Resolution affects the file size of an image.
➢ The higher the resolution, the bigger the file.
➢ The visible resolution is limited to the maximum
possible on the output device (screen or printer).
➢ No matter how high the resolution of a photograph, it
will show at the resolution of your screen or printer.
Prof. A.B. Gavali, SBPCOE,Indapur. 56
Refresh Rate
➢ Refresh Rate indicates how often a displayed image is
updated or redrawn on the monitor.
➢ Most monitors operate at a rate of 75 hertz which means that
the monitor is redrawn 75 times each second.
➢ Images displayed on monitors with refresh rates lower than
75 hertz appear to flicker and can cause eye strain.
➢ The faster the refresh rate (the more frequently images are
redrawn), the better the quality of images
Prof. A.B. Gavali, SBPCOE,Indapur. 57
Aspect Ratio
➢ Gives the relationship of one side to the other,
it is widely used to describe the shape of a TV
or computer screen.
➢ Forexample, the aspect ratio of a standard-
definition (SD) screen is 4:3 (means "4 to 3” ),
which is a relatively square rectangle.
➢ Theratio of the width to the height of an
image or screen
Prof. A.B. Gavali, SBPCOE,Indapur. 58
Aspect Ratio
High-definition TV (HDTV) has a 16:9 ratio,
which is a wide rectangle.
HD screens have resolution 1920x 1880 pixels.
Prof. A.B. Gavali, SBPCOE,Indapur. 59
Aspect Ratio
➢ Problem :Viewing 16:9 content on 4:3 screen.
Called letterbox effect.
➢ Problem :Viewing 4:3 content on 16:9 screen.
pillerboxing :able to see black stripes on left
and right.
Prof. A.B. Gavali, SBPCOE,Indapur. 60
Aspect Ratio
➢ The ratio of the rectangle’s width and height.
➢ If different in Orthogonal and Window Size
undesirable side effects caused by the independence
of object, viewing parameters and workstation
window specifications Concept of a VIEWPORT
Prof. A.B. Gavali, SBPCOE,Indapur. 61
http://www.tutorialspoint.com/
dip/concept_of_bits_per_pixel.h
tm
End of Part I
Prof. A.B. Gavali, SBPCOE,Indapur. 62
Thank you !
Any ?
Prof. A.B. Gavali, SBPCOE,Indapur. 63