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

CGLecture 02 Interactive Graphics-1

The document provides an overview of computer graphics, detailing its definition, history, and evolution from early systems to modern interactive graphics. It discusses the hardware advancements, software improvements, and various types of graphics, including sample-based and geometry-based graphics. Additionally, it highlights the importance of interactive graphics systems and the role of user input in shaping visual content.

Uploaded by

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

CGLecture 02 Interactive Graphics-1

The document provides an overview of computer graphics, detailing its definition, history, and evolution from early systems to modern interactive graphics. It discusses the hardware advancements, software improvements, and various types of graphics, including sample-based and geometry-based graphics. Additionally, it highlights the importance of interactive graphics systems and the role of user input in shaping visual content.

Uploaded by

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

Introduction

Still from Nintendo’s Breath of the Wild, 2017


CS123: Introduction to Computer Graphics

1/39
What is Computer Graphics? (1/2)
 Computer graphics generally means creation, storage and manipulation
of models and images
 Such models come from diverse and expanding set of fields including
physical, biological, mathematical, artistic, and conceptual/abstract
structures
Frame from animation by William Latham, shown at
SIGGRAPH 1992. Latham creates his artwork using
rules that govern patterns of natural forms.

Our newest faculty member, Daniel Ritchie’s Ph.d.


thesis:
Probabilistic Programming for Procedural Modeling a
nd Design

2/39
What is Computer Graphics? (2/2)
 William Fetter coined term “computer graphics” in
1960 to describe new design methods he was pursuing
at Boeing for cockpit ergonomics
 Created a series of widely reproduced images on “pen
plotter” exploring cockpit design, using 3D model of
human body.
“Perhaps the best way to define computer graphics is to find out what it is not. It is not a machine. It is
not a computer, nor a group of computer programs. It is not the know-how of a graphic designer, a
programmer, a writer, a motion picture specialist, or a reproduction specialist.
Computer graphics is all these – a consciously managed and documented technology directed toward
communicating information accurately and descriptively.”
Computer Graphics, by William A. Fetter, 1966

3/39
What is Interactive* Computer Graphics? (1/2)
 User controls content, structure, and appearance of objects and their displayed
images via rapid visual feedback
 Basic components of an interactive graphics system
 input (e.g., mouse, stylus, multi-touch, in-air fingers…)
 processing (and storage of the underlying representation/model)
 display/output (e.g., screen, paper-based printer,
video recorder…)
 First truly interactive graphics system, Note CRT monitor, light
Sketchpad, pioneered by Ivan Sutherland 1963 Ph.D. thesis pen, and function-key
panels – the “organ
Sketchpad, A Man-Machine Graphical Communication System
console” showing bi-
manual operation
 Used TX-2 transistorized “mainframe”
at MIT Lincoln Lab * Sometimes called real-time computer graphics, and in certain
4/39
contexts, real-time rendering
What is Interactive Computer Graphics? (2/2)
 Almost all key elements of interactive graphics system are expressed in first
paragraph of Sutherland’s 1963 Ph.D. thesis

The Sketchpad system uses drawing as a novel communication


medium for a computer. The system contains input, output, and
computation programs which enable it to interpret information
drawn directly on a computer display. Sketchpad has shown the
most usefulness as an aid to the understanding of processes, such
as the motion of linkages, which can be described with pictures.
Sketchpad also makes it easy to draw highly repetitive or highly
accurate drawings and to change drawings previously drawn
with it…

5/39
What is Batch Computer Graphics?
 Today, we still use non-interactive batch mode (aka offline rendering) for final
production-quality video and film (special effects – FX). Rendering a single frame of
The Good Dinosaur (2015, a 24 fps movie) averaged 48 hours on a 30,000-core render
farm!

Still from The Good Dinosaur Pixar’s Render Farm

