0% found this document useful (0 votes)
54 views10 pages

CG 4th Sem

The document provides an overview of computer graphics, including its applications in entertainment, education, engineering, scientific visualization, and business. It details the components of interactive graphics systems, display devices, graphics systems, and software, as well as algorithms for drawing lines and circles. Additionally, it covers 2D and 3D transformations, projections, hidden surface elimination, and shading techniques.

Uploaded by

ramanpanchal64
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)
54 views10 pages

CG 4th Sem

The document provides an overview of computer graphics, including its applications in entertainment, education, engineering, scientific visualization, and business. It details the components of interactive graphics systems, display devices, graphics systems, and software, as well as algorithms for drawing lines and circles. Additionally, it covers 2D and 3D transformations, projections, hidden surface elimination, and shading techniques.

Uploaded by

ramanpanchal64
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
You are on page 1/ 10

UNIT 1

Introduction to Computer Graphics (CG)

Computer Graphics (CG) refers to the technology of creating, manipulating, and displaying
visual content on digital devices. It encompasses 2D and 3D graphics, animations, simulations,
and virtual environments. The field has evolved from simple vector displays in the 1950s to
highly realistic real-time rendering in gaming and film.

Applications of Computer Graphics

1. Entertainment & Media

o Used in movies, animation, and video games for realistic graphics.

o Example: Pixar’s 3D animated films, CGI e ects in Marvel movies.

2. Education & Training

o Virtual Reality (VR) and Augmented Reality (AR) in training simulations.

o Example: Medical students use VR to practice surgeries.

3. Engineering & CAD (Computer-Aided Design)

o Architects and engineers use CG for designing buildings, automobiles, and


machinery.

o Example: AutoCAD for designing mechanical parts.

4. Scientific Visualization

o Used in research to visualize complex data (e.g., MRI scans, climate


simulations).

o Example: NASA uses CG for space simulations.

5. Business & Data Visualization

o CG helps in creating charts, graphs, and dashboards for financial and statistical
analysis.

o Example: Stock market trend analysis with interactive 3D graphs.

Components of Interactive Graphics Systems

1. Input Devices

 Keyboard & Mouse – Standard input devices for interaction.

 Joysticks & Game Controllers – Used in gaming and simulation.

 Graphic Tablets & Stylus – Used by artists and designers.


 Touchscreens – Found in smartphones and kiosks.

2. Processing Unit

 Central Processing Unit (CPU) – Handles logic and computations.

 Graphics Processing Unit (GPU) – Specialized for rendering images and videos
e iciently.

 Framebu er – A dedicated memory area where the image is stored before being
displayed.

3. Output Devices

 Monitors – Displays images and animations (CRT, LCD, OLED).

 Projectors – Used in presentations and large-scale displays.

 Printers & Plotters – Used for physical representation of digital images (e.g.,
architectural blueprints).

4. Software

 Graphics APIs – OpenGL, DirectX, Vulkan for rendering 3D images.

 Rendering Engines – Unity, Unreal Engine for game development.

 Image Editing Software – Photoshop, GIMP for image manipulation.

Display Devices

1. Cathode Ray Tube (CRT) Displays

 Uses an electron gun that scans the screen line by line.

 Two types: Refresh CRT (redrawn continuously) and Color CRT (uses RGB phosphors).

 Disadvantages: Bulky, high power consumption.

2. Plasma Panel Displays

 Uses ionized gas (plasma) to produce light.

 O ers better brightness and contrast than CRT.

 Used in large displays but replaced by OLED and LED screens.

3. LCD (Liquid Crystal Display) Panels

 Uses liquid crystals controlled by electrical signals.

 Low power consumption, thin, and widely used in laptops, smartphones, and TVs.

 Two types: Passive matrix (older, slower) and Active matrix (TFT-LCD, faster, better
quality).
Graphics Systems

1. Raster-Scan System

 The screen is divided into a grid of pixels (bitmap representation).

 Each pixel stores color information in the frame bu er.

 Used in digital displays, TV screens, and modern GPUs.

 Example: JPEG, PNG, and BMP images are raster-based.

2. Random-Scan System (Vector Graphics)

 Uses mathematical equations to draw images.

 Ideal for line-based images (e.g., CAD applications).

 Does not su er from pixelation when zooming in.

 Example: SVG and CAD drawings use vector-based rendering.

Graphic Software

1. System Software

o Drivers – Enable communication between hardware and OS (e.g., NVIDIA, AMD


drivers).

o APIs – OpenGL, DirectX, Vulkan for rendering and interfacing with GPUs.

2. Application Software

o 2D Graphics – Adobe Photoshop, CorelDRAW for image editing.

o 3D Modeling & Animation – Blender, Autodesk Maya for creating 3D assets.

