0% found this document useful (0 votes)
12 views49 pages

Computer Graphics Study Notes and Applications

Computer graphics

Uploaded by

Konark Sharma
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views49 pages

Computer Graphics Study Notes and Applications

Computer graphics

Uploaded by

Konark Sharma
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Computer Graphics - Comprehensive Study Notes

Detailed Notes for All Units with Examples, Advantages, and Disadvantages

UNIT I: GRAPHICS PRIMITIVES

1. Introduction to Computer Graphics

Definition
Computer Graphics is the art and science of creating, manipulating, and storing visual content using computers[^103]. It involves
computations, creation, and manipulation of data to generate digital images, animations, and interactive graphics[103][106]. Computer
graphics deals with both 2D and 3D graphics, along with image processing[^100].

What is Computer Graphics?


Computer Graphics encompasses digital images, animations, and interactive graphics used in various sectors such as entertainment,
education, scientific visualization, and virtual reality[^103]. It is an abbreviation commonly referred to as CG and includes UI design,
rendering, geometric objects, animation, and many more applications[^103].

Evolution and Importance


In today's digital era, computer graphics technologies have revolutionized how we perceive and interact with visual information,
playing a pivotal role in video games, movies, architectural design, medical imaging, and more[^103]. Computer graphics has
transformed from simple line drawings to photorealistic 3D renderings and real-time interactive simulations.

2. Basics of Graphics Systems

Components of Graphics Systems


Modern graphics systems consist of three primary components[^109]:

1. Digital Memory (Frame Buffer): A memory area where the displayed image is stored as a matrix of intensity values[^109]. The
frame buffer holds the pixel information for the entire screen.
2. Monitor: The display device that presents the visual output to the user[^109]. Modern monitors use various technologies
including LCD, LED, and OLED.

3. Display Controller: A simple interface that passes the contents of the frame buffer to the monitor[^109]. It controls the refresh
rate and synchronization of the display.

Graphics Hardware Architecture


A complete graphics system includes:

Input Devices: Keyboard, mouse, trackball, joystick, digitizer, touch screens, light pen, data glove
Central Processing Unit (CPU): Performs general computations and coordinates system operations
Graphics Processing Unit (GPU): Specialized processor for handling graphics operations
Frame Buffer: High-speed memory for storing pixel data
Output Devices: Monitor, printer, plotter
3. Application Areas of Computer Graphics
Computer Graphics has numerous applications across various domains[100][103][^106]:

Computer-Aided Design (CAD)


Used for designing buildings, automobiles, aircraft, and electronic devices with minute details[100][103]. CAD systems provide:

Precise measurements and specifications

3D modeling capabilities
Simulation and testing
Engineering analysis

Examples: AutoCAD, SolidWorks, CATIA for mechanical and architectural design

Advantages:

High precision and accuracy

Easy modifications and iterations


Reduced design time
Better visualization of complex structures

Disadvantages:

High software costs

Steep learning curve


Requires powerful hardware
Dependency on electricity and technology

Computer Art and Animation


Creating fine and commercial art including paintings, logo designs, and cartoon drawings[100][103]. Animation packages provide
facilities for:

Designing object shapes


Specifying object motion
Creating special effects
Character animation

Examples: Adobe Photoshop, Blender, Maya, Adobe Animate

Advantages:

Unlimited creative possibilities

Easy corrections and modifications


Reusable assets

Cost-effective compared to traditional methods

Disadvantages:

Time-consuming for complex animations

Requires artistic skills and technical knowledge


Hardware and software investment

Steep learning curve for professional tools


Entertainment Industry
Computer graphics find major utility in movie making, video games, music videos, television shows, and cartoon animation films[100]
[
103].

Movies and Visual Effects:

Photorealistic CGI characters and environments


Special effects and explosions

Motion capture technology


Virtual cinematography

Video Games:

Real-time 3D rendering

Interactive environments
Physics simulations
Character animations

Advantages:

Creates impossible scenes realistically


Reduces production costs compared to practical effects
Enables creative freedom

Interactive experiences in games

Disadvantages:

Very high production costs


Requires large teams of specialists
Rendering times can be extensive
Risk of "uncanny valley" effect

Education and Training


Computer-generated models are useful for teaching concepts in an easy-to-understand manner[100][103]. Applications include:

Interactive simulations

Virtual laboratories
Anatomical models for medical education

Flight simulators for pilot training


Military training simulations

Advantages:

Safe learning environment


Repeatable scenarios
Cost-effective training
Engaging and interactive

Disadvantages:

Initial development costs

Cannot fully replace hands-on experience


Requires technical infrastructure
May lack tactile feedback
Presentation Graphics
Used for preparing reports and summarizing financial, statistical, mathematical, scientific, and economic data[100][103]. Includes:

Bar graphs and pie charts


Line graphs and scatter plots

Infographics
Data dashboards

Advantages:

Clear visual communication


Easy to understand complex data
Professional appearance

Quick creation with modern tools

Disadvantages:

Can oversimplify complex information


Potential for misleading visuals
Requires design skills for effective communication

Scientific Visualization
Used to study trends, patterns, and analyze data[103][106]:

Satellite imaging and geodesic images


Weather maps with real-time mapping
Medical imaging (CT scans, MRI)
Molecular modeling
Astronomical simulations

Advantages:

Reveals patterns in complex data


Enables better understanding of phenomena
Supports research and discovery

Facilitates communication of scientific findings

Disadvantages:

Requires specialized software


Computationally intensive
Interpretation requires domain expertise

User Interfaces
Graphic, mouse-oriented paradigms (GUIs) that allow users to interact with computers[^106]:

Windows, Icons, Menus, Pointer (WIMP) interfaces

Touch interfaces for mobile devices


Virtual reality interfaces

Augmented reality overlays

Advantages:

Intuitive and easy to learn


Reduces need for command memorization
Visual feedback improves usability

Accessible to non-technical users

Disadvantages:

Consumes more system resources


Can be slower for expert users compared to command-line

Requires pointing device


May have accessibility challenges

Other Applications
Cartography: Drawing maps with precise geographic information[^106]

Virtual Reality: Immersive 3D environments for gaming, training, therapy


Augmented Reality: Overlaying digital information on real world
Web Design: Creating visually appealing and interactive websites

Digital Art: Creating artwork entirely using digital tools

4. Overview of Graphics Systems

Graphics System Architecture


A graphics system consists of several interconnected components working together to create and display visual content:

Graphics System Pipeline:


\begin{itemize}

\end{itemize}

Graphics APIs and Libraries


OpenGL (Open Graphics Library):

Cross-platform graphics API


Hardware-independent

Widely supported

DirectX:

Microsoft's graphics API

Windows and Xbox platform


High performance

Vulkan:

Modern low-level API


Better multi-core CPU utilization
More explicit control

Advantages of Modern Graphics APIs:

Hardware acceleration
Standardized interface
Cross-platform compatibility

Efficient resource management

Disadvantages:

Complexity in programming
Learning curve for beginners

Version compatibility issues


Platform-specific limitations

5. Video Display Devices

Cathode Ray Tube (CRT)


Working Principle:

CRT displays use an electron beam to create images on a phosphor-coated screen[101][104]. The main components include:

1. Electron Gun: Produces a stream of electrons


2. Deflection System: Electromagnetic coils that control beam position
3. Phosphor Screen: Emits light when struck by electrons
4. Shadow Mask: Ensures color purity in color displays

Advantages of CRT:

Excellent color reproduction