Statistics from
https://www.fxguide.com/featured/making-the-world-of-pixars-the-good 6/39
Enabling Modern Computer Graphics (1/5)
 Hardware revolution
 Moore’s Law: every 12-18 months, computer power
improves by factor of 2 in price / performance as size shrinks
 Newest CPUs are 64-bit with 4, 8, 16, even up to 22 cores
 Intel Kaby Lake – consumer processor with 4 cores, 8
threads, and a fully featured graphics chip built in to the
processor
 Significant advances in commodity graphics chips every 6
months vs. several years for general purpose CPUs
 NVIDIA GeForce GTX Titan Xp… 3840 cores, 12GB memory,
and 12 teraflops of processing power in a single chip
NVIDIA statistics from
https://www.nvidia.com/en-us/geforce/products/10series/titan-xp/ 7/39
Enabling Modern Computer Graphics (2/5)
 Graphic subsystems
 Offloads graphics processing from CPU to chip designed for doing graphics operations quickly
 NVIDIA GeForce™, AMD Radeon™, and Intel HD and Iris Pro Graphics
 GPUs originally designed to handle special-purpose graphics computations
 Increasingly, GPUs used to parallelize other types of computation (known as GPGPU, or General-
Purpose Computing on the Graphics Processing Unit)
 Hardware show and tell: NVIDIA GeForce GTX 1080 Ti (2017)
 3584 cores, 1.58 GHz clock, 11GB memory, 139 billion pixels/second fill rate
 Department machines (row 6): NVIDIA GeForce GTX 970 (2014)
 1664 cores, 1.05 GHz clock, 4GB memory, 75 billion pixels/second fill rate
 Department machines: NVIDIA GeForce GTX 460 (2010)
 336 cores, 1.35 GHz clock, 1GB memory, 37.8 billion pixels/second fill rate

8/39
Enabling Modern Computer Graphics (3/5)
 Input Devices
 Mouse, tablet & stylus, multi-touch, force feedback, and other game
controllers (e.g., Wii U), scanner, digital camera (images, computer vision), etc.
 Body as interaction device
 http://youtu.be/zXghYjh6Gro

Xbox Kinect Leap Motion Nimble UX

9/39
Enabling Modern Computer Graphics (4/5)
 Many form factors
 Smartphones/laptops/desktops/tablets
 Smart watches Android Phones
Apple iPhone Tablets
 Head-mounted displays (HMDs)
 HTC Vive
 Augmented Reality
 Virtual Reality
 AR vs VR: Different experiences! Microsoft’s first
Surface Apple Watch Android Wear

Brown’s old Cave Microsoft Hololens Vive Oculus Rift Google Cardboard

10/39
Digression: Augmented Reality
 Easily accessible AR through smartphones

 Advanced AR through Microsoft Hololens


 https://youtu.be/tYPlodStLTc

11/39
Digression: Cave Redesign
 Old Cave:
 4 1024 x 786 projectors on 8’ x 8’ walls (8-10 pixels per inch)
 Too low resolution and brightness for many applications, and got worse
(brightness, contrast deteriorated over time)
 New Cave:
 69 projectors onto cylindrically
curved screen 8’ radius, floor, ceiling
 140 million pixels
 Powered by a ~69 gpu cluster
 No right angles, up to 40 pixels per Brown’s new Cave, the YURT
inch (can’t see individual pixels at
normal viewing distance) 12/39
Enabling Modern Computer Graphics (5/5)
 Software Improvements
 Algorithms and data structures
 Modeling of materials
 Rendering of natural phenomena
 “Acceleration data structures” for ray tracing and other renderers
 Parallelization
 Most operations are embarrassingly parallel: calculating value of one
pixel is often independent of other pixels
 Distributed and Cloud computing
 Send operations to the cloud, get back results, don’t care how
 Rendering even available as internet service!

13/39
Environmental Evolution (1/5)
 Character Displays (1960s – now)
 Display: text plus alphamosaic pseudo-graphics (ASCII art)
 Object and command specification: command-line typing
 Control over appearance: coding for text formatting
