0% found this document useful (0 votes)
17 views

Computer Graphics-1_Introduction

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Computer Graphics-1_Introduction

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

1: Introduction

Thursday, 1 February 2024 15:58

Contents
1. Applications
2. History of Computer Graphics
3. Raster vs Vector
4. Rasterization and Scan Conversion
5. CRT display
6. Raster Scan
7. Random Scan (vector display)
8. Raster Scan VS Random Scan
9. 2D vs 3D
10. 3D Projections
11. 3D Transformations
12. Visible Surface Detection (Hidden Surface Removal Problem)
13. Depth Buffer (Z-Buffer) Method)

Computer graphics involves creating, manipulating, and representing visual images and animations using computers.

Applications
• Entertainment (video games, movies)
• Design (CAD)
• Simulation (flight simulation, medical imaging)
Entertainment
Graphics are integral to the creation of visually immersive experiences in video games and movies.
Real-time rendering techniques contribute to lifelike simulations and virtual environments.
Design
Computer-aided design (CAD) relies on graphics for modelling and visualization, aiding architects, engineers, and artists
in their work.
Simulation
Graphics are essential in simulation applications, such as flight simulators and medical imaging, providing realistic
representations for training and analysis.

History of Computer Graphics

Basic Definitions
Pixel
A pixel, short for "picture element", is the smallest unit of a digital image. It represents a single point in a raster image (a
grid of pixels), and each pixel carries information about the and brightness of that specific point.
Resolution
The resolution of an image refers to the number of pixels it contains, with higher resolutions providing more detail and
clarity.

Raster vs Vector
Feature Raster Graphics Vector Graphics
Representation Based on a grid of pixels. Defined by mathematical equations and points.
Scalability Limited scalability without Infinitely scalable without loss of quality.
loss of quality.
File Size Larger file sizes, especially Smaller file sizes, independent of resolution.
for high resolution images.
Editing Pixel-based, can be Object-based, easy to edit and modify shapes.
challenging to edit without

Computer Graphics Page 1


challenging to edit without
loss of quality.
Conversion Difficult. Converting raster Simple. Converting vector graphics to raster is straightforward and
Ease files to vector involves involves specifying a resolution for rendering
complex algorithms and may
not always produce perfect
results
Resolution Resolution-dependent; may Resolution-independent; no loss of quality during scaling.
Dependency lose quality when scaled up.
Common JPEG, PNG, GIF, BMP, TIFF, SVG, AI, EPS, PDF
Formats PSD
Complexity Limited handling of complex Excellent for handling complex shapes and curves.
Handling shapes and curves.
Application Photographs, detailed Logos, illustrations, fonts, technical drawings.
Examples images, textures in games.
Rendering Faster rendering for simple Rendering speed may depend on the complexity of the image.
Speed images.
Example Adobe Photoshop, GIMP Adobe Illustrator, CorelDRAW, Inkscape
Software

Rasterization and Scan Conversion


Rasterization:
Rasterization is the process of converting vector graphics or 3D models into raster images (arrays of
pixels) for display on a screen. This conversion is necessary because most display devices, such as
computer monitors and digital screens, operate based on raster images. The rasterization process
involves determining which pixels to activate or color based on the geometric shapes and information
present in the original vector or 3D representation. This conversion is performed by a graphics
processing unit (GPU) or a dedicated rasterizer in the rendering pipeline. Rasterization is a crucial
step in the graphics rendering process, enabling the display of complex images and scenes on digital
devices.
Scan Conversion:
Scan conversion, also known as scanline rendering, is a technique used in computer graphics to
convert geometric shapes or objects into pixels for display. The process involves dividing the image
into horizontal lines, or "scanlines," and determining which pixels along each scanline should be
activated or colored based on the shape being rendered. Scan conversion is particularly important in
rasterization, where it helps to efficiently determine the pixel values for various geometric primitives
like lines, polygons, or curves. The algorithm scans each scanline and decides which pixels are inside
or outside the shape, contributing to the overall rendering of the image.