No native resolution (works at multiple resolutions)
High refresh rates possible
Wide viewing angles
Good response time (no motion blur)
Deep black levels

Disadvantages of CRT:

Large and heavy


High power consumption
Generates heat

Electromagnetic interference
Screen flickering at low refresh rates
Geometric distortion possible
Limited brightness

Liquid Crystal Display (LCD)


Working Principle:

LCD uses liquid crystals that don't emit light directly but use a backlight. Crystals can be manipulated electrically to allow or block
light passage.

Advantages of LCD:

Thin and lightweight


Lower power consumption than CRT
No flickering
Sharp image at native resolution
No geometric distortion
Cooler operation
Disadvantages of LCD:

Limited viewing angles (improved in IPS)

Response time issues (motion blur)


Backlight bleeding

Dead pixels possible


Lower contrast ratios than OLED

Native resolution dependency

Light Emitting Diode (LED)


Note: LED displays are actually LCD displays with LED backlighting rather than fluorescent backlighting.

Advantages of LED:

Better brightness than traditional LCD

Improved energy efficiency


Better contrast ratios
Thinner design
Longer lifespan
Mercury-free (environmentally friendly)
Disadvantages:

Higher cost than traditional LCD


Potential for uneven backlighting
Still has LCD limitations (viewing angles, response time)

Organic Light Emitting Diode (OLED)


Working Principle:

Each pixel in OLED displays emits its own light when electric current is applied. No backlight is needed.

Advantages of OLED:

True blacks (pixels can be completely off)


Infinite contrast ratio

Wide viewing angles


Fast response time (no motion blur)

Thinner and lighter than LCD


Flexible displays possible
Disadvantages:

Expensive to manufacture
Burn-in issues with static images
Shorter lifespan than LCD
Blue OLED pixels degrade faster
Lower peak brightness than high-end LCDs
6. Raster-Scan Systems

Definition and Working Principle


In raster-scan displays, the electron beam sweeps across the screen from left to right and top to bottom, one row at a time[101][104].
The picture is stored in a frame buffer as a matrix of pixel intensity values[^104].

Architecture of Raster-Scan System


1. Frame Buffer: Memory that stores intensity values for all screen pixels[^104]
2. Video Controller: Reads frame buffer and controls display

3. Display Processor: Handles graphics operations


4. System Memory: Stores programs and data
5. System Bus: Connects all components

Scanning Process
Horizontal Scanning (Retrace):

Electron beam moves left to right across each line


Illuminates pixels according to frame buffer values[^101]

At line end, beam returns to left side (horizontal retrace)

Vertical Scanning (Retrace):

After completing all horizontal lines, beam returns to top-left


This is called vertical retrace[^101]
Process repeats continuously (refresh)

Refresh Rate
The screen must be refreshed 60 to 80 times per second to prevent flickering[^104]. Common refresh rates:

60 Hz: Standard refresh rate


75 Hz: Reduces flicker
120 Hz: Smooth motion
144 Hz+: Gaming displays

Advantages of Raster-Scan Systems


1. Realistic Images: Can display complex scenes with shading, textures, and realistic images[101][104]

2. Cost-Effective: Generally more affordable than random-scan systems[^101]


3. Color Capability: Easy to implement color displays[^104]
4. Versatility: Can display any type of image or pattern[^101]
5. Filled Areas: Excellent for filled polygon rendering
6. Image Processing: Suitable for image manipulation and processing
7. High Resolution: Modern systems support very high resolutions

Disadvantages of Raster-Scan Systems


1. Higher Memory Requirements: Must store information for every pixel[^101]
2. Pixelation: Diagonal lines and curves may appear jagged (aliasing)[^104]

3. Processing Power: Requires significant processing for high resolutions[^101]


4. Motion Blur: Potential motion blur in fast-moving scenes[^101]

5. Refresh Overhead: Entire screen must be refreshed even if unchanged


6. Lower Resolution for Lines: Lines may not be as sharp as vector displays

7. Random-Scan Systems

Definition and Working Principle


Random-scan displays (also called vector displays or stroke-writing displays) draw images by directly moving the electron beam from
one point to another to draw lines[104][107]. The beam follows the path of the actual image being displayed[^101].

Architecture of Random-Scan System


1. Display List (Refresh Buffer): Stores drawing commands (line endpoints, not pixels)[^101]

2. Display Processor: Interprets display list and controls beam


3. Vector Generator: Generates signals for drawing lines
4. Beam Positioning System: Positions electron beam precisely

Drawing Process
The system stores only the line drawing instructions[^107]:

Starting point coordinates (x₁, y₁)


Ending point coordinates (x₂, y₂)

Beam intensity and color

The electron beam is directed only to the parts where lines should appear[^104]. The picture is drawn 30 to 60 times per
second[^104].

Advantages of Random-Scan Systems


1. High Resolution: Produces very smooth lines and curves[101][104]
2. Efficient Memory Usage: Only stores line endpoints, not every pixel[^101]
3. Sharp Lines: Excellent for line drawings and wireframe graphics[^101]
4. No Pixelation: Lines appear smooth without jagged edges
5. Precision: Ideal for CAD and technical drawing applications[^101]
6. Lower Data Volume: Less data to refresh
7. Bright Images: Higher intensity possible for displayed lines

Disadvantages of Random-Scan Systems


1. Limited to Line Drawings: Cannot easily fill areas or display realistic images[104][107]

2. Complexity: More complex hardware compared to raster systems[^101]


3. Higher Cost: More expensive due to specialized components[^101]

4. Limited Color: Difficult to implement multiple colors


5. Slower for Complex Images: Performance degrades with many lines[^101]

6. Flickering: May flicker with complex images containing many lines


7. Obsolete Technology: Largely replaced by raster displays

8. Comparison: Raster-Scan vs Random-Scan


Aspect amp; Raster-Scan amp; Random-Scan
Rendering Method amp; Scans pixels sequentially in amp; Draws lines directly point-to-
fixed pattern[^101] point[^101]
Image Quality amp; Can display realistic images amp; High-quality smooth lines and
with textures[^104] curves[^101]
Resolution amp; High pixel resolution but amp; Very high line resolution[^104]
potential pixelation[^101]
Speed amp; Faster for complex amp; Slower with many lines[^101]
images[^101]
Memory Usage amp; Higher memory consumption amp; Efficient memory usage
(stores all pixels)[^101] (stores endpoints)[^101]
Cost amp; Generally more amp; More expensive[^101]
affordable[^101]
Best For amp; Realistic images, filled amp; Line drawings, CAD,
polygons, photos wireframes[^101]
Color Support amp; Easy color implementation amp; Limited color capability
Applications amp; Modern displays, gaming, amp; Technical drawings (obsolete)
multimedia [^107]

Table 1: Comparison of Raster-Scan and Random-Scan Systems

9. Graphics Monitors and Workstations

Graphics Monitors

CRT Monitors:

Used in older graphics workstations


Excellent color accuracy for professional work
Heavy and power-hungry

LCD/LED Monitors:

Modern standard for graphics work


Lightweight and energy efficient
Available in various resolutions (HD, Full HD, 4K, 8K)

Professional Graphics Monitors:

Wide color gamut (Adobe RGB, DCI-P3)

Hardware calibration
High bit depth (10-bit or higher)

Factory calibration
Uniform brightness across screen

Graphics Workstations
High-performance computer systems designed for graphics-intensive tasks:

Components:

• Powerful multi-core CPUs