(.p = paragraph, .i 5 = indent 5)
 Application control: single task

14/39
Environmental Evolution (2/5)
 Vector (Calligraphic, Line Drawing)
 Displays (1963 – 1980s)
 Display: line drawings and stroke text; 2D and 3D transformation hardware
 Object and command specification: command-line typing, function keys, menus
 Control over appearance: pseudo-WYSIWYG
 Application control: single or multitasked, distributed computing pioneered at
Brown via mainframe host <-> minicomputer satellite
 Term “vector” graphics survives as “scalable vector graphics” SVG library from
Adobe and W3C – shapes as transformable objects rather than just bitmaps

15/39
Environmental Evolution (3/5)
 2D bitmap raster displays for PCs and workstations
(1972 at Xerox PARC - now)
 Display: windows, icons, legible text, “flat earth” graphics
Above, a classic WIMP
 Note: late 60’s saw first use of raster graphics, especially for flight interface. The technology,
simulators at its core, remains largely
the same today. Below, a
 Minimal typing via WIMP GUI (Windows, Icons, Menus,
modern WIMP interface.
Pointer): point-and-click selection of menu items and objects,
direct manipulation (e.g., drag and drop), “messy desktop”
metaphor
 Control over appearance: WYSIWYG (which is really WYSIAYG,
What You See Is All You Get – not pixel-accurate or controllable)
 Application control: multi-tasking, networked client-server
computation and window management (even “X terminals”)

16/39
Environmental Evolution (4/5)
 3D graphics workstations (1984 at SGI – now)
 could cost up to $1M for high-end!
 Display: real-time, pseudo-realistic images of 3D
scenes
 Object and command specification: 2D, 3D and N-D
input devices (controlling 3+ degrees of freedom) and
force feedback haptic devices for point-and-click, Graphics workstations such as
widgets, and direct manipulation these have been replaced with
commodity hardware (CPU + GPU),
 Control over appearance: WYSIWYG (still WYSIAYG) e.g., our MaxBuilts + NVIDIA cards
 Application control: multi-tasking, networked
(client/server) computation and window
management

17/39
Environmental Evolution (5/5)
 High-end PCs with hot graphics cards (NVIDIA GeForce™, AMD Radeon™)
have supplanted graphics workstations
 Such PCs are clustered together over
high speed buses or LANs to provide
“scalable graphics” to drive tiled
PowerWalls, CAVEs, etc.
 Also build GPU-clusters as number crunchers, e.g.,
protein folding, weather prediction
 Now accessible to consumers via
technologies like NVIDIA’s
SLI (Scalable Link Interface) bridge
SLI Image from
18/39
http://www.overclock.net/t/1606562/official-nvidia-titan-x-pascal-o
Graphics Display Hardware
Vector (calligraphic, stroke, Raster (TV, bitmap, pixmap) used
random-scan) in displays and laser printers
 Driven by display commands  Driven by array of pixels (no semantics,
 (move (x, y), char(“A”) , line(x, y)…) lowest form of representation)
 Survives as “scalable vector graphics”
 Note “jaggies” (aliasing errors) due to
discrete sampling of continuous primitives

Ideal Vector
Drawing Drawing Outline Filled

19/39
Conceptual Framework for Interactive Graphics
 Graphics library/package is intermediary between application and display hardware
(Graphics System)
 Application program maps application objects to views (images) of those objects by
calling on graphics library. Application model may contain lots of non-graphical data
(e.g., non-geometric object properties)
 User interaction results in modification of image and/or model
 This hardware and software framework is 5 decades old but is still useful
Software Hardware

Graphics
System/
Application Graphics GPU
Application
Library
Model / database program

20/39
Graphics Library
 Examples: OpenGL™, DirectX™, Windows Presentation Foundation™
