Computer Graphics-1_Introduction
Computer Graphics-1_Introduction
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.
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
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
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.
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
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.
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