o Game Development – Unity, Unreal Engine for real-time rendering.

Input/Output Devices

Input Devices

 Mouse & Keyboard – Standard input devices.

 Joystick & Game Controllers – Used in gaming and flight simulations.

 Scanners & Digital Cameras – Used for capturing images.

Output Devices

 Monitors & Displays – Used for real-time visualization.

 Printers (Laser, Inkjet) – Used for producing high-quality printed images.

 Plotters – Used in engineering for precise vector drawings.


Graphic Tablets

 Used by digital artists and designers.

 Converts hand-drawn input into digital form.

 Pressure-sensitive for varying stroke thickness (e.g., Wacom tablets).

 Applications: Digital painting, 3D sculpting, calligraphy, and CAD.

UNIT 2

Output Primitives

Output primitives are the basic elements used to construct graphical images, including points,
lines, circles, and curves.

1. Points and Lines

 Points are the smallest graphical unit, represented by pixel coordinates (x, y).

 Lines are a set of points connected in a straight path between two endpoints.

A line between two points (x1,y1)(x_1, y_1)(x1,y1) and (x2,y2)(x_2, y_2)(x2,y2) can be represented
as:

y=mx+cy = mx + cy=mx+c

where m=y2−y1x2−x1m = \frac{y_2 - y_1}{x_2 - x_1}m=x2−x1y2−y1 is the slope.

Line Drawing Algorithms

1. Digital Di erential Analyzer (DDA) Algorithm

A simple and e icient line-drawing algorithm that uses floating-point operations.

Steps:

1. Compute the slope m=(y2−y1)/(x2−x1)m = (y_2 - y_1) / (x_2 - x_1)m=(y2−y1)/(x2−x1).

2. If ∣x2−x1∣>∣y2−y1∣|x_2 - x_1| > |y_2 - y_1|∣x2−x1∣>∣y2−y1∣, use unit increments in x;


otherwise, use unit increments in y.

3. Increment xxx and yyy at each step using:

o x=x+1x = x + 1x=x+1, y=y+my = y + my=y+m (for a gentle slope)

o y=y+1y = y + 1y=y+1, x=x+1mx = x + \frac{1}{m}x=x+m1 (for a steep slope)

4. Plot the computed points.

Advantages:
 Simple and easy to implement.

Disadvantages:

 Uses floating-point operations, which are computationally expensive.

2. Bresenham’s Line Drawing Algorithm

A more e icient algorithm that uses only integer calculations.

Steps:

1. Calculate the initial decision parameter: p=2Δy−Δxp = 2\Delta y - \Delta xp=2Δy−Δx


where Δx=x2−x1\Delta x = x_2 - x_1Δx=x2−x1, Δy=y2−y1\Delta y = y_2 - y_1Δy=y2−y1.

2. Start at (x1,y1)(x_1, y_1)(x1,y1).

3. For each step, update xxx and yyy:

o If p<0p < 0p<0, increment xxx and keep yyy unchanged. Update ppp using:
p=p+2Δyp = p + 2\Delta yp=p+2Δy

o If p≥0p \geq 0p≥0, increment both xxx and yyy. Update ppp using: p=p+2Δy−2Δxp
= p + 2\Delta y - 2\Delta xp=p+2Δy−2Δx

4. Repeat until x2x_2x2 is reached.

Advantages:

 Uses only integer arithmetic (no floating points).

 More e icient than the DDA algorithm.

Circle Drawing Algorithms

A circle is defined by its center (h,k)(h, k)(h,k) and radius rrr:

(x−h)2+(y−k)2=r2(x - h)^2 + (y - k)^2 = r^2(x−h)2+(y−k)2=r2

1. Polynomial (Midpoint) Circle Algorithm

Uses the equation of a circle to determine pixel positions.

Steps:

1. Start from the topmost point (0,r)(0, r)(0,r).

2. Compute the decision parameter: p=1−rp = 1 - rp=1−r

3. Use eight-way symmetry to plot points.

4. If p<0p < 0p<0, choose the pixel directly to the right; otherwise, move diagonally.

5. Update ppp using integer calculations:

o If p<0p < 0p<0: p=p+2x+3p = p + 2x + 3p=p+2x+3


o Else: p=p+2x−2y+5p = p + 2x - 2y + 5p=p+2x−2y+5

6. Repeat for all octants.

Advantages:

 E icient due to integer-only calculations.

2. Bresenham’s Circle Drawing Algorithm

A modified version of Bresenham’s line algorithm applied to circles.

Steps:

1. Start at (0,r)(0, r)(0,r).

2. Use the decision parameter: p=3−2rp = 3 - 2rp=3−2r

3. Use symmetry to plot points in all eight octants.

4. If p<0p < 0p<0, move to the right; otherwise, move diagonally.

5. Update ppp using:

o If p<0p < 0p<0: p=p+4x+6p = p + 4x + 6p=p+4x+6

o Else: p=p+4(x−y)+10p = p + 4(x - y) + 10p=p+4(x−y)+10

6. Repeat until x≥yx \geq yx≥y.

Advantages:

 Uses integer arithmetic.

 Faster than direct pixel computation.

Parametric Representation of Cubic Curves

Cubic curves are defined using parametric equations:

x(t)=a0+a1t+a2t2+a3t3x(t) = a_0 + a_1t + a_2t^2 + a_3t^3x(t)=a0+a1t+a2t2+a3t3


y(t)=b0+b1t+b2t2+b3t3y(t) = b_0 + b_1t + b_2t^2 + b_3t^3y(t)=b0+b1t+b2t2+b3t3

where ttt is a parameter (0 ≤ ttt ≤ 1).

Properties:

 Defined by four control points.

 Used for smooth curve generation.

Bezier Curves

A special type of cubic curve used in graphics and design.


Definition:

A Bezier curve of degree nnn is given by:

P(t)=∑i=0nBin(t)PiP(t) = \sum_{i=0}^{n} B_i^n(t) P_iP(t)=i=0∑nBin(t)Pi

where PiP_iPi are control points and Bin(t)B_i^n(t)Bin(t) are Bernstein polynomials:

Bin(t)=(ni)(1−t)n−itiB_i^n(t) = \binom{n}{i} (1-t)^{n-i} t^iBin(t)=(in)(1−t)n−iti

For cubic Bezier curves (n=3n = 3n=3):

P(t)=(1−t)3P0+3(1−t)2tP1+3(1−t)t2P2+t3P3P(t) = (1-t)^3 P_0 + 3(1-t)^2 t P_1 + 3(1-t)t^2 P_2 + t^3


P_3P(t)=(1−t)3P0+3(1−t)2tP1+3(1−t)t2P2+t3P3

Properties:

 The curve is always within the convex hull of control points.

 The first and last control points are endpoints.

 Intermediate points influence the curve shape.

Applications:

 Font design and typography (TrueType fonts).

 Computer-aided design (CAD).

 Animation paths in graphics.

UNIT 3

2D Transformation

2D transformations modify the position, size, and orientation of objects in a 2D plane. They are
often represented using homogeneous coordinates, which simplify matrix operations.

Use of Homogeneous Coordinate System

 Adds an extra dimension (from (x, y) to (x, y, 1)) to enable matrix multiplication for
transformations.

 Allows translation to be performed using matrix multiplication, like other


transformations.

Composite Transformation

Multiple transformations can be combined using matrix multiplication to achieve complex


transformations.
Clipping and Windowing

 Clipping: Removing portions of objects outside a defined region.

 Windowing: Defining a region (window) where objects are displayed.

Clipping Operations

1. Line Clipping Algorithms

o Mid-Point Subdivision Method: Recursively divides a line until it lies within the
clipping region.

o Cohen-Sutherland Algorithm: Uses region codes to determine whether a line is


inside, outside, or partially inside the clipping window.

2. Polygon Clipping

o Sutherland-Hodgman Algorithm: Clips a polygon by processing its edges


against each clipping boundary.

3. Text Clipping

o Characters outside the window are clipped.


o Can be all-or-nothing (entire character clipped) or individual (part of character
clipped).

UNIT 4

3D Graphics

3D graphics involve the representation, transformation, and visualization of objects in a three-


dimensional space.

3D Object Representations

 Wireframe Model: Only edges are drawn.

 Surface (Polygonal) Model: Represents surfaces using polygons.

 Solid Model: Defines volume using boundary representations (B-rep) or constructive


solid geometry (CSG).

3D Transformations
Projections

Converts 3D objects onto a 2D plane.

1. Parallel Projection – Lines remain parallel.

o Orthographic Projection: Directly maps 3D to 2D (used in engineering


drawings).

o Oblique Projection: Uses an angle for depth representation.

2. Perspective Projection – Objects appear smaller as they move farther.

o Uses a vanishing point for realistic depth perception.

Hidden Surface Elimination

Removes surfaces not visible to the viewer.

1. Back Face Removal – Eliminates faces facing away from the viewer.

2. Depth Bu er (Z-bu er) Algorithm – Stores depth values for each pixel to determine
visibility.

3. Scan-line Algorithm – Processes one scan line at a time, determining visible surfaces.

4. Depth Sort Algorithm (Painter’s Algorithm) – Sorts surfaces by depth and renders from
back to front.

Shading

Improves realism by simulating light e ects.

1. Flat Shading – Single color per polygon.

2. Gouraud Shading – Interpolates vertex colors across a surface.

3. Phong Shading – Interpolates surface normals for smooth lighting.

4o

You might also like