(WPF) accessed via XAML, RenderMan™, HTML5 + WebGL™
 Primitives (characters, lines, polygons, meshes,…)
 Attributes
 Color, line style, material properties for 3D
 Lights
 Transformations
 Immediate mode vs. retained mode
 immediate mode: no stored representation, package holds only
attribute state, and application must completely draw each frame
 retained mode: library compiles and displays from scenegraph
that it maintains, a complex DAG. It is a display-centered extract
of the Application Model
21/39
Application Distinctions: Two Basic Paradigms

Sample-based graphics vs Geometry-based graphics

22/39
Sample-based Graphics (1/3)
 Sample-based graphics: Discrete samples
are used to describe visual information
 pixels can be created by digitizing images,
using a sample-based “painting” program,
etc.
 often some aspect of the physical world is
sampled for visualization, e.g.,
temperature across the US
 example programs: Adobe Photoshop™,
GIMP™ , Adobe AfterEffects™ (which came
out of CS123/CS224!)
23/39
Sample-based Graphics (2/3)
 Pixels are point locations with associated sample values, usually of light
intensities/colors, transparency, and other control information
 When we sample an image, we sample the point location along the
continuous signal and we cannot treat the pixels as little circles or squares,
though they may be displayed as such
CRT* beam illumination pattern
light
intensity

1 pixel
Visualization of a Can’t visually
mathematical pixel LCD display resolve adjacent
grid pixels on CRT
* Cathode Ray Tube, like those really old TVs 24/39
Sample-based Graphics (3/3)
 Samples created directly in Paint-type program, or by sampling of continuous (analog) visual
materials (light intensity/color measured at regular intervals) with many devices including:
 flatbed and drum scanners