Overview of Graphics Systems


CRT display
A Cathode Ray Tube (CRT) display is a technology used in older computer monitors and television screens.

Computer Graphics Page 2


A Cathode Ray Tube (CRT) display is a technology used in older computer monitors and television screens.

This is how it works:


• The cathode, located at the back of the CRT emits electrons when heated.
• An electron gun focuses these electrons into a high-velocity beam.
• Magnetic deflection coils and control grids guide the beam across the screen.
• The front of the CRT is a glass screen coated with phosphors, which emit light when struck by electrons.
• The electron beam scans horizontally and vertically, covering the entire screen.
• The beam excites phosphors, causing them to emit light.
• In color CRTs, there are typically three electron guns, each associated with a specific color - red, green, and blue.
These three beams are directed to the same pixel on the screen, and the combined light from the three phosphor
layers produces a full range of colors, forming the displayed image.
• The process repeats rapidly to maintain a continuous and flicker-free image.
• The rate at which the entire screen is redrawn is known as the refresh rate. Higher refresh rates result in smoother
motion and reduce flicker.
CRT technology has been largely replaced by newer display technologies like LCD, LED, and OLED, which offer improved
features and efficiency.

Raster Scan
Raster scan refers to the process of systematically scanning and displaying the pixels in a grid pattern, typically left-to-
right and top-to-bottom, to create an image on a display device. In a raster scan system, the electron beam in a cathode
ray tube (CRT) or the equivalent light-emitting mechanism in modern displays moves across the screen in a predefined
pattern. This beam illuminates each pixel on the screen, and the intensity of the beam determines the pixel's color and
brightness.
Key points
1. Sequential scanning
2. Consistent refresh rate

Random Scan (vector display)


Instead of scanning the entire screen systematically, random scan directly addresses the display of individual shapes or
vectors defined in the graphical data. This approach is more focused on drawing lines or shapes where needed, rather
than covering the entire screen in a predetermined order.
Key points:
1. Suitable for vector graphics
2. Command-based
3. Variable refresh rate
4. Less common today

Raster Scan VS Random Scan

Feature Raster Scan Random Scan

Computer Graphics Page 3


Feature Raster Scan Random Scan
Scanning Systematically covers the entire screen in a grid Directly addresses individual shapes or vectors,
Approach pattern, left-to-right, top-to-bottom. drawing lines and shapes as needed.
Drawing Fills in pixels sequentially to create a complete Draws lines and shapes based on vector graphics
Technique image. commands.
Display Common in traditional televisions and computer Less common in consumer displays, more
Technology monitors. associated with vector displays.
Focus Pixel-based; suitable for detailed images and Vector-based; suitable for drawing lines and
raster graphics. shapes with precision.
Refresh Rate Consistent refresh rate, refreshing the entire Variable refresh rate, updating specific areas as
screen multiple times per second. needed.
Usage Today Widely used in modern displays for general Less common in consumer displays but may be
applications. used in specialized applications.
Advantages Suitable for detailed images and complex Well-suited for vector graphics and drawing
graphics. precise shapes.
Disadvantages May be less efficient when dealing with sparse Limited in handling complex raster graphics and
or vector-based content. detailed images.
Examples of Cathode Ray Tube (CRT) monitors, most Older vector displays, oscilloscopes, some
Technologies modern displays. specialized systems.

