Content text CG notes by Rustam Shrestha.pdf
1 | R u s t a m S h r e s t h a C o m p u t e r G r a p h i c s H a n d o u t s S M C B C A 2 0 7 8 Interactive Computer Graphics:.........................................................................................................................................6 Non-Interactive Computer Graphics: ..............................................................................................................................6 Advantages of CG....................................................................................................................................................................7 1. Enhanced Visual Communication:......................................................................................................................7 2. Creation of Complex Designs:..............................................................................................................................7 3. Improved Realism:.....................................................................................................................................................7 4. 3D Modeling and Animation:................................................................................................................................7 5. Accessibility:.................................................................................................................................................................7 6. Productivity and Efficiency:....................................................................................................................................7 Image Processing.....................................................................................................................................................................8 Cathode Ray Tube (CRT).......................................................................................................................................................9 Features of CRT.................................................................................................................................................................10 Components of a CRT:...................................................................................................................................................11 Types of CRT.......................................................................................................................................................................11 Raster Scan Display....................................................................................................................................................11 Random Scan Display/ vector................................................................................................................................13 Colored CRT.............................................................................................................................................................................16 How it Works:.....................................................................................................................................................................16 Light Emitting Diode (LED)...............................................................................................................................................19 Liquid Crystal Display (LCD)..............................................................................................................................................20 1. Frame Buffer.............................................................................................................................................................21 2. Pixel Density .......................................................................................................................................................22 3. Persistence............................................................................................................................................................22 4. Resolution............................................................................................................................................................22 5. Megapixel ..............................................................................................................................................................22 6. Refresh Rate........................................................................................................................................................23 7. Bit Depth...............................................................................................................................................................23 8. Aspect Ratio ........................................................................................................................................................23 9. Scanline .................................................................................................................................................................24 10. Bitmap....................................................................................................................................................................24 11. Pixel Map...............................................................................................................................................................24
2 | R u s t a m S h r e s t h a C o m p u t e r G r a p h i c s H a n d o u t s S M C B C A 2 0 7 8 Emissive Displays..............................................................................................................................................................24 Non-Emissive Displays...................................................................................................................................................24 Types of graphics softwares........................................................................................................................................25 General-Purpose Graphics Software...................................................................................................................25 Special-Purpose Graphics Software....................................................................................................................25 Software standards ..............................................................................................................................................................26 1. GKS (Graphical Kernel System).........................................................................................................................26 2. PHIGS (Programmer's Hierarchical Interactive Graphics System)....................................................27 3. PHIGS+ (PHIGS Plus).............................................................................................................................................27 Scan Conversion Algorithm..............................................................................................................................................28 Why Scan Conversion is Needed...............................................................................................................................28 Key Scan Conversion Algorithms ..............................................................................................................................28 a) Line Drawing Algorithms................................................................................................................................28 b) Circle Drawing Algorithms .............................................................................................................................28 c) Ellipse Drawing Algorithms ...........................................................................................................................28 d) Polygon Filling Algorithms.............................................................................................................................28 1. Line Drawing Algorithms..........................................................................................................................................28 a) Digital Differential Analyzer (DDA).............................................................................................................28 DDA algorithm...................................................................................................................................................................29 b) Bresenham's Line Algorithm.........................................................................................................................29 Bressenham Line Drawing Algorithm .....................................................................................................................30 2. Circle Drawing Algorithms ...................................................................................................................................31 1. Midpoint Circle Algorithm..............................................................................................................................31 Midpoint Circle Drawing Algorithm..........................................................................................................................32 1. Bresenham’s Circle Algorithm......................................................................................................................32 Bressenham Circle Algorithm.....................................................................................................................................33 3. Ellipse Drawing Algorithms .................................................................................................................................35 a) Midpoint Ellipse Algorithm............................................................................................................................35 Midpoint Ellipse Algorithm......................................................................................................................................35 4. Polygon Filling Algorithms....................................................................................................................................36 a) Scan-Line Polygon Fill Algorithm ...............................................................................................................36 Scan line Polygon fill Algorithm ............................................................................................................................36 b) Flood Fill and Boundary Fill ...........................................................................................................................37
3 | R u s t a m S h r e s t h a C o m p u t e r G r a p h i c s H a n d o u t s S M C B C A 2 0 7 8 1. Flood Fill......................................................................................................................................................................37 Flood fill Algorithm .....................................................................................................................................................37 2. Boundary Fill Algorithm.................................................................................................................................38 Boundary Fill Algorithm............................................................................................................................................38 Homogeneous Coordinates..............................................................................................................................................45 Homogeneous Matrix..........................................................................................................................................................45 2D viewing pipeline..........................................................................................................................................................47 Window to viewport........................................................................................................................................................48 Clipping.................................................................................................................................................................................49 Cohen Sutherland line clipping algorithm.............................................................................................................50 Sutherland Hodgman algorithm................................................................................................................................50 Visible Surface Detection...................................................................................................................................................52 Example of Visible Surface Detection .....................................................................................................................52 Object-Space Methods..................................................................................................................................................52 Features...........................................................................................................................................................................52 Advantages.....................................................................................................................................................................52 Disadvantages...............................................................................................................................................................53 Types .................................................................................................................................................................................53 Basic Working of object space ..............................................................................................................................53 Image-Space Methods...................................................................................................................................................53 Features...........................................................................................................................................................................53 Advantages.....................................................................................................................................................................53 Disadvantages...............................................................................................................................................................54 Types .................................................................................................................................................................................54 Basic working ................................................................................................................................................................54 1. Backface Detection................................................................................................................................................54 Z buffer algorithm .......................................................................................................................................................56 A Buffer.................................................................................................................................................................................59 Why linked lists ? .........................................................................................................................................................60 Depth Sorting (Painter's Algorithm).........................................................................................................................62 All in one link for the previous algorithm..........................................................................................................64 scanline method ...............................................................................................................................................................64 Refresh Rate .......................................................................................................................................................................66