Seal of Good Local Governance (SGLG) 2024Final.pptx
B. SC CSIT Computer Graphics Unit1.1 By Tekendra Nath Yogi
1. College of applied Business(CAB) And Technology
Course Name
CSC-254: Computer Graphics
Faculty Name
Mr. Tekendra Nath Yogi
Tekendranath@gmail.com
2. Course Title: Computer Graphics
• Course code: CSC-254 Full Marks: 60+ 20 +20
• Credits: 3 pass Marks: 24+ 8 +8
• Lecture Hours: 45
• Nature of course: Theory + Lab
• Goal: The objective of this course is to understand the
theoretical foundation of 2D and 3D graphics.
2By: Tekendra Nath Yogi2/9/2019
3. Course Details
• Unit 1. 5 Hrs.
– Introduction, Advantage of Computer Graphics, Areas of Applications,
Hardware and Software for Computer Graphics.
– Hard Copy, Display Technologies, Random Scan Display System,
Video Controller, Random Scan Display Processor.
– Raster Graphics, Scan Conversion Algorithms (Line, Circle, Ellipse),
Area Filling (Rectangle, Ellipse), Clipping (Lines, Circle, Ellipse),
Clipping Polygons.
3By: Tekendra Nath Yogi2/9/2019
4. Contd..
• Unit2. 10Hrs.
• Geometrical Transformations (Translation, rotation, reflection, shear and
scaling), Homogenous coordinates, 2D and 3D Transformations, Matrix
Representations, Window to View Port Transformation.
• 3D Viewing, Projections, Mathematics of Projections.
4By: Tekendra Nath Yogi2/9/2019
6. Contd..
• Unit 4. 12 Hrs.
– Visible Surface Determination, Various Techniques, Algorithms for Visible
Surface Detection, (Z- Buffer, List priority, Scan Line Algorithms),
– Shading
• Constant intensity shading
• Gouraud
• Phong Shading And
• Fast phon shading
– and Illumination models.
• Ambient light
• Diffuse reflection
• Specular reflection
• Light intensity attenuation
• Color consideration
• Transparency
• shadows 6By: Tekendra Nath Yogi2/9/2019
7. Contd..
• Unit5. 3Hrs.
– Introduction to virtual Reality and Animation.
7By: Tekendra Nath Yogi2/9/2019
8. Contd..
• Laboratory works:
– All algorithms covered in the text to be implemented in
PHIGS(Programmer's Hierarchical Interactive Graphics System)
/OpenGL in C/C++.
8By: Tekendra Nath Yogi2/9/2019
9. Contd..
• Text / References books:
– Hearn Donald, M. P. Baker, Computer
Graphics, 2E, Prentice Hall of India
Private Limited, New Delhi, 2000.
– Foley, J. D., A. V. Dam, S. K. Feiner,
J. F. Hughes, Computer Graphics
Principle and Practices, Addison
Wesley Longman, Singapore Pvt. Ltd.,
1999.
9By: Tekendra Nath Yogi2/9/2019
11. Introduction, Advantage of Computer Graphics, Areas of Applications,
Hardware and Software for Computer Graphics. (Hard Copy, Display
Technologies), Random Scan Display System, Video Controller,
Random Scan Display Processor. Raster Graphics, Scan Conversion
Algorithms (Line, Circle, Ellipse), Area Filling (Rectangle, Ellipse),
Clipping (Lines, Circle, Ellipse), Clipping Polygons.
11
Unit 1
12. Introduction
• What is Graphics?
– Graphics are visual images or designs on some surface, such as
a wall, screen, paper, or stone to inform, illustrate, or entertain.
– Computer Graphics includes almost everything on computers
that is not text or sound.
– In contemporary usage it includes: a pictorial representation of
data.
– “A picture is worth a thousand words” is a well-known saying
and highlights the advantages and benefits of the visual
presentation of our data.
12By: Tekendra Nath Yogi2/9/2019
13. Contd..
• What is computer graphics?
– Computer Graphics is a field related to the generation of
graphics using computers.
• It includes the creation, storage, and manipulation of images of
objects.
– These objects come from diverse fields such as physical,
mathematical, engineering, architectural, abstract structures and
natural phenomenon.
13By: Tekendra Nath Yogi2/9/2019
14. Contd..
• Computer graphics today is largely interactive, that is , the
user controls the contents, structure, and appearance of images
of the objects by using input devices, such as keyboard,
mouse, or touch sensitive panel on the screen.
• Because of the close relationship between the input devices
and display devices, the handling of such devices is included
in the study of computer graphics.
14By: Tekendra Nath Yogi2/9/2019
15. Contd..
• There are two types of Computer Graphics
– Interactive Computer Graphics
– Non Interactive Computer Graphics
15By: Tekendra Nath Yogi2/9/2019
16. Contd..
• Non-interactive computer Graphics:
– Non Interactive computer graphics also known as passive
computer graphics.
– In which user does not have any kind of control over the
image being presented.
– Example: screen savers.
16By: Tekendra Nath Yogi2/9/2019
17. Contd..
• Interactive Computer Graphics
– Interactive CG involves two way communication between
Computer and the user.
– It can be convenient to input graphical information from
the user to computer and have an appropriate graphical
output from the computer to the user
– Example: Pictures, Charts, Diagrams
17By: Tekendra Nath Yogi2/9/2019
18. The advantages of interactive computer graphics
• A high quality graphics provide one of the most natural means
of communication.
– E.g., data presentation
• It provides tools for producing pictures of all types(real as well
as abstract(e.g., mathematical surface in 4D)).
• It has ability to show moving pictures and thus it is possible to
produce animations with interactive graphics.
18By: Tekendra Nath Yogi2/9/2019
19. Contd..
• Provides facility of motion dynamics which can be used to
move objects with respect to a stationary observer and vice –
versa.
• Provides facility of update dynamic which can be used to
change shape , color and other properties of object in view.
• With the development in DSP it can provide audio feedback
along with the video to make the simulated environment even
more realistic.
19By: Tekendra Nath Yogi2/9/2019
20. Conceptual framework for interactive Graphics
20By: Tekendra Nath Yogi2/9/2019
Application
Model
Application
Program
Graphics
System
Key Board, Mouse,
Joystick, etc
21. Contd..
• Interaction and display devices:
– Computer receives input from interaction devices, and
outputs images to a display device.
• The software has three components:
– Application program
– Application model
– Graphics system
21By: Tekendra Nath Yogi2/9/2019
22. Contd..
• Application program:
– It creates, stores into and retrieves graphic primitives(point,
line, polygons, etc) from the second component, the
application model.
– It also produce views by sending a series of graphics output
commands to the third component, the graphics system.
22By: Tekendra Nath Yogi2/9/2019
23. Contd..
• Application model:
– Represents the data , objects and relationship among them
to be pictured on the screen.
• Graphics system:
– The graphics system is responsible for actually producing
the picture from the detailed descriptions(series of
command) and for passing the user’s input to the
application program
23By: Tekendra Nath Yogi2/9/2019
24. Application Areas
• Computers have become a powerful tool for the rapid and
economical production of pictures. There is virtually no area in
which graphical displays cannot be used to some advantage, and so
it is not surprising to find the use of computer graphics so
widespread.
• Some of the representative applications areas are as follows:
– Computer Aided Design(CAD)
– Presentation Graphics
– Computer Art
25. Application Areas
• Education and training
• Visualization
• Image processing
• Entertainment
– Movies Industry
– Gaming Industry
• Medical field
• Graphical User Interface(GUI)
26. CAD
• Major use of computer graphics is in design process,
particularly for engineering and architectural systems.
• This include design of buildings, automobiles, aircraft etc.
27. Presentation Graphics
• Used to summarize the mathematical, scientific and economic
data.
• Typical examples are bar charts, line graphs, pie charts etc.
28. Computer Art
• Artist uses special purpose hardware and programs that
provides facilities for designing object shapes and specifying
object motion.
• Example includes painting.
29. Education and training
• Computer generated models of physical, financial and
economic system are often used as educational aids.
• Various kinds of simulators program can be used to provide
the trainings. E.g. training of ship captains, aircraft pilots,
heavy-equipment operators, and air traffic control personnel
30. Visualization
• Various techniques can be used to represent the large amount
of data obtained from scientific , medical or business analysis.
• These includes color coding, graphs , charts etc.
31. Image Processing
• Computer graphics is used to create pictures.
• Image processing applies techniques to modify or interpret the
existing pictures.
• It is used to:
– Improve picture quality
– Machine perception of visual information
32. Entertainment
• Computer graphics methods are now commonly used in making motion
pictures, music videos , games and televisions shows.
• Sometime graphics pictures are displayed by themselves and sometime
combined with the actors and live scenes.
33. Medical Field
• Computer graphics can also be used to represent the various
internal parts and process of the human body.
34. GUI
• It is the interface of the software that communicates with the
user with help of some input devices.
• It contains number of windows , menus and icons for fast
selection of processing options.
35. Output Devices
Output devices are classified as shown in figure below
35
Output
Devices
Soft Copy/Display Devices
Cathode
Ray Tube
Refresh
Raster
Scan
Random
Scan
Non-
refresh
DVST(Direct
View Storage
Tube)
Flat
Panel
Display
Hard
Copy
Printer
Impact
Dot
matrix
Line
Non-
impact
Inkjet Laser
Plotter
Drum Flat Bed
36. Video Display Devices
• The primary output device in a graphics system is a
video monitor.
• The operation of most video monitor is based on the
standard Cathode Ray Tube(CRT)
36By: Tekendra Nath Yogi2/9/2019
37. Contd….
• Cathode-Ray Tubes(CRT):
– A CRT is an evacuated glass tube.
– The operation of CRT is very simple:
• The electron gun emits a beam of electrons (cathode rays).
• The electron beam passes through focusing and deflection systems that
direct it towards specified positions on the phosphor-coated screen.
• When the beam hits the screen, the phosphor emits a small spot of light
at each position contacted by the electron beam.
• It redraws the picture by directing the electron beam back over the same
screen points quickly. This type of display is called a refresh CRT.
37By: Tekendra Nath Yogi2/9/2019
38. Contd….
• Figure below illustrates the basic operation of a CRT
38By: Tekendra Nath Yogi2/9/2019
39. Contd….
• Primary component of CRT:
– Electron gun
– Focusing system
– Deflection system and
– Phosphor coated screen
39By: Tekendra Nath Yogi2/9/2019
40. Contd….
• Electron gun:
– The primary components of an electron gun in a CRT are the heated
metal cathode and a control grid.
– Cathode is responsible for generating huge amount of cathode
rays(electron beam).
– Control grid: It is responsible for controlling the intensity or
illumination in the screen by controlling the intensity of the electron
beam strikes in the screen.
– More the voltage in a control grid, less the strikes of electrons results
less brightness of screen. Low voltage results more brightness. Control
grid has negative voltage as it has to filter the electrons.
40By: Tekendra Nath Yogi2/9/2019
41. Contd….
• Focusing system:
– The focusing system in a CRT is needed to force the
electron beam to converge into a small spot as it strikes the
phosphor.
– Otherwise, the electrons would repel each other, and the
beam would spread out as it approaches the screen.
– Focusing is accomplished with either electric or magnetic
fields.
– same as an optical lens focuses a beam of light at a
particular focal distance.
41By: Tekendra Nath Yogi2/9/2019
42. Contd….
• Deflection system:
– To show the picture, the electron beam must be deflected
horizontally and vertically on the screen. Deflection system
is responsible for this purpose.
– Deflection can also be accomplished with either electric or
magnetic fields.
42By: Tekendra Nath Yogi2/9/2019
43. Contd….
• Magnetic Deflection:
– Magnetic Deflection Coils are used to deflect the electron beam,
actually it generates a magnetic field, which helps to divert the electron
beam to any part of the screen.
43By: Tekendra Nath Yogi2/9/2019
44. Contd….
• Electrostatic deflection :
– Horizontal Deflection plates are responsible for vertical deflection of the
electron beam. Whereas, Vertical Deflection Plates are responsible for
horizontal deflection of the electron beam. Horizontal deflection plates
produces vertical electrostatic fields so vertical deflection is occurred.
– Similarly, vertical deflection plates produce horizontal electrostatic fields,
which helps in horizontal deflection of a beam.
44By: Tekendra Nath Yogi2/9/2019
45. Contd….
• Phosphor coated screen:
– Spots of light are produced on the screen by the transfer of
the CRT beam energy to the phosphor.
– There are two ways (Random scan and Raster scan) by
which we can display an object on the screen.
45By: Tekendra Nath Yogi2/9/2019
46. Property Of Video Monitors
• persistence:
– How long phosphor continue to emit light after the CRT
beam is removed.
• Persistence is defined as the time it takes the emitted light from the
screen to decay to one-tenth of its original intensity.
– Lower persistence phosphors require higher refresh rates
to maintain a picture on the screen without flicker.
– higher persistence phosphors require Lower refresh rates to
maintain a picture on the screen without flicker.
46By: Tekendra Nath Yogi2/9/2019
47. Contd….
• Refresh Rate:
– Light emitted by phosphor fades, so to keep the drawn
picture glowing constantly; it is required to redraw the
picture repeatedly and quickly directing the electron beam
back over the same point.
– The no of times/sec the image is redrawn to give a feeling
of non-flickering pictures is called refresh-rate.
– If Refresh rate decreases, flicker develops.
47By: Tekendra Nath Yogi2/9/2019
48. Contd….
• Resolution:
– Maximum number of points displayed horizontally and
vertically without overlapping on a display screen is called
resolution.
– Resolution is the no of dots per inch (dpi/pixel per inch)
that can be plotted horizontally and vertically.
– E.g., 1280X1024 pixels
48By: Tekendra Nath Yogi2/9/2019
49. Contd….
• Aspect Ratio:
– gives the ratio of vertical points to horizontal points
necessary to produce equal-length lines in both directions
on the screen.
– Sometimes aspect ratio is stated in terms of the ratio of
horizontal to vertical points.
– An aspect ratio of 3/4 means that a vertical line plotted
with three points has the same length as a horizontal line
plotted with four points.
49By: Tekendra Nath Yogi2/9/2019
50. Some terminologies
50
1. Images: It is composed of discrete pixels or picture element or pels. These
pixels are arranged in the form of row and column to form a picture.
2. Pixel: It is the smallest addressable screen element. It may not a point as
combination of many points creates a pixel.
3. Frame buffer: It is a large, contiguous piece of memory into which the
intensity values for all pixels are placed.
4. pixmap : For systems with multiple bits per pixel, the frame buffer is
referred to as a pixmap.
52. Raster Scan Display
• In a raster scan system, the electron beam is swept across the screen, one
row at a time from top to bottom.
• As the electron beam moves across each row, the beam intensity is turned
on and off to create a pattern of illuminated spots.
52By: Tekendra Nath Yogi2/9/2019
53. Contd….
• Picture definition is stored in memory area called the Refresh
Buffer or Frame Buffer.
• This memory area holds the set of intensity values for all the
screen points.
• Stored intensity values are then retrieved from the refresh
buffer and “painted” on the screen one row (scan line) at a
time as shown in the following illustration.
53By: Tekendra Nath Yogi2/9/2019
54. Contd….
• At the end of each scan line, the electron beam returns to the
left side of the screen to begin displaying the next scan line.
The return to the left of the screen, after refreshing each scan
line, is called the horizontal retrace of the electron beam.
• And at the end of each frame, the electron beam returns
(vertical retrace) to the top left comer of the screen to begin
the next frame.
54By: Tekendra Nath Yogi2/9/2019
56. Contd….
• Interlaced vs non-interlaced scan(refresh procedure ):
– In interlaced scan, each frame is displayed in two passes. In figure 1,
we can see blue lines for first pass and pink lines for second pass.
– In non-interlaced refresh procedure, electron beam sweeps over entire
scan lines in an frame from top to bottom in one pass.
Fig: Line interlaced scan Fig: Non-interlaced scan
56By: Tekendra Nath Yogi2/9/2019
57. Contd….
• Problem: There is a RGB raster system is to be designed using 8 inch by
10 inch screen with a resolution of 100 pixels per inch in each direction. If
we want to store 8 bits per pixel in the frame buffer, how much storage (in
bytes) do we need for the frame buffer?
• Answer:
– Size of screen = 8 inch 10 inch.
– Pixel per inch (Resolution) = 100.
– Then, Total no of pixels = (8*100)*(10*100) pixels = (800*1000) pixels
– Per pixel storage = 8 bits
– Therefore, Total storage required in frame buffer = (800*1000*8) bits
– = (800*1000*8)/8 Bytes
– = 800000 Bytes
57By: Tekendra Nath Yogi2/9/2019
58. Random Scan Display
• It is also called vector display, stroke-writing
display, or calligraphic display.
• In this technique, the electron beam is directed only to the part
of the screen where the picture is to be drawn rather than
scanning from left to right and top to bottom as in raster scan.
58By: Tekendra Nath Yogi2/9/2019
59. Contd….
• Picture definition is stored as a set of line-drawing commands
in an area of memory referred to as the refresh display file or
display program.
• To display a specified picture, the system cycles through the
set of commands in the display file, drawing each component
line in turn.
• After all the line-drawing commands are processed, the system
cycles back to the first line command in the list.
59By: Tekendra Nath Yogi2/9/2019
61. Difference between Random Scan Display System and Raster Scan
Display System
61By: Tekendra Nath Yogi2/9/2019
62. Color CRT
• A CRT monitor displays color pictures by using a combination
of phosphors that emit different-colored light.
• By combining the emitted light from the different phosphors,
a range of colors can be generated. Two basic techniques for
producing color displays with CRT are:
1. Beam-penetration method
2. Shadow-mask method
62By: Tekendra Nath Yogi2/9/2019
63. Beam Penetration method
• Used for random scan display or vector display. In random scan display CRT, the
two layers of phosphor usually red and green are coated on CRT screen.
• Display color depends upon how far electrons beam penetrate the phosphor
layers.
– Slow electrons excite only red layer so that we can see red color displayed on the
screen pixel where the beam strikes.
– Fast electrons beam excite green layer penetrating the red layer and we can see
the green color displayed at the corresponding position.
– Intermediate beam combinations of red and green light are emitted to show two
additional colors - orange and yellow.
• The speed of the electrons and hence the screen color at any point, is controlled
by the beam-acceleration voltage.
• In beam penetration method quality of pictures is not as good as other methods
since only 4 colors are possible.
63By: Tekendra Nath Yogi2/9/2019
65. Shadow Mask Method
65
• Shadow mask method is used for raster-scan systems.
• can produce wide range of colors than beam-penetration
method.
• In shadow mask CRT has three phosphor color dots(red,
green and blue) at each pixel position.
Delta-Delta Shadow CRT:
– In delta-delta CRT, three electron beams one for each R, G, and
B colors are deflected and focused as a group onto shadow
mask, which contains a series of holes aligned with the phosphor
dots.
66. Delta-Delta Shadow CRT
66
Three electron guns, aligned
with the triangular color-dot
patterns on the screen are
directed to each dot triangle by a
shadow mask.
t
68. Raster Scan Display Systems(Elements of raster display)
• The simplest and most common raster scan display system
organization is as shown in figure below:
Fig: A common raster display system architecture
68By: Tekendra Nath Yogi2/9/2019
69. Contd….
• CPU and System memory:
– The relation between memory and the CPU is exactly the
same as in a non-graphics computer.
– The application program(e.g., paint) and graphics
subroutine(scan conversion procedures) share the system
memory and are executed by the CPU.
– When application program calls the graphics subroutine set
the appropriate pixels in the frame buffer.
69By: Tekendra Nath Yogi2/9/2019
70. Contd….
• Video controller:
– a special processor, called the video controller or display controller,
is used to control the operation of the display device i.e., The video
controller drives a CRT.
– A fixed area of the system memory is reserved for the frame buffer,
and the video controller is given direct access to the frame buffer
memory to refresh the screen.
– Video controller cycles through the frame buffer, one scan line at a
time.
– In figure below, the basic refresh operations of the video-controller
are shown.
70By: Tekendra Nath Yogi2/9/2019
71. Contd….
Fig: Basic refresh operation of video controller
71By: Tekendra Nath Yogi2/9/2019
Raster Scan Generator
x Register y Register
Memory Address
Frame Buffer Intensity
72. Contd….
• Two registers are used to store the coordinates of the screen
pixels.
• Initially, the x register is set to 0 and the y register is set to
the value for the top scan line.
• The contents of the frame buffer at this pixel position are then
retrieved and used to set the intensity of the CRT beam.
• Then the x register is incremented by 1, and the process is
repeated for the next pixel on the top scan line.
72By: Tekendra Nath Yogi2/9/2019
73. Contd….
• This procedure is continued for each pixel along the top scan
line.
• After the last pixel on the top scan line has been processed,
the x register is reset to 0 and the y register is set to the value
for the next scan line down from the top of the screen.
• Pixels along this scan line are then processed in turn, and the
procedure is repeated for each successive scan line.
73By: Tekendra Nath Yogi2/9/2019
74. Contd….
• After cycling through all pixels along the bottom scan line ,
the video controller resets the registers to the first pixels
position on the top scan line and the refresh process starts over.
• The screen must be refreshed at a rate of at least 60 frames
per second.
74By: Tekendra Nath Yogi2/9/2019
75. Raster Display system with peripheral display processor
Fig: Raster system architecture with a peripheral display processor
75By: Tekendra Nath Yogi2/9/2019
I/O Devices
System Bus
CPU
Display
Processor
System
Memory
Display processor
Memory Video
Controller
Monitor
Frame
Buffer
76. Contd….
• Three memory areas:
– The system memory: holds data plus those programs that
execute on the CPU(application programs, graphic package
and operation system).
– The Display processor memory: Holds data plus the
programs that perform scan conversion and raster
operation.
– The frame Buffer: contains the displayable image created
by the scan conversion and raster operations.
76By: Tekendra Nath Yogi2/9/2019
77. Contd….
• Two Processors:
– General purpose processor(CPU)
– The special purpose display processor(graphics controller,
display coprocessor):
77By: Tekendra Nath Yogi2/9/2019
78. Contd….
• Display processor (graphics controller, display coprocessor):
– A major task of the display processor is Scan Conversion.
• Scan Conversion: is digitizing a picture definition
given in an application program into a set of pixel
intensity values for storage in the frame buffer.
– Other task includes raster operation and a separate frame
buffer for image refresh.
78By: Tekendra Nath Yogi2/9/2019
80. Random Scan Display System
Fig: Architecture of a random scan display system
80By: Tekendra Nath Yogi2/9/2019
I/O Devices
System Bus
CPU
System
Memory
Display
Processor
Monitor
81. Contd….
• Application programs are stored in system memory.
• Graphics commands in the program are translated by the graphics
package into a display file stored in the system memory.
• This display file is accessed by the display processor to refresh the
screen.
• Because there is no pixmap, the display processor must execute its
program 30 to 60 times per second in order to provide a flicker-free
display.
• Display processor in a random scan system is referred to as a display
processing unit(DPU) or graphics controller.
81By: Tekendra Nath Yogi2/9/2019