2D vs 3D
Feature 2D 3D
Definition Two-dimensional, flat representations on a Three-dimensional, with depth added to height and width.
plane.
Coordinates Described using x and y coordinates. Described using x, y, and z coordinates.
Shapes Limited to geometric shapes like circles, Can represent complex shapes with depth, including
squares, and polygons. spheres, cubes, and irregular objects.
Depth No inherent depth perception; objects Provides realistic depth perception, creating a sense of
Perception appear flat. distance and volume.
Rendering Rendered on a flat surface without Involves realistic rendering with perspective, shading, and
perspective effects. lighting effects.
Applications Graphics, typography, drawings, and Video games, movies, simulations, CAD, virtual reality, and
schematics. augmented reality.
Examples Icons, logos, paintings, blueprints. 3D models, animated characters, immersive environments.
Editing Generally simpler, less complex editing. Editing involves managing additional dimensions, can be
Complexity more complex.
Realism Limited realism due to lack of depth. Offers a higher degree of realism, simulating the visual
experience of the real world.
Use in Art Common in traditional art and design. Extensively used in digital art, 3D modelling, and
animation.

3D Projections
3D projection is the process of representing a three-dimensional object or scene in a two-dimensional space, typically
for display on a computer screen or other flat surfaces. The goal is to create a visually accurate representation of the 3D
world, preserving depth information and spatial relationships.

Computer Graphics Page 4


world, preserving depth information and spatial relationships.

There are two primary types of 3D projections: perspective projection and parallel projection.
Perspective Projection
Perspective projection mimics the way human vision perceives objects in the real world. It takes into account the
concept of depth and the way objects appear smaller as they move farther away. In perspective projection, objects that
are closer to the viewer appear larger than those farther away, creating a sense of depth and realism.
The key components of perspective projection include:
1. Camera (or Eye): The viewpoint from which the 3D scene is observed.
2. Projection Plane: A flat surface (often the computer screen) onto which the 3D scene is projected.
3. Field of View: The angular extent of the scene visible from the camera.
4. Near and Far Clipping Planes: Define the range of distances within which objects are visible.
5. Vanishing Point: The point where parallel lines in the 3D space appear to converge when projected onto the 2D
plane.

Perspective projection is ideal for creating realistic scenes in computer graphics, video games, and simulations.
Types:
• One-Point Perspective: Converging lines toward one vanishing point.
• Two-Point Perspective: Converging lines toward two vanishing points on the horizon.
• Three-Point Perspective: Converging lines toward three vanishing points, suitable for wide-
angle views.
• Curvilinear: Representations of the Earth's surface on a two-dimensional plane using curved
lines, with types that preserve local angles, maintain relative sizes, or preserve distances from
specific points.

Orthographic Projection:
Orthographic projection preserves parallelism of lines, disregarding the effect of distance on object size. Objects are
scaled uniformly along each axis, regardless of their distance from the viewer. Key features of orthographic projection
include:
1. Parallel Projection: Lines that are parallel in the 3D space remain parallel after projection.
2. No Foreshortening: Objects do not appear smaller as they move away from the viewer.
3. Orthographic Projection Matrix: A transformation matrix is applied to each 3D point to project it onto the 2D plane.

Orthographic projection is commonly used in technical drawings, engineering, and architectural applications where
precise measurements and proportions are crucial.

Multiview Projections
This involves representing a 3D object in two or more 2D views to provide a comprehensive understanding of its
structure. Each view is taken from a different direction, typically from the front, top, and side.
Types:
• First angle projection: Object is placed in the first quadrant
• Third angle projection: Object is placed in the third quadrant

Computer Graphics Page 5


• Third angle projection: Object is placed in the third quadrant

Axonometric Projection:
Maintains parallel lines in each dimension, avoiding foreshortening effects
Types:
• Isometric Projection: Equal foreshortening in all directions, providing a balanced view.
• Dimetric Projection: Two foreshortening scales are equal, offering a balanced but less symmetrical
view.
• Trimetric Projection: Three different foreshortening scales, providing a more realistic but
asymmetric representation.

Oblique Projection
Oblique projections are a type of parallel projection that preserves the appearance of one set of parallel lines. Unlike
orthographic projections, oblique projections display the depth of an object by skewing the angles of the object's
features.
Types:
• Cavalier Projection: Maintains the true lengths along the three main axes but does not provide a realistic sense of
depth.
• Cabinet Projection: Similar to cavalier projection but with foreshortened depth lines to enhance the appearance of
depth.
• Military projections: are used in cartography and navigation for mapping and coordinate referencing.

