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

Intro

Uploaded by

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

Intro

Uploaded by

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

✬ ✩

CPSC 3710 Computer Graphics University of Lethbridge

Course Topics

ˆ Modelling of objects and camera


ˆ 2-D and 3-D transformations
ˆ OpenGL
ˆ Shading: lighting, reflection, etc.
ˆ Clipping
ˆ Object representation: splines

✫ ✪
Introduction 1 – 19 Howard Cheng
✬ ✩
CPSC 3710 Computer Graphics University of Lethbridge

Prerequisites

You should be familiar with the following:


ˆ Programming: basic C++
ˆ Data structures: stacks, lists, trees, etc.
ˆ Math: matrix operations, functions, trigonometry

✫ ✪
Introduction 2 – 19 Howard Cheng
✬ ✩
CPSC 3710 Computer Graphics University of Lethbridge

What is Computer Graphics?

ˆ Considers all aspects of producing images or videos using a computer.


ˆ Generally starts with a (mathematical) model of the objects to display.
ˆ Algorithms to convert the model into an image.

✫ ✪
Introduction 3 – 19 Howard Cheng
✬ ✩
CPSC 3710 Computer Graphics University of Lethbridge

Applications

ˆ Visualization
ˆ Entertainment (games, movies)
ˆ Design (CAD/CAM)
ˆ GIS
ˆ Simulations
ˆ Art
ˆ Virtual Reality

✫ ✪
Introduction 4 – 19 Howard Cheng
✬ ✩
CPSC 3710 Computer Graphics University of Lethbridge

Graphics System

Major elements:
ˆ Input devices
ˆ Processing Units (CPU and GPU)
ˆ Memory
ˆ Framebuffer
ˆ Output devices

✫ ✪
Introduction 5 – 19 Howard Cheng
✬ ✩
CPSC 3710 Computer Graphics University of Lethbridge

Input Devices

Some examples:
ˆ Traditional: keyboard, mouse, joystick
ˆ Touch screen
ˆ 3D input: Leap, Kinect, VR controllers, etc.

✫ ✪
Introduction 6 – 19 Howard Cheng
✬ ✩
CPSC 3710 Computer Graphics University of Lethbridge

Output Devices

ˆ Traditionally cathode-ray tube (CRT)


ˆ Now LED, LCD, etc.
ˆ 2D grid of pixels, each one can be independently controlled (raster)
ˆ Projection systems: mostly raster devices
ˆ Stereo: produce two distinct images (e.g. different polarization or
different screens)

✫ ✪
Introduction 7 – 19 Howard Cheng
✬ ✩
CPSC 3710 Computer Graphics University of Lethbridge

Processing Units

ˆ In the past: central processing unit (CPU) performs all computations


ˆ Now special-purpose graphics processing units (GPUs) carry out specific
graphics functions
ˆ Modern GPUs are highly parallelized and programmable.
ˆ GPU has access to the framebuffer
ˆ GPUs may have access to its own memory.

✫ ✪
Introduction 8 – 19 Howard Cheng
✬ ✩
CPSC 3710 Computer Graphics University of Lethbridge

Framebuffer

ˆ Framebuffer: memory representing the 2D grid of pixels


ˆ Resolution: number of pixels in framebuffer
ˆ Depth/precision: number of bits used for each pixel
ˆ Common: 24-bit RGB, possibly an additional “alpha” value
ˆ There can be multiple framebuffers. e.g. double buffering
ˆ Rasterization or scan conversion: process of converting geometric objects
to pixel colours and locations in framebuffer.
ˆ One of the framebuffers correspond to the current display.

✫ ✪
Introduction 9 – 19 Howard Cheng
✬ ✩
CPSC 3710 Computer Graphics University of Lethbridge

Graphics Programming (OpenGL)

We will discuss some of the following aspects:


ˆ General processing, basic functions
ˆ Pipelining
ˆ Coordinate systems
ˆ Geometric primitives
ˆ Colours
ˆ Viewing
ˆ Control functions

✫ ✪
Introduction 10 – 19 Howard Cheng
✬ ✩
CPSC 3710 Computer Graphics University of Lethbridge

Geometric Objects

Some examples:
ˆ Points
ˆ Vectors
ˆ 2D objects: lines, polygons, circles, etc.
ˆ 3D objects
ˆ Bezier curves, B-spline
A coordinate system is needed to specify objects

✫ ✪
Introduction 11 – 19 Howard Cheng
✬ ✩
CPSC 3710 Computer Graphics University of Lethbridge

Transformations

ˆ Translation
ˆ Rotation
ˆ Scaling
ˆ Combination

✫ ✪
Introduction 12 – 19 Howard Cheng
✬ ✩
CPSC 3710 Computer Graphics University of Lethbridge

Viewing

ˆ Camera model (e.g. pinhole camera)


ˆ Orientation of camera
ˆ Projection
ˆ Hidden surface removal
ˆ Clipping

✫ ✪
Introduction 13 – 19 Howard Cheng
✬ ✩
CPSC 3710 Computer Graphics University of Lethbridge

Shading

ˆ Lighting models
ˆ Texture mapping

✫ ✪
Introduction 14 – 19 Howard Cheng
✬ ✩
CPSC 3710 Computer Graphics University of Lethbridge

Rough Workflow

ˆ Geometric objects are transformed (translation, rotation, scaling, etc.)


ˆ Rasterization is done to draw pixels in the framebuffer
ˆ Framebuffer is displayed on screen

✫ ✪
Introduction 15 – 19 Howard Cheng
✬ ✩
CPSC 3710 Computer Graphics University of Lethbridge

Graphics Architecture

ˆ Geometric objects are represented by vertices:


– coordinate systems are needed
– different coordinate systems: world vs. camera view vs. screen, 3D vs
2D
– properties: colour, lighting, materials
ˆ Transformations:
– represented by matrix multiplcation
– a sequence of transforms can be represented by matrix product

✫ ✪
Introduction 16 – 19 Howard Cheng
✬ ✩
CPSC 3710 Computer Graphics University of Lethbridge

Graphics Architecture

ˆ Clipping:
– apply a viewing rectangle to objects
– decide if an object is visible completely or partially
– efficient clipping algorithms are needed (for refreshing)
ˆ Projection:
– project 3D objects to 2D objects (need a projection plane)
– matrix operations
ˆ Rasterization:
– Convert projected 2D objects into pixel info in framebuffer

✫ ✪
Introduction 17 – 19 Howard Cheng
✬ ✩
CPSC 3710 Computer Graphics University of Lethbridge

Raster-based Graphic System

ˆ Resolution: screen size (e.g. 1280 × 1024)


ˆ Each pixel usually needs 3 bytes (24-bit RGB)
ˆ What is the amount of memory needed?
ˆ Double-buffering: at least 2 framebuffers:
– one holds the content being displayed (front buffer)
– one holds the content being drawn (back buffer)
The two buffers are swapped constantly (just “references”)

✫ ✪
Introduction 18 – 19 Howard Cheng
✬ ✩
CPSC 3710 Computer Graphics University of Lethbridge

Line Segment Drawing Example

ˆ How is a line segment drawn on screen?


ˆ Line segments are specfied by two endpoints
ˆ Need to decide which pixels to turn on
ˆ Jaggedness? Aliasing and anti-aliasing
ˆ Modern graphics libraries take care of this automatically

✫ ✪
Introduction 19 – 19 Howard Cheng

You might also like