• Professional graphics cards (NVIDIA Quadro, AMD Radeon Pro)


• Large amounts of RAM (32GB-128GB+)

• High-speed storage (NVMe SSDs)


• Multiple high-resolution displays
• Color-accurate monitors
Applications:

3D modeling and animation

Video editing and color grading


CAD and engineering design

Scientific visualization
Medical imaging

Game development
Advantages:

Optimized for graphics applications


Reliable and stable

Certified drivers for professional software


ECC memory options for data integrity
Disadvantages:

Expensive compared to consumer systems


Overkill for general computing
Higher power consumption
Requires specialized knowledge

10. Input Devices

Keyboard
Description: Primary text and command input device.

Advantages:

Fast text entry


Precise control
Widely available and standardized
Inexpensive
Disadvantages:

Not intuitive for graphics operations

Requires both hands


Limited spatial control

Mouse
Description: Pointing device with buttons for selection and interaction.

Types:

Mechanical mouse

Optical mouse
Laser mouse

Gaming mouse (high DPI)


Advantages:

Intuitive point-and-click operation

Precise cursor control


Inexpensive

Widely supported

Disadvantages:

Requires flat surface


Repetitive strain possible

Limited to 2D input
Not suitable for 3D manipulation

Trackball
Description: Upside-down mouse where ball is rotated directly.

Advantages:

Requires less desk space


No mouse pad needed

Reduced wrist movement


Precise control for some users

Disadvantages:

Learning curve
Ball requires cleaning

Less common than mouse


Can be more expensive

Joystick
Description: Control stick used for gaming and 3D navigation.

Advantages:

Good for 3D movement


Analog input (variable speed)
Familiar for gaming
Ergonomic design

Disadvantages:

Less precise for 2D pointing


Requires practice

Takes up desk space


Not suitable for all applications

Graphics Tablet (Digitizer)


Description: Flat surface with stylus for drawing and writing.

Types:

Non-display tablets (Wacom Intuos)

Display tablets (Wacom Cintiq, iPad Pro)


Pen displays

Advantages:

Natural drawing experience


Pressure sensitivity

Tilt and rotation detection


Precise control for artists
High resolution input
Disadvantages:

Expensive (especially display tablets)


Learning curve for non-display tablets

Requires installation and calibration


Hand-eye coordination needed for non-display types

Touch Screen
Description: Display that detects touch input.

Technologies:

Resistive (pressure-sensitive)
Capacitive (touch-sensitive)
Infrared
Surface Acoustic Wave
Advantages:

Direct manipulation
Intuitive for casual users
No separate input device needed
Multi-touch gestures
Space-efficient
Disadvantages:

Fingerprints on screen
Arm fatigue in vertical orientation
Less precise than stylus
No pressure sensitivity (usually)

Gorilla arm syndrome

Light Pen
Description: Pen-like device that detects light from screen.

Advantages:

Direct screen pointing


Intuitive operation

Good for selection tasks


Disadvantages:

Obsolete technology
Requires CRT display
Arm fatigue
Blocks view of screen
Data Glove
Description: Glove equipped with sensors for tracking hand and finger movements.

Advantages:

Natural hand gestures

3D input capability
Good for VR/AR
Multiple degrees of freedom
Disadvantages:

Expensive

Calibration required
Limited precision
Not suitable for all tasks

3D Mouse (Space Mouse)


Description: Device for 3D navigation with 6 degrees of freedom.

Advantages:

Excellent for 3D modeling


Pan, zoom, rotate simultaneously
Intuitive 3D navigation
Used by professionals
Disadvantages:

Expensive
Learning curve

Requires software support


Not useful for 2D work

OUTPUT PRIMITIVES

1. Points and Lines

Point
Definition: A point is the most basic graphics primitive, representing a single pixel location with coordinates (x, y)[^105].

Representation:

In 2D: Point P = (x, y)


Integer coordinates for raster displays

Floating-point for calculations

Properties:

Position (x, y coordinates)

Color (RGB or indexed)


Intensity/brightness
Line
Definition: A line is a straight path connecting two points, defined by starting point (x₀, y₀) and ending point (x₁, y₁)[^105].

Mathematical Representation:

The equation of a line is:

where m = slope =

Line Properties:

Starting point
Ending point

Slope
Length
Color

Thickness
Style (solid, dashed, dotted)

2. Line Drawing Algorithms

Why Algorithms Needed?


Monitors use discrete pixels, but mathematical lines are continuous. Line drawing algorithms determine which pixels to illuminate to
best represent a line[102][105].

Digital Differential Analyzer (DDA) Algorithm


Concept:

DDA is the simplest line drawing algorithm that uses incremental calculations with floating-point arithmetic[102][105].

Algorithm Steps:

1. Calculate and

2. Calculate slope
3. Determine number of steps:

4. Calculate increments:

5. Starting from , repeat for each step:



• Plot pixel at

Example:

Draw line from (5, 6) to (8, 12):




• Steps = max(3, 6) = 6


Generated points:

(5, 6) → (5.5, 7) → (6, 8) → (6.5, 9) → (7, 10) → (7.5, 11) → (8, 12)

After rounding: (5,6), (6,7), (6,8), (7,9), (7,10), (8,11), (8,12)

Advantages of DDA:

1. Simple and easy to implement[102][105]


2. Straightforward logic
3. Works for lines with any slope

4. Good for understanding basic concepts

Disadvantages of DDA:

1. Slower due to floating-point operations[102][105]

2. Rounding errors accumulate[^102]


3. Not efficient for hardware implementation
4. Accuracy issues with long lines

5. Floating-point arithmetic computationally expensive

Bresenham's Line Drawing Algorithm


Concept:

Bresenham's algorithm uses only integer arithmetic and incremental calculations, making it faster and more accurate than DDA[102]
[105][^108].

Key Idea:

At each step, decide whether to increment y or keep it same based on which pixel is closer to the ideal line[^108].

Algorithm for Slope 0 < m < 1:

1. Calculate and

2. Calculate initial decision parameter:

3. For each from to :


• If :
– Plot

• If :
– Plot

Example:

Draw line from (20, 10) to (30, 18):


• Since : plot (21, 11),


• Since : plot (22, 12),

• Since : plot (23, 12),


• Continue this process...

Advantages of Bresenham's Algorithm:


1. Fast - uses only integer arithmetic[102][105]

2. Accurate - no floating-point rounding errors[^102]


3. Efficient for hardware implementation
4. Ideal for real-time applications[^102]

5. Minimal computations per pixel


6. Can be easily optimized

Disadvantages of Bresenham's Algorithm:

1. More complex to understand than DDA[^105]


2. Basic version handles only specific slopes
3. Still produces jagged lines (aliasing)[^105]

4. Requires different cases for different slopes


5. Cannot handle anti-aliasing directly

Midpoint Line Drawing Algorithm


Concept:

Similar to Bresenham's but uses the midpoint between two candidate pixels to make decisions[^105].

Algorithm Steps:

1. Calculate and

2. Calculate initial decision parameter:

3. For each point:


• If : choose pixel at same y-level,
• If : choose pixel at next y-level,

Advantages:

Integer arithmetic
Efficient and accurate
Easier to extend to circles and ellipses

Disadvantages:

Similar to Bresenham's limitations


Requires understanding of midpoint concept

Comparison of Line Drawing Algorithms

Aspect amp; DDA amp; Bresenham's amp; Midpoint