3D Transformations
Translation
Translation involves moving an object from one position to another in 3D space. For a point (x, y, z),
the translation is achieved by adding or subtracting values from the x, y, and z coordinates.
Scaling
Scaling changes the size of an object, either enlarging or reducing it. For a point (x, y, z), scaling
involves multiplying the x, y, and z coordinates by scaling factors along each axis.
Rotation
Rotation turns an object around a specified axis. Rotation involves complex mathematical operations,
but simplified 3D rotations can be achieved through matrices or quaternion representations.
Shear
Shear distorts the shape of an object by skewing it along one or more axes. Involves modifying the
coordinates of points to introduce the desired shearing effect, typically represented by a shear matrix.
Reflection
Reflection creates a mirror image of an object by flipping it across a specified plane. For a point (x, y,
z), reflection involves negating one or more coordinates based on the reflection plane.

Visible Surface Detection (Hidden Surface Removal Problem)


Visible surface detection, also known as hidden surface removal or visibility determination, is a crucial step in computer
graphics that involves determining which parts of a three-dimensional scene are visible and should be displayed on the
screen. The goal is to identify and render only the surfaces that are not obstructed by other surfaces in the scene,
ensuring a realistic and accurate representation.
Several techniques are employed for visible surface detection:
Depth Buffer (Z-Buffer) Method)
The Z-buffer algorithm, also known as depth buffering, is a widely used technique in computer
graphics for solving the hidden surface removal problem. Its primary purpose is to determine which
surfaces or objects are visible at each pixel on the screen, considering their depths or distances from
the viewer. The algorithm uses a memory buffer, commonly known as the Z-buffer or depth buffer, to
achieve this.
Here is a step-by-step explanation of the Z-buffer algorithm:

Computer Graphics Page 6


Here is a step-by-step explanation of the Z-buffer algorithm:
1. Initialization:
• Create a Z-buffer that has the same dimensions as the screen (pixel resolution).
• Initialize all Z-buffer values to a maximum distance or a large positive value, indicating that no
surfaces have been rendered yet.
2. For Each Polygon (or Fragment) in the Scene:
• For each polygon in the 3D scene, project its vertices onto the 2D screen space.
• Determine the depth (distance from the viewer) for each pixel covered by the polygon. This is
usually done by interpolating depth values across the polygon's surface.
3. Z-buffer Test:
• For each pixel covered by the polygon, compare its calculated depth with the corresponding
value in the Z-buffer.
• If the calculated depth is closer (smaller) than the current Z-buffer value, update the Z-buffer with
the new depth value, and color the pixel with the color of the current polygon.
• If the calculated depth is farther (greater) than the Z-buffer value, do not update the Z-buffer, and
leave the pixel unchanged.
4. Repeat for Each Subsequent Polygon:
• Continue this process for all polygons in the scene, with each pixel being assigned the color of
the closest visible polygon at that point.
5. Rendering the Final Image:
• The final image displayed on the screen is the result of the accumulation of colors from the
closest visible surfaces at each pixel, as determined by the Z-buffer.

Z-buffer Pseudocode
for each polygon in scene:
for each pixel covered by the polygon:
calculate depth of the pixel within the polygon
if calculated depth < Z-buffer value at that pixel:
update Z-buffer with the new depth value
color the pixel with the color of the current polygon

Advantages of Z-buffer Algorithm:


• Easy to implement.
• Handles complex scenes with overlapping objects effectively.

Computer Graphics Page 7


• Suitable for real-time rendering, such as in video games.
Disadvantages:
• Requires additional memory for the Z-buffer, consuming more resources.
• Sorting and rendering semi-transparent or transparent objects may require additional techniques.

Computer Graphics Page 8

You might also like