(e.g., https://luminous-landscape.com/drum-scans/ )
 digital still and motion (video) cameras
 Sample values can also be input numerically (e.g., with numbers from computed dataset)
 Once an image is defined as pixel-array, it can be manipulated
 Image editing: changes made by user, such as cutting and pasting sections, brush-type tools, and
processing selected areas
 Image processing: algorithmic operations that are performed on image (or pre-selected portion of
image) without user intervention. Blurring, sharpening, edge-detection, color balancing, rotating,
warping. These are front-end processes to Computer Vision, Computational Photography

25/39
Sampling an Image
 Lets do some sampling of CIT building

3D scene
 A color value is measured at every grid point and used to color corresponding
grid square 0 = white, 5 = gray, 10 =
black

 Crude sampling and image reconstruction method creates blocky image


26/39
What’s the Advantage?
 Once image is defined in terms of colors at (x,
y) locations on grid, can change image easily
by altering location or color values
 E.g., if we reverse our mapping above and
make 10 = white and 0 = black, the image
would look like this:
 Pixel information from one image can be
copied and pasted into another, replacing or
combining with previously stored pixels

27/39
What’s the Disadvantage?
 WYSIAYG (What You See Is All You Get): No additional
information
 no depth information
 can’t examine scene from different point of view
 at most can play with the individual pixels or groups of
pixels to change colors, enhance contrast, find edges, etc.
 But increasingly great success in image-based rendering
to fake 3D scenes and arbitrary camera positions. New
images constructed by interpolation, composition,
warping and other operations.
 For a computational and cognitive science perspective,
Take James Tompkin’s Computer Vision (CSCI1430)
“Scene Reconstruction from High Spatio-Angular
Resolution Light Fields” by Kim, Zimmer et al., 2013

28/39
Geometry-Based Graphics (1/2)
 Geometry-based graphics (also called scalable
vector graphics or object-oriented graphics):
geometrical model is created, along with various
appearance attributes, and is then sampled for
visualization (rendering, a.k.a image synthesis)
 often some aspect of physical world is visually
simulated, or “synthesized”
 examples of 2D apps: Adobe Illustrator™ and Corel
CorelDRAW™
 examples of 3D apps: Autodesk’s AutoCAD™,
Autodesk’s (formerly Alias|Wavefront’s) Maya™,
Autodesk’s 3D Studio Max™
29/39
Geometry-Based Graphics (2/2)
 Geometry-based graphics applications
 Store mathematical descriptions, or “models,” of geometric elements (lines,
polygons, polyhedrons, polygonal meshes…) and associated attributes (e.g., color,
material properties).
 Geometric elements are primitive shapes, primitives for short.
 Images are created via sampling of geometry for viewing, but not stored as part of
model.
 Users cannot usually work directly with individual pixels in geometry-based
programs; as user manipulates geometric elements, program resamples and
redisplays elements
 Increasingly rendering combines geometry- and sample-based graphics, both as
performance hack and to increase quality of final product
 CG animated characters (geometry) on painted or filmed scene images (samples)

30/39
What is Geometric Modeling?
 What is a model?
 Captures salient features (data, behavior) of object/phenomenon being modeled
 data includes geometry, appearance, attributes…
 note similarity to OOP ideas
 Modeling allows us to cope with complexity
 Our focus: modeling and viewing simple everyday objects
 Consider this:
 Through 3D computer graphics, we have abstract, easily changeable 3D forms, for the first
time in human history
 Has revolutionized working process of many fields – science, engineering, industrial design,
architecture, commerce, entertainment, etc. Profound implications for visual thinking and visual
literacy
 “Visual truth” is gone in the Photoshop and FX-saturated world (but consider painting and
photography…) – seeing no longer is believing…(or shouldn’t be!)
31/39
Modeling vs. Rendering
 Modeling
 Rendering
 Create models Take “picture” with camera
 Apply materials to models
 Place models around scene
 Both can be done with commercial software:
 Place lights in scene Autodesk MayaTM ,3D Studio MaxTM, BlenderTM, etc.
 Place the camera

Point Light
Spot
Light
Directional Light
Ambient
Light

CS128 lighting assignment by Patrick Doran, Spring 2009

32/39
Decomposition of a Geometric Model
 Divide and Conquer
 Hierarchy of geometrical components
 Reduction to primitives (e.g., spheres, cubes, etc.)
 Simple vs. not-so-simple elements (nail vs. screw)

Head
Shaft
Point
composition decomposition

33/39
Hierarchical (Tree) Diagram of Nail
 Object to be modeled is (visually) analyzed, and then decomposed into collections of
primitive shapes.
 Tree diagram provides visual method of expressing “composed of” relationships of model

Nail root node


Head Body
(cylinder)
Shaft Point leaf nodes
(cylinder) (cone)
tree diagram

 Such diagrams are part of 3D program interfaces (e.g., 3D Studio MAX, Maya)
 As a data structure to be rendered, it is called a scenegraph

34/39
Composition of a Geometric Model
Translate
Scale and Translate

Rotate and Translate

Primitives Composition
in their own modeling in world (root)
coordinate system coordinate system
 Primitives created in decomposition process must be assembled to
create final object. Done with affine transformations, T, R, S (as in
above example). Order matters – these are not commutative!
35/39
Upcoming Topics
 We manipulated primitive shapes with geometric
transformations (translation, rotation, scale). These
transformations are essential for model organization, process
of composing complex objects from simpler components.
 Hierarchical models and geometric transformations are also
essential for animation – create and edit scenegraphs
 Once object’s geometry is established, must be viewed on
screen: map from 3D geometry to 2D projections for viewing,
and from 2D to 3D for 2D input devices (e.g., the mouse or
pen/stylus, or touch)
 While mapping from 3D to 2D, object (surface) material
properties and lighting effects are used in rendering one’s
constructions. This
rendering process is also called image synthesis

36/39
In Summary
 Computer graphics involves both real-time / interactive applications and batch / offline
applications
 Both equally important, but different use cases
 Photo-realism has really advanced
 But it still takes dozens of hours on fastest computers to mimic physics of photons interacting with
physical environments
 Hardware evolution from vector to raster graphics
 Vector graphics survives as Scalable Vector Graphics, which transforms without artifacts
 Geometry-based vs. image-based graphics
 Mathematical definition vs. pixel manipulation
 Pixels are discrete samples of continuous functions
 Causes artifacts (“jaggies”/ “aliases”) to appear (we will study fixes – “anti-aliasing”)
 Geometric models typically constructed hierarchically
 Scene graph data structure
37/39
What is Graphics Processing Unit (GPU)?
 It is a processor optimized for 2D/3D graphics, video, visual computing,
and display.
 It is highly parallel, highly multithreaded multiprocessor optimized for
visual computing.
 It provide real-time visual interaction with computed objects via
graphics images, and video.
 It serves as both a programmable graphics processor and a scalable
parallel computing platform.
 Heterogeneous Systems: combine a GPU with a CPU

04/25/2025 Richard Ntwari 38


GPU Evolution
• 1980’s – No GPU. PC used VGA controller
• 1990’s – Add more function into VGA controller
• 1997 – 3D acceleration functions:
Hardware for triangle setup and rasterization
Texture mapping
Shading
• 2000 – A single chip graphics processor ( beginning of GPU
term)
• 2005 – Massively parallel programmable processors
• 2007 – CUDA (Compute Unified Device Architecture)

04/25/2025 Richard Ntwari 39


GPU Evolution
• OpenGL – an open standard for 3D programming
• DirectX – a series of Microsoft multimedia programming interfaces
• New GPU are being developed every 12 to 18 months
• New idea of visual computing:
combines graphics processing and parallel computing
• Heterogeneous System – CPU + GPU
• GPU evolves into scalable parallel processor
• GPU Computing: GPGPU and CUDA
• GPU unifies graphics and computing
• GPU visual computing application: OpenGL, and DirectX

04/25/2025 Richard Ntwari 40


GPU System Architectures
• CPU-GPU system architecture
– The Historical PC
– contemporary PC with Intel and AMD CPUs
• Graphics Logical Pipeline
• Basic Unified GPU Architecture
– Processor Array

04/25/2025 Richard Ntwari 41


Historical PC
FIGURE A.2.1
Historical PC. VGA
controller drives
graphics display from
framebuffer memory.
Copyright © 2009
Elsevier, Inc. All rights
reserved

04/25/2025 Richard Ntwari 42


Intel and AMD CPU

FIGURE A.2.2
Contemporary PCs with
Intel and AMD CPUs. See
Chapter 6 for an
explanation of the
components and
interconnects in this
figure. Copyright © 2009
Elsevier

04/25/2025 Richard Ntwari 43


Graphics Logical Pipeline

FIGURE A.2.3 Graphics logical pipeline. Programmable graphics shader


stages are blue, and fixed-function blocks are white. Copyright © 2009
Elsevier, Inc. All rights reserved.

04/25/2025 Richard Ntwari 44


Basic Unified GPU Architecture
FIGURE A.2.4 Logical
pipeline mapped to
physical processors.
The programmable
shader stages execute
on the array of unified
processors, and the
logical graphics
pipeline dataflow
recirculates through
the processors.
Copyright © 2009
Elsevier, Inc. All rights
reserved.

04/25/2025 Richard Ntwari 45


Processor Array

FIGURE A.2.5 Basic unified GPU


architecture. Example GPU with
112 streaming processor (SP)
cores organized in 14 streaming
multiprocessors (SMs); the cores
are highly multithreaded. It has
the basic Tesla architecture of an
NVIDIA GeForce 8800. The
processors connect with four 64-
bit-wide DRAM partitions via an
interconnection network. Each
SM has eight SP cores, two special
function units (SFUs), instruction
and constant caches, a
multithreaded instruction unit,
and a shared memory. Copyright
© 2009 Elsevier, Inc. All rights
reserved.

04/25/2025 Richard Ntwari 46


Two Dimension (2D) Graphics
 To create a two-dimensional image, each point in the image is assigned a
color.
 A point in 2D can be identified by a pair of numerical coordinates. Colors
can also be specified numerically.
 However, the assignment of numbers to points or colors is somewhat
arbitrary. So we need to spend some time studying coordinate systems,
which associate numbers to points, and color models, which associate
numbers to colors.
 A digital image is made up of rows and columns of pixels. A pixel in such an
image can be specified by saying which column and which row contains it. For
example, the pixel with coordinates (3,5) would lie in column number 3 and
row number 5.
04/25/2025 Richard Ntwari 47
Two Dimension (2D) Graphics

04/25/2025 Richard Ntwari 48


Two Dimension (2D) Graphics
 Pixels
All of computer graphics is based upon the properties of the screen or display device.
Displays are divided into lots of small squares called pixels (“PICture ELements”).
The simplest way to think of how this works is to stick to black and white. Each pixel
can be set to black or white (i.e. turned on or off). This allows patterns of dots to be
created on the screen.
 Memory Mapping
Drawing on the screen is therefore simply a matter of setting the right pixels either
on or off. Each pixel on the screen corresponds to an address in the computers
memory - this is known as memory mapping.
The display is said to be a “memory mapped display.” Effectively, each pixel is
numbered - sequentially.

04/25/2025 Richard Ntwari 49


Two Dimension (2D) Graphics

04/25/2025 Richard Ntwari 50


Two Dimension (2D) Graphics
 Resolution:
The screen in this example is composed of 300 pixels arranged in 15 rows of 20. It
is said to have a resolution of “20 by 15” (20 x 15). This is actually very small by
today’s standards. Typically a display will have a resolution of 1024x768 maybe
even more.
 The resolution of a display device can be measured in terms of the number of pixels per
inch on the display, a quantity referred to as PPI (pixels per inch) or sometimes DPI (dots
per inch).
 Screen size
Resolution is NOT the same thing as screen size. Our 20x15 display could have
been 5cm across (as a mobile phone display), 40cm across (as a monitor) or 20m
(as a projection system) but the resolution would always be 20x15.
 Screen size is measured in diagonal inches i.e 22inch screen
04/25/2025 Richard Ntwari 51
Two Dimension (2D) Graphics

04/25/2025 Richard Ntwari 52


Two Dimension (2D) Graphics
 Coordinates
Whilst the computer
“thinks” of its display as a
simple list of addresses, it
is much more convenient
(for reasons which will
become clear later) for us
to think in terms of
coordinates and leave it to
the computer to convert
the coordinates to memory
location itself.

04/25/2025 Richard Ntwari 53


Two Dimension (2D) Graphics
 Coordinates
Each pixel can be referred to by a pair of numbers known as its coordinates -
an x coordinate (which gives the column’s number and a y coordinate which
gives the row number. The coordinates are always written as a pair of
numbers, separated by a comma and enclosed in brackets. This system of
geometry is known as “Cartesian geometry” and the coordinates are spoken of
as being “Cartesian Coordinates.”

04/25/2025 Richard Ntwari 54


Two Dimension (2D) Graphics
 Coordinates
The computer converts coordinates to memory addresses by subtracting the y coordinate from the
number of rows on the display minus 1 (i.e. Ysize -1, this effectively turns the y axis upside-down to
make sure that the origin is at the bottom), multiplying that by the number of columns on the display.

 The origin
In this example, the origin or (0,0) is in the bottom-left of the screen. It is also possible to have the
origin in the top-left, in which case the rows (y coordinates) are numbered downwards.

04/25/2025 Richard Ntwari 55


Two Dimension (2D) Graphics
 Real-number Coordinate Systems

04/25/2025 Richard Ntwari 56


Two Dimension (2D) Graphics
 Aspect Ratio
The aspect ratio of a rectangle is the ratio of its width to its height. For example
an aspect ratio of 2:1 means that a rectangle is twice as wide as it is tall, and an
aspect ratio of 4:3 means that the width is 4/3 times the height.

04/25/2025 Richard Ntwari 57


Two Dimension (2D) Graphics
 Colour
In discussion so far, we have been restricted to black and white (monochrome)
i.e. each pixel can only be on or off. Colour can be represented in most of
today’s computers.
 The colours on a computer screen are produced as combinations of red,
green, and blue light.
 Different colours are produced by varying the intensity of each type of light.
 A colour can be specified by three numbers giving the intensity of red,
green, and blue in the colour . Intensity
 can be specified as a number in the range zero, for minimum intensity, to
one, for maximum intensity.

04/25/2025 Richard Ntwari 58


Two Dimension (2D) Graphics
 Colour
 This method of specifying colour is called the RGB colour model , where
RGB stands for Red/Green/Blue. For example, in the RGB colour model, the
number triple (1, 0.5, 0.5) represents the colour obtained by setting red to
full intensity, while green and blue are set to half intensity.
 The red, green, and blue values for a colour are called the colour
components of that colour in the RGB colour model.
 Typically, instead of each pixel being represented by one bit (on or off) each
pixel will be represented by 24 bits - 3 x 8 bit bytes. Each byte represents a
number between 0 and 255 and each byte is associated with one primary
colour - red, blue, green.

04/25/2025 Richard Ntwari 59


Two Dimension (2D) Graphics

04/25/2025 Richard Ntwari 60


Two Dimension (2D) Graphics

04/25/2025 Richard Ntwari 61


Two Dimension (2D) Graphics
 Image files
From Figure 16 - “Colour
smiley” it is hopefully only a
small step to see how Figure 17
- “smiley.bmp” works. The
pattern of bits in the computer’s
memory forms what is know as
a bitmap.
By simply writing those values
out to a data file and
prepending information about
the height and depth of the
image, a picture can be saved
onto disk and this is indeed the
approach taken by all the
common graphical formats seen
on the WWW such as.gifs,.jpegs,
etc.
04/25/2025 Richard Ntwari 62
Two Dimension (2D) Graphics
Leaving image processing
behind for now, we can
concentrate on the basic
terminology associated with
drawing on a computer screen.
In two dimensions (2D),
drawing are made up of points,
lines and shapes.
 Points
Representing a point on a 2d
drawing to a computer is
simple. In fact you’ve already
seen it, we just use coordinates.
04/25/2025 Richard Ntwari 63
Two Dimension (2D) Graphics
Lines
 A (straight) line can be
mathematically defined
by its end points. To
describe the line in figure
X we need simply to state
the coordinates of the
two ends: (3,8),(12,2)
 Another difference
between raw maths and
computer graphics, a line
has no thickness, in
computer graphics, it
does.

04/25/2025 Richard Ntwari 64


Two Dimension (2D) Graphics
Lines
 A (straight) line can be
mathematically defined by its
end points. To describe the
line in figure X we need
simply to state the
coordinates of the two ends:
(3,8),(12,2)
 Another difference between
raw maths and computer
graphics, a line has no
thickness, in computer
graphics, it does.
Shapes
 At this stage all you need to
know is that shapes are made
up of collections of lines.
04/25/2025 Richard Ntwari 65
Group Project
Group Project
Handing in:
Visit any site below and choose a one project. Follow the tutorial and produce
the final image.
1. https://www.blender.org/support/tutorials/
2. http://www.creativebloq.com/3d-tips/blender-tutorials-1232739
3. https://cgcookie.com/archive/blender-animation-fundamentals/
4. https://www.blenderguru.com/tutorials/blender-beginner-tutorial-
series/#
5. https://www.blender.org/support/tutorials/

04/25/2025 Richard Ntwari 66

You might also like