Arithmetic amp; Floating-point[^102] amp; Integer only[^102] amp; Integer only
Speed amp; Slower[^102] amp; Faster[^102] amp; Fast
Accuracy amp; Rounding errors[^102] amp; Highly accurate[^102] amp; Accurate
Implementation amp; Simple[^102] amp; Moderate complexity amp; Moderate
Efficiency amp; Lower amp; High[^102] amp; High
Hardware Support amp; Poor amp; Excellent amp; Good

Table 2: Comparison of Line Drawing Algorithms


3. Circle Drawing Algorithms

Midpoint Circle Algorithm


Why Special Algorithm?

Drawing circles pixel by pixel using the equation requires expensive square root calculations. The midpoint circle
algorithm uses symmetry and integer arithmetic[102][105].

Eight-Way Symmetry:

A circle has 8-fold symmetry. For each point (x, y) calculated in one octant, we can plot 8 points[^105]:

(x, y)

(y, x)
(-x, y)
(-y, x)

(x, -y)
(y, -x)
(-x, -y)
(-y, -x)
Algorithm Steps:

1. Input center and radius


2. Initialize: ,
3. Calculate initial decision parameter:

4. While :
• Plot 8 symmetric points

• Increment x:
• If :

• Else:

Example:

Draw circle with center (0, 0) and radius 10:

• Initial: , ,
• Since : plot 8 points for (0, 10),

• Since : plot 8 points for (1, 10),


• Continue until
Advantages of Midpoint Circle Algorithm:

1. Highly efficient using integer operations[^102]


2. Exploits symmetry to reduce calculations[^102]
3. No trigonometric functions needed

4. Fast execution
5. Simple to implement
6. Accurate results
Disadvantages of Midpoint Circle Algorithm:
1. Limited to circles only[^102]

2. Modifications required for ellipses[^102]


3. Still produces pixelated output
4. Cannot handle anti-aliasing directly

5. Separate algorithm needed for filled circles

4. Ellipse Drawing Algorithm

Midpoint Ellipse Algorithm


Ellipse Equation:

where a = semi-major axis, b = semi-minor axis

Four-Way Symmetry:

Ellipse has 4-fold symmetry. For each point (x, y), we can plot:

(x, y)
(-x, y)
(x, -y)
(-x, -y)
Algorithm Approach:

The algorithm works in two regions:

Region 1: Slope > -1 (increment x)


Region 2: Slope < -1 (decrement y)
Region 1 Decision Parameter:

Region 2 Decision Parameter:

Advantages:

Integer arithmetic
Efficient calculation

Uses symmetry
Good accuracy

Disadvantages:

More complex than circle algorithm


Two regions to handle

Separate calculations for major and minor axes


Pixelation still occurs

5. Filled Area Primitives


Scan-Line Polygon Fill Algorithm
Concept:

Fill the interior of a polygon by determining span intervals for each scan line that crosses the polygon[^112].

Algorithm Steps:

1. Create edge table containing all polygon edges (except horizontal)


2. For each edge, store:

• : maximum y-coordinate
• at : x-coordinate at minimum y
• : inverse slope
3. Sort edges by increasing
4. Initialize active edge table (AET)
5. For each scan line from bottom to top:

• Add edges starting at this scan line to AET


• Remove edges ending at this scan line from AET
• Sort AET by x-coordinate
• Fill pixels between pairs of x-coordinates in AET
• Update x-coordinates:

Advantages:

Efficient for complex polygons


Handles concave polygons
Systematic approach
Good for hardware implementation
Works with any polygon

Disadvantages:

Complex data structures


Requires edge table management
Special cases for horizontal edges
Intersection calculations needed
More memory overhead

Boundary Fill Algorithm


Concept:

Start from an interior point and recursively fill pixels until a boundary color is encountered[^105].

Algorithm (4-connected):

8-Connected Version:
Also fills diagonal neighbors for smoother results.
Advantages:
Simple concept

Works with any shape


Easy to implement

Can handle complex boundaries


User-friendly (click to fill)

Disadvantages:
Recursive - can cause stack overflow

Slow for large areas


May miss pixels in 4-connected version
Boundary must be continuous

Inefficient memory usage

Flood Fill Algorithm


Concept:
Similar to boundary fill but replaces all pixels of a given color with fill color, regardless of boundaries[^105].
Algorithm (4-connected):
Difference from Boundary Fill:
Boundary fill stops at boundary color
Flood fill replaces old color with fill color
Flood fill doesn't require distinct boundary

Advantages:
Simple and intuitive
No boundary needed
Flexible color replacement
Works with multiple disconnected areas of same color

Disadvantages:
Recursive implementation issues
Slower than scan-line
Stack overflow risk
Can fill entire screen if oldColor is background
Multiple passes for complex shapes

Comparison of Fill Algorithms

Aspect amp; Scan-Line amp; Boundary Fill amp; Flood Fill


Approach amp; Systematic scan lines amp; Recursive spread amp; Recursive
spread
Efficiency amp; Most efficient amp; Moderate amp; Moderate
Complexity amp; High (data structures) amp; Low (simple logic) amp; Low
Memory amp; Edge tables amp; Recursion stack amp; Recursion
stack
Best For amp; Complex polygons amp; Interactive filling amp; Color
replacement
Limitations amp; Complex amp; Stack overflow amp; No boundary
implementation check

Table 3: Comparison of Polygon Fill Algorithms

UNIT II: 2-D TRANSFORMATIONS AND VIEWING


1. 2-D Geometrical Transforms

Introduction to Transformations
Definition: 2D transformations are operations that modify the position, size, shape, or orientation of objects in a 2D space by
applying mathematical operations to their coordinates[110][113].
Purpose:
Object manipulation and animation

Computer-aided design
Image processing
User interface interactions
Special effects

Translation
Definition: Translation moves an object from one position to another by adding translation distances to coordinates[^110].
Translation Equations:
For translating point P(x, y) by distance in x-direction and in y-direction:

Matrix Form:

Example:
Translate triangle with vertices A(1, 1), B(4, 1), C(4, 4) by , :
New vertices:
A'(1+3, 1+2) = A'(4, 3)
B'(4+3, 1+2) = B'(7, 3)
C'(4+3, 4+2) = C'(7, 6)
Advantages:

Simple and intuitive


Preserves shape and size

No distortion
Easy computation
Fundamental transformation

Disadvantages:
Limited functionality alone
Must combine with other transforms for complex motion
Cannot change size or orientation

Scaling
Definition: Scaling changes the size of an object by multiplying coordinates by scaling factors[110][116].
Scaling Equations:
For scaling point P(x, y) with factors and :

Matrix Form:

Scaling Types:

• Uniform Scaling: (maintains aspect ratio)

• Non-uniform Scaling: (distorts aspect ratio)


• Enlargement:

• Reduction:
Example:
Scale square with vertices (1, 1), (1, 3), (3, 3), (3, 1) by , :
New vertices: (2, 2), (2, 6), (6, 6), (6, 2)
Fixed-Point Scaling:
To scale about point instead of origin:

1. Translate object so fixed point is at origin:


2. Apply scaling:

3. Translate back:
Advantages:

Simple calculation

Resizes objects easily


Uniform scaling preserves shape
Reversible operation

Disadvantages:
Moves object if not about center
Non-uniform scaling distorts shape
Changes object position unless fixed-point used
Affects line thickness and other properties

Rotation
Definition: Rotation changes the orientation of an object by rotating it through an angle θ about a pivot point[110][113].
Rotation Equations (about origin):
For rotating point P(x, y) by angle θ counter-clockwise:

Matrix Form:

Example:
Rotate point (2, 0) by 90° counter-clockwise:

Result: (0, 2)
Fixed-Point Rotation:
To rotate about point :

1. Translate to move rotation point to origin


2. Apply rotation

3. Translate back
Advantages:

Maintains object size and shape


Smooth angular motion

Natural for animation


Reversible (rotate by -θ)
Disadvantages:

Trigonometric functions computationally expensive

Cumulative errors in repeated rotations


Must specify pivot point

Can move object if not rotated about center


Reflection
Definition: Reflection produces a mirror image of an object about an axis[^110].
Types of Reflection:
Reflection about X-axis:

Matrix:

Reflection about Y-axis:

Matrix:

Reflection about Origin:

Matrix:

Reflection about line y = x:

Matrix:

Reflection about line y = -x:

Matrix:

Advantages:

Creates symmetrical images


Simple computation
Useful for symmetry operations
No size distortion
Disadvantages:

Changes orientation (handedness)

Limited practical applications alone


Must specify axis of reflection
Cannot be undone by same transformation

Shear
Definition: Shear distorts the shape of an object by slanting it along an axis[^110].
X-Shear (horizontal):

Matrix:

Y-Shear (vertical):

Matrix:

Example:
X-shear square (0,0), (1,0), (1,1), (0,1) with :
New vertices: (0,0), (1,0), (3,1), (2,1) — parallelogram
Advantages:
Creates slanting effects

Useful for italic text


Preserves area

Simple calculation
Disadvantages:

Distorts shape significantly

Not intuitive for users


Limited practical applications

Changes angles

2. Homogeneous Coordinates

Why Homogeneous Coordinates?


Problem: Translation cannot be expressed as matrix multiplication in 2×2 form like other transformations[113][119].
Solution: Use 3×3 matrices with homogeneous coordinates (x, y, 1)[113][119].

2D Point Representation
Regular coordinates: (x, y)
Homogeneous coordinates: (x, y, 1) or (xh, yh, h) where x = xh/h, y = yh/h

Transformation Matrices in Homogeneous Form


Translation:

Scaling:

Rotation:

Advantages of Homogeneous Coordinates:


Uniform representation of all transformations

Enables matrix multiplication for translation


Facilitates composite transformations
Simplifies perspective projections
Consistent mathematical framework
Disadvantages:

Extra dimension increases computation


More memory required
Slightly more complex
Division needed to convert back

3. Composite Transformations
Definition
Composite transformation is a sequence of transformations applied one after another[110][113].

Matrix Concatenation
Multiple transformations can be combined into single matrix by multiplication:

Important: Matrix multiplication is NOT commutative:

Order matters!

Common Composite Transformations


Scaling about arbitrary point :

Rotation about arbitrary point :

Example:
Rotate square about its center (2, 2) by 45°:
1. Translate center to origin:
2. Rotate:
3. Translate back:
4. Composite:

Advantages of Composite Transformations:


Efficient - single matrix multiplication
Reusable transformation matrices
Complex effects from simple operations
Reduces computation for multiple objects
Hierarchical modeling support

Disadvantages:
Order dependency can be confusing

Matrix multiplication overhead


Numerical precision issues
Difficult to decompose back to components

4. Transformations Between Coordinate Systems

Coordinate System Types


World Coordinate System (WCS):
Absolute reference frame
Application-specific units
Object placement and relationships

Modeling Coordinate System (MCS):


Local to each object
Convenient for object definition
May differ for each object

Device Coordinate System (DCS):


Screen pixels
Hardware-specific
Integer coordinates
Transformation Pipeline
1. Modeling Transformation: MCS → WCS
2. Viewing Transformation: WCS → Viewing Coordinates

3. Normalization: Viewing → Normalized Device Coordinates


4. Device Transformation: Normalized → Device Coordinates

Advantages:
Separates concerns

Device independence
Flexibility in object modeling
Hierarchical scene representation

Disadvantages:
Multiple transformation stages
Computational overhead

Potential precision loss


Complex pipeline management

5. 2-D Viewing

The Viewing Pipeline


Definition: The viewing pipeline is the sequence of operations to transform world coordinates to device coordinates for display[111]
[114].

Pipeline Stages:
1. Object Coordinates: Individual object definition
2. World Coordinates: Assembled scene
3. Viewing Coordinates: Camera/observer perspective[^111]
4. Normalized Device Coordinates: Device-independent[^111]
5. Device Coordinates: Actual screen pixels[^111]

Viewing Coordinate Reference Frame


Definition: A coordinate system with origin at viewing position and axes aligned with viewing direction.
Components:
View reference point (VRP): Origin of viewing system
View plane normal (VPN): Direction of viewing
View up vector (VUP): Defines "up" direction

Window and Viewport


Window:
Rectangular area in world coordinates

Specifies what part of scene to view[111][117]


Defined by: to [^114]

Viewport:
Rectangular area on display device

Specifies where to display the window content[111][117]


Defined by: to [^114]

Relationship:
Window selects the part of scene, viewport positions it on display device[^111].

6. Window-to-Viewport Transformation

Purpose
Transform coordinates from window (world space) to viewport (screen space)[111][117].

Transformation Steps
1. Translate window to origin:

2. Scale to viewport size:

where:

3. Translate to viewport position:

Transformation Equations

Example:
Window: (0, 0) to (100, 100)
Viewport: (50, 50) to (150, 150)
Point in window: (60, 80)
Scaling factors:

Viewport coordinates:

Result: (110, 130)


Advantages:
Device independence
Aspect ratio control
Flexible viewing
Zooming capability

Disadvantages:
Potential distortion if aspect ratios differ
Clipping may be needed
Computational overhead

7. Clipping
Purpose
Clipping removes portions of objects that lie outside the viewing window to display only visible parts[112][115].

Types of Clipping
Point Clipping: Determine if point is inside window
Line Clipping: Clip lines against window boundaries
Polygon Clipping: Clip polygons against window

Text Clipping: Clip character strings

8. Cohen-Sutherland Line Clipping Algorithm

Concept
Efficiently determines which lines or portions of lines lie inside the clipping window using region codes[^119].

Region Codes
The viewing plane is divided into 9 regions with 4-bit codes:
Bit positions: [Top | Bottom | Right | Left]

Algorithm Steps
1. Compute region codes for both endpoints
2. Check three cases:
• Trivially accept: Both codes = 0000 (both inside)
• Trivially reject: Bitwise AND of codes 0 (both in same outside region)

• Needs clipping: Neither above case


3. For clipping case:
• Select endpoint outside window
• Calculate intersection with window boundary
• Replace outside point with intersection
• Repeat until accept or reject

Example:
Window: (10, 10) to (50, 50)
Line: (5, 5) to (60, 30)
Point1 (5, 5): x < xmin and y < ymin → code 0101
Point2 (60, 30): x > xmax → code 0010
AND = 0000 → Not trivially rejected
Clip against xmin=10: Find intersection at (10, y)
Continue clipping process...
Advantages:

Very fast for completely inside/outside cases


Simple region code computation
Efficient bitwise operations

Works well for rectangular windows

Disadvantages:
Only for rectangular windows
May require multiple iterations
Not optimal for all line orientations
Floating-point calculations for intersections
9. Cyrus-Beck Line Clipping Algorithm

Concept
More general clipping algorithm that works with convex polygonal clipping regions, not just rectangles.

Key Ideas
Uses parametric line representation
Calculates intersection with all edges
Determines visible parameter range
Works with any convex polygon

Parametric Line Equation

where P₀ and P₁ are line endpoints.

Algorithm Steps
1. Express line in parametric form
2. For each edge of clipping polygon:
• Calculate edge normal vector
• Determine if line is entering or leaving
• Calculate parameter t at intersection

3. Find maximum t for entering (t_in)


4. Find minimum t for leaving (t_out)
5. If , line is visible from to
6. If , line is completely outside

Advantages:
Works with convex polygons
More general than Cohen-Sutherland

Single-pass algorithm
Consistent approach for all edges
Disadvantages:

More complex than Cohen-Sutherland for rectangles


Requires normal vector calculations

Only works with convex regions


More computationally intensive

10. Sutherland-Hodgeman Polygon Clipping Algorithm

Concept
Clips polygons against a convex clipping window by clipping against each edge sequentially[112][115][^118].
Algorithm Approach
Process polygon against each clipping boundary (left, right, top, bottom) in sequence[112][115]. Output of one stage becomes input to
next[^112].

Four Clipping Cases


For each polygon edge relative to clipping boundary:

1. Inside to Inside: Keep second vertex[112][115]


2. Inside to Outside: Add intersection point, discard second vertex[^112]
3. Outside to Inside: Add intersection point and second vertex[^112]
4. Outside to Outside: Discard both vertices[^112]

Clipping Order
1. Clip against left edge ( )[^112]

2. Clip against right edge ( )[^112]


3. Clip against top edge ( )[^112]
4. Clip against bottom edge ( )[^112]

Example:
Original polygon: V1(30, 35), V2(40, 45), V3(55, 30), V4(35, 20)
Window: (20, 20) to (50, 40)
Left Clipping (x = 20):
All vertices have x > 20, so all pass through

Right Clipping (x = 50):


V3(55, 30) is outside
Calculate intersection point
Top Clipping (y = 40):

V2(40, 45) is outside


Calculate intersection point

Bottom Clipping (y = 20):


All remaining vertices have y > 20, so all pass through
Final clipped polygon has modified vertices.
Advantages:
Handles concave and convex polygons
Simple and systematic approach[112][115]

Easy to implement[^118]
Works edge by edge[^115]

Suitable for hardware implementation


Disadvantages:

Only works with convex clipping windows[^118]


May generate extra vertices[^118]

Four separate passes required


Potential for degenerate polygons

Intersection calculations needed


Comparison of Clipping Algorithms

Aspect amp; Cohen- amp; Cyrus-Beck amp; Sutherland-


Sutherland Hodgeman
Type amp; Line clipping amp; Line clipping amp; Polygon
clipping[^112]
Clipping Region amp; Rectangle only amp; Convex polygon amp; Convex
polygon[^118]
Efficiency amp; Very fast for trivial amp; Consistent amp; Systematic[^112]
cases performance
Complexity amp; Simple amp; Moderate amp; Moderate
Passes amp; Variable amp; Single pass amp; Four passes[^112]
Best For amp; Rectangular amp; General convex amp; Polygon
windows, lines regions clipping[^115]

Table 4: Comparison of Clipping Algorithms

UNIT III: 3-D OBJECT REPRESENTATION

1. 3-D Object Representation Methods

Why 3D Representation?
Real-world objects have three dimensions (length, width, depth). 3D representation enables:
Realistic visualization
Engineering analysis

Manufacturing (CAD/CAM)
Animation and entertainment
Scientific simulation

Types of 3D Representations
1. Polygon Surfaces: Objects represented as collections of polygons

2. Quadric Surfaces: Mathematical surfaces (spheres, cylinders, cones)

3. Spline Representations: Curved surfaces using control points


4. Volumetric Representations: Voxel-based solid models

5. Constructive Solid Geometry (CSG): Boolean combinations of primitives

2. Polygon Surfaces

Definition
3D objects approximated by a mesh of planar polygons (usually triangles or quadrilaterals).

Polygon Mesh
Components:

Vertices: 3D coordinate points


Edges: Lines connecting vertices
Faces: Closed polygons forming surface

Data Structures:
Vertex List:
V1: (x1, y1, z1)
V2: (x2, y2, z2)
V3: (x3, y3, z3)
...

Face List:

F1: [V1, V2, V3]


F2: [V2, V4, V3]
...

Types of Polygon Meshes


Triangle Mesh:

Most common

Always planar
Simple rendering

Easy to subdivide
Quad Mesh:

Four vertices per face


Better for some modeling operations
May not be planar

Advantages of Polygon Surfaces:


Simple and well-understood
Fast rendering
Easy to implement
Hardware support
Good for flat or faceted objects
Easy collision detection
Disadvantages:

Faceted appearance (not smooth)


Large memory for complex curves

Difficult to edit smoothly


Storage overhead

Approximation of curved surfaces


Topology changes difficult

Applications
Game character models
Architectural visualization
3D printing
Real-time graphics
Virtual reality
3. Quadric Surfaces

Definition
Surfaces defined by second-degree polynomial equations in x, y, z.

General Quadric Equation

Common Quadric Surfaces


Sphere:

Center at origin, radius r.


Ellipsoid:

Cylinder (along z-axis):

Cone:

Hyperboloid:

Paraboloid:

Advantages of Quadric Surfaces:


Compact mathematical representation

Perfect smoothness
Easy intersection calculations
Analytical derivatives
Efficient ray tracing
Precise geometry

Disadvantages:
Limited to specific shapes

Cannot represent arbitrary forms


Limited modeling flexibility
Not suitable for complex objects

Difficult to combine
Less hardware support

Applications
Ray tracing primitives
Scientific visualization
Lenses and optical components
Basic geometric shapes
CSG modeling
4. Spline Representations

Why Splines?
Polynomials provide smooth curves passing through or near control points. Splines offer:
Smooth curves and surfaces
Local control
Intuitive manipulation

Compact representation

Advantages of Spline Curves (General)


Smooth and continuous
Local control (changing one point doesn't affect entire curve)
Compact representation

Easy to manipulate
Mathematical properties
Industry standard

Disadvantages of Spline Curves (General)


More complex than polygons
Computationally expensive
Require understanding of mathematics
Conversion needed for rendering
Parameterization issues

5. Hermite Curves

Definition
Hermite curves are defined by two endpoints and two tangent vectors (slopes at endpoints).

Hermite Specification
Given:
Point P₀ at parameter t = 0
Point P₁ at parameter t = 1
Tangent vector P₀' at t = 0
Tangent vector P₁' at t = 1

Parametric Form

where

Hermite Basis Functions

Advantages of Hermite Curves:


Direct control over endpoints and slopes
Exact endpoint interpolation

Tangent control for smooth transitions


Good for animation paths
Intuitive for designers

Disadvantages of Hermite Curves:


Tangent vectors not intuitive for all users

Difficult to maintain continuity across multiple curves


Not as popular as Bézier in practice

Requires tangent specification

Applications
Animation paths with velocity control
Font design
Trajectory planning

6. Bézier Curves

Definition
Bézier curves are defined by control points that influence the shape. Curves are attracted toward but don't necessarily pass through
intermediate control points.

Mathematical Form
For n+1 control points P₀, P₁, ..., Pₙ:

where are Bernstein polynomials:

Cubic Bézier (n=3)


Most commonly used, with 4 control points:

Properties of Bézier Curves


1. Endpoint Interpolation: Curve passes through P₀ and Pₙ
2. Convex Hull: Curve lies within convex hull of control points
3. Symmetry: Reversing control points reverses curve direction
4. Tangent: Tangent at P₀ is along P₀P₁, at Pₙ is along Pₙ₋₁Pₙ
5. Affine Invariance: Transforming control points transforms curve

Example:
Cubic Bézier with control points:
P₀ = (0, 0)
P₁ = (1, 2)

P₂ = (3, 2)
P₃ = (4, 0)

At t = 0.5:

Advantages of Bézier Curves:


Intuitive control with points
Smooth curves

Widely used standard


Good mathematical properties
Easy to implement

Industry standard (PostScript, SVG, fonts)

Disadvantages of Bézier Curves:


Global control (moving one point affects entire curve)
Degree increases with number of control points

High-degree polynomials can oscillate


Cannot represent exact circles or ellipses
Difficult to achieve local modifications

Applications
Font outlines (TrueType, OpenType)

Vector graphics (Adobe Illustrator, SVG)


Animation curves
CAD systems
Path definition in motion graphics

7. B-Spline Curves

Definition
B-Splines (Basis Splines) provide local control — changing one control point affects only nearby portions of the curve.

Advantages Over Bézier


Local control property
Curve degree independent of number of control points
Better for complex shapes
Continuity control

Mathematical Form

where are B-spline basis functions of degree k-1.

Knot Vector
B-splines use a knot vector that controls parameterization:

Types:
Uniform: Equally spaced knots

Non-uniform: Arbitrary knot spacing


Open: Curve passes through endpoints
Properties of B-Spline Curves
1. Local Control: Each control point affects only k curve segments
2. Convex Hull: Curve lies within convex hull

3. Continuity: C^{k-2} continuous at knots


4. Variation Diminishing: Curve doesn't oscillate more than control polygon

Advantages of B-Spline Curves:


Local control (major advantage)

Flexible degree selection


Good for complex shapes
Smooth interpolation

Industry standard (NURBS)


Continuity control
Disadvantages of B-Spline Curves:

More complex than Bézier


Knot vector management
Doesn't pass through control points (except endpoints with open knots)
Steeper learning curve
More computational overhead

Applications
CAD/CAM systems (NURBS surfaces)
Industrial design
Animation (character rigging)
Scientific visualization

Curve fitting

8. Bézier and B-Spline Surfaces

Bézier Surface Patches


Definition: Extend Bézier curves to 2D by using a grid of control points.
Bi-cubic Bézier Surface:
For 4×4 control points :

where
Properties:

Four corner points lie on surface


Surface lies within convex hull of control points

Smooth and continuous


Intuitive manipulation
Advantages:

Smooth surface representation

Good for simple curved surfaces


Intuitive control

Standard in computer graphics

Disadvantages:
Limited flexibility
Global control issues

Difficult to model complex surfaces


Continuity at patch boundaries

B-Spline Surfaces
Definition: Extend B-spline curves to 2D surfaces with local control.
Parametric Form:

NURBS (Non-Uniform Rational B-Splines):


Add weights to control points for even more flexibility:

NURBS can represent exact conic sections (circles, ellipses).


Advantages of B-Spline Surfaces:

Local control for surface editing


Can represent complex shapes

Industry standard (NURBS)


Good for manufacturing

Precise representation
Flexible modeling

Disadvantages:
Complex mathematics
Requires understanding of knot vectors
Computationally expensive

Conversion needed for rendering


Steep learning curve

Applications
Automobile body design
Aircraft fuselage

Product design
Character modeling

Architectural surfaces

9. Basic Illumination Models

Purpose
Illumination models calculate the intensity and color of light reflected from surfaces to produce realistic images.

Components of Illumination
1. Light Sources: Point, directional, spot, area lights
2. Surface Properties: Material characteristics (color, shininess)

3. Viewer Position: Observer location


4. Surface Geometry: Normals, orientation
Ambient Reflection
Definition: Uniform illumination from all directions (background lighting).

where:

: ambient reflection coefficient (0 to 1)

: ambient light intensity


Characteristics:

No directional dependence
Prevents completely black shadows
Simple but unrealistic alone

Diffuse Reflection (Lambertian)


Definition: Light scattered equally in all directions. Depends on angle between light and surface normal.

where:
: diffuse reflection coefficient
: light source intensity
: surface normal vector
: light direction vector
: angle between N and L
Characteristics:

View-independent

Matte surfaces (chalk, paper)


Intensity decreases with angle

Specular Reflection (Phong Model)


Definition: Mirror-like reflection concentrated around reflection direction. Creates highlights.

where:
: specular reflection coefficient
: reflection direction vector

: view direction vector


: shininess coefficient (1-100+)

Characteristics:
View-dependent
Shiny surfaces (metal, plastic)
Highlights on glossy surfaces

Combined Phong Illumination Model

Advantages of Phong Model:


Simple and fast
Produces reasonable results
Widely used
Easy to implement
Hardware support

Disadvantages:
Not physically accurate

Simplified model
No inter-reflection
No shadows

No transparency

10. Polygon Rendering Methods

Flat Shading
Method: Calculate lighting once per polygon using polygon normal.
Process:
1. Calculate polygon normal
2. Apply illumination model

3. Fill entire polygon with resulting color


Advantages:

Very fast
Simple computation
Low memory

Good for faceted objects

Disadvantages:
Faceted appearance
Mach banding at edges
Not suitable for smooth surfaces
Unrealistic for curved objects

Best For: Objects with genuinely flat faces, low-detail models, real-time applications

Gouraud Shading
Method: Calculate lighting at vertices, then interpolate colors across polygon.
Process:
1. Calculate vertex normals (average adjacent face normals)

2. Apply illumination model at each vertex


3. Linearly interpolate colors across scan lines

Advantages:
Smooth appearance
Reasonable speed
Hides polygon edges
Better than flat shading
Hardware support
Disadvantages:

Highlights may be missed


Mach banding possible

Not as realistic as Phong shading


Problems with specular highlights
Interpolation artifacts
Best For: Real-time graphics, games, interactive applications
Phong Shading
Method: Interpolate surface normals across polygon, calculate lighting per pixel.
Process:

1. Calculate vertex normals

2. Interpolate normals across polygon


3. Normalize interpolated normal at each pixel
4. Apply illumination model per pixel
Advantages:

Most realistic of three


Accurate highlights

Smooth surfaces
Better specular reflection
High quality
Disadvantages:

Computationally expensive
Slower than Gouraud
Requires normal interpolation
More complex implementation

Higher memory bandwidth

Best For: High-quality rendering, offline rendering, final production renders

Comparison of Shading Methods

Aspect amp; Flat amp; Gouraud amp; Phong


Computation amp; Per polygon amp; Per vertex + amp; Per pixel
interpolation
Quality amp; Lowest amp; Medium amp; Highest
Speed amp; Fastest amp; Fast amp; Slowest
Highlights amp; Poor amp; May miss amp; Accurate
Smoothness amp; Faceted amp; Smooth amp; Very smooth
Best Use amp; Faceted objects amp; Real-time graphics amp; Quality rendering

Table 5: Comparison of Polygon Rendering Methods

UNIT IV: 3-D TRANSFORMATIONS AND VIEWING

1. 3-D Geometric Transformations

Extension to 3D
3D transformations extend 2D concepts by adding the z-coordinate. They use 4×4 matrices with homogeneous coordinates (x, y, z,
1).

Translation in 3D
Equations:

Matrix Form:
Example:
Translate point (2, 3, 4) by :
Result: (7, 1, 7)
Advantages:
Straightforward extension of 2D
Preserves shape and size

No distortion
Simple computation

Disadvantages:
Cannot change size or orientation
Must combine with other transforms

Scaling in 3D

Equations:

Matrix Form:

Types:
Uniform: (maintains proportions)
Non-uniform: Different scaling factors

Advantages:
Size control
Uniform scaling preserves shape
Reversible

Disadvantages:
Non-uniform scaling distorts

Moves object unless about fixed point


Affects all dimensions

Rotation in 3D
Rotation about X-axis:

Rotation about Y-axis:

Rotation about Z-axis:


Note: Y-axis rotation has opposite sign pattern due to right-hand coordinate system.
Example:
Rotate point (1, 0, 0) about Z-axis by 90°:

Result: (0, 1, 0)
Advantages:
Maintains shape and size

Natural for animation


Reversible rotation

Disadvantages:
Three separate matrices needed
Order of rotations matters (non-commutative)
Gimbal lock in some situations
Trigonometric functions expensive

Reflection in 3D
Reflection about XY-plane (z = 0):

Matrix:
Reflection about XZ-plane (y = 0):

Matrix:
Reflection about YZ-plane (x = 0):

Matrix:
Advantages:
Creates mirror images
Useful for symmetry

No size change

Disadvantages:
Changes handedness

Limited applications
Cannot be undone by same operation

Shear in 3D
XY-Shear:

Advantages:
Creates slanting effects
Preserves volume
Special deformation effects

Disadvantages:
Non-intuitive
Distorts shape significantly
Limited practical use

2. Composite 3D Transformations

Matrix Concatenation
Similar to 2D, multiple 3D transformations combine through matrix multiplication:

Order matters — transformations are NOT commutative.

Common Composite Operations


Rotation about arbitrary axis:
To rotate about axis through point P and direction vector V:
1. Translate P to origin
2. Rotate to align axis with coordinate axis
3. Rotate by desired angle

4. Reverse alignment rotation


5. Translate back

Scaling about arbitrary point:


Similar to 2D: Translate, scale, translate back.
Advantages:
Complex motions from simple operations
Efficient single-matrix result
Reusable transformation chains
Hierarchical modeling

Disadvantages:
Order dependency
Numerical precision issues
Difficult to decompose
Can be confusing

3. 3-D Viewing Pipeline

Stages of 3D Viewing
1. Modeling Transformation: Object coordinates → World coordinates
2. Viewing Transformation: World coordinates → Camera/Eye coordinates
3. Projection Transformation: 3D → 2D projection
4. Clipping: Remove objects outside view volume
5. Viewport Transformation: Normalized → Device coordinates
Purpose: Transform 3D world to 2D screen systematically.

4. Viewing Coordinates

View Reference Point (VRP)


Origin of viewing coordinate system — camera position.
View Plane Normal (VPN)
Vector perpendicular to view plane — viewing direction.

View Up Vector (VUP)


Defines "up" direction for camera — prevents roll.

Viewing Coordinate System


Three orthogonal axes:
n-axis: Along VPN (viewing direction)
v-axis: Up direction (from VUP)

u-axis: Right direction (cross product)

Construction:

5. View Volume

Definition
The region of 3D space that appears in the final image — everything outside is clipped.

Types of View Volumes

Parallel Projection:

View volume is a parallelepiped (box)


Parallel lines remain parallel

Perspective Projection:
View volume is a frustum (truncated pyramid)

Parallel lines converge to vanishing points

View Volume Specification


For Parallel Orthographic:
Left, right, bottom, top, near, far planes
Rectangular box
For Perspective:

Field of view angle

Aspect ratio
Near and far clipping planes

Frustum shape

6. Projection Transforms

Parallel Projection
Definition: Projectors are parallel to each other and perpendicular to projection plane.
Types:
Orthographic Projection:

Projectors perpendicular to view plane


True dimensions preserved
No foreshortening

Oblique Projection:
Projectors at angle to view plane
Front face true shape

Depth visible
Advantages of Parallel Projection:

Preserves parallel lines


Measurements accurate

Simple computation
Good for technical drawings

Disadvantages:
Not realistic
No depth perception
No size diminishing with distance

Looks flat

Perspective Projection
Definition: Projectors converge to center of projection (eye point). Objects farther away appear smaller.
Types:
One-Point Perspective:
One vanishing point
One set of parallel lines converges

Two-Point Perspective:
Two vanishing points
Two sets of parallel lines converge
Three-Point Perspective:

Three vanishing points


All three axes converge
Perspective Projection Equations:
For eye at distance d along z-axis:

Advantages of Perspective Projection:


Realistic appearance

Depth perception
Matches human vision

Size diminishes with distance


Natural looking

Disadvantages:
Distorts dimensions

Parallel lines not preserved


Complex computation

Objects can appear distorted


7. 3-D Clipping

Purpose
Remove portions of objects outside the view volume to improve rendering efficiency and correctness.

3D Clipping Methods
Cohen-Sutherland Extension:
Extend region codes to 6-bit (6 planes)
Similar logic to 2D version
Sutherland-Hodgeman Extension:

Clip against 6 planes sequentially


Works for polygons in 3D
Liang-Barsky Algorithm:

Parametric line clipping


Efficient for 3D lines

View Volume Clipping Planes


1. Left plane
2. Right plane
3. Bottom plane
4. Top plane
5. Near plane (front clipping)
6. Far plane (back clipping)

Near Plane: Prevents objects too close from appearing distorted or infinitely large.
Far Plane: Limits rendering distance for efficiency.
Advantages of 3D Clipping:

Improves performance
Prevents rendering errors
Reduces overdraw
Essential for correct display

Disadvantages:
Computational overhead
Complex algorithms
May clip desired objects if not careful

Requires careful plane specification

Conclusion
This comprehensive guide covers all four units of Computer Graphics with detailed explanations, algorithms, mathematical
formulations, advantages, disadvantages, and practical examples. The material encompasses:
Unit I: Graphics fundamentals including system architecture, display technologies (raster-scan vs random-scan), input devices, and
output primitives (line drawing algorithms, circle/ellipse algorithms, and polygon filling techniques).
Unit II: 2D transformations (translation, rotation, scaling, reflection, shear), homogeneous coordinates, composite transformations,
2D viewing pipeline, window-to-viewport mapping, and clipping algorithms (Cohen-Sutherland, Cyrus-Beck, Sutherland-Hodgeman).
Unit III: 3D object representation methods including polygon surfaces, quadric surfaces, spline representations (Hermite, Bézier, B-
Spline curves and surfaces), basic illumination models, and polygon rendering methods (flat, Gouraud, Phong shading).
Unit IV: 3D geometric transformations, composite transformations, 3D viewing pipeline, viewing coordinates, view volume concepts,
projection transformations (parallel and perspective), and 3D clipping.
This material supports both theoretical understanding and practical implementation of computer graphics concepts, preparing
students for comprehensive examinations, programming assignments, and real-world graphics application development.
[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20]

1. [Link]

2. [Link]

3. [Link]

4. [Link]

5. [Link]

6. [Link]

7. [Link] Viewing [Link]

8. [Link]

9. [Link]

10. [Link]

11. [Link]

12. [Link]

13. [Link]

14. [Link]

15. [Link]
16. [Link]

17. [Link]

18. [Link]

19. [Link]

20. [Link]

You might also like