CS488 Introduction to Computer Graphics Luc R ENAMBOT 1 What is - - PowerPoint PPT Presentation

cs488 introduction to computer graphics
SMART_READER_LITE
LIVE PREVIEW

CS488 Introduction to Computer Graphics Luc R ENAMBOT 1 What is - - PowerPoint PPT Presentation

CS488 Introduction to Computer Graphics Luc R ENAMBOT 1 What is Computer Graphics ? Mathematics + computer science + art = computer graphics Rendering of images on a device Rendering: Creating images from models Models: objects


slide-1
SLIDE 1

CS488 Introduction to Computer Graphics

Luc RENAMBOT

1

slide-2
SLIDE 2

What is Computer Graphics ?

  • Mathematics + computer science + art =

computer graphics

  • Rendering of images on a device
  • Rendering: Creating images from models
  • Models: objects constructed from geometric

primitives (points, lines, polygons) specified by their vertices

2

slide-3
SLIDE 3

Models

  • Models exist in n-dimensional

'mathematically pure' space

  • n typically 2 or 3
  • n can be > 3 with scientific data

3

slide-4
SLIDE 4

Rendering

  • Rendered version typically created on

physical 2D media (e.g. a video screen)

  • Rendered version can be simple or complex

(lighting, shadows, colors, texture)

  • Rendering a single image can take
  • from a small fraction of a second (game)
  • to hours or days (movie)

4

slide-5
SLIDE 5

Common Uses

  • Scientific/medical visualization
  • CAD/CAM
  • Multimedia
  • Computer interfaces (Windows, X, Aqua)
  • Virtual reality
  • Special effects
  • Artistic expression
  • Way cool video games

5

slide-6
SLIDE 6

Scientific Visualization

slide-7
SLIDE 7

Brief History: 60s

  • 1960s

Vector display devices

  • 1963 Ivan Sutherland's

Sketchpad

7

"A display connected to a digital computer gives us a chance to gain familiarity with concepts not realizable in the physical world. It is a looking glass into a mathematical wonderland."

slide-8
SLIDE 8

Brief History: 70s

  • 1970s Raster display

devices

  • 1972 Pong
  • 1976 Star Wars

8

slide-9
SLIDE 9

1976 Star Wars

  • 'Pilots Briefing'
  • CG done here at UIC
slide-10
SLIDE 10

1976 Star Wars

  • 'Pilots Briefing'
  • CG done here at UIC
slide-11
SLIDE 11

Brief History: 80s

  • 1980s Raytracing, Realism,

Multimedia

  • 1982 Tron, Star Trek II
  • 1985 Last Starfighter
  • 1989 Abyss, The

10

slide-12
SLIDE 12

Brief History: 90s

  • 1990s

Virtual reality, Interactivity, 'Cheaper' graphics horsepower

  • 1991 Terminator 2
  • 1993 Jurassic Park
  • 1995 Toy Story
  • 1996 Titanic, Twister
  • 1999 Star Wars - the Phantom

Menace

  • Lots of commercials & TV

series using CG

11

slide-13
SLIDE 13

Brief History: 2000s

  • 2000s CG all over the

place

  • 2001 Final Fantasy
  • 2001 Lord of the Rings:

2001/2002/2003

  • 2005 King Kong

12

slide-14
SLIDE 14

Software

  • Many application programs available to

produce computer graphics, either as 2D images, 3D models, or animated sequences (Corel Draw, Photoshop, AutoCAD, Maya, SoftImage, etc.)

  • We will deal with the lower level routines

which do the work of converting models into a displayable form on the display device.

13

slide-15
SLIDE 15

Various Environments

  • Graphics languages / libaries / APIs

(Application Programming Interfaces)

  • GKS
  • DirectX
  • QuickDraw and X (as in X11 server)
  • Postscript, PDF
  • OpenGL

14

slide-16
SLIDE 16

For the class

  • We will be using OpenGL in this course
  • Linux machines in the CS Computer Graphics

lab to give a common grading platform

  • OpenGL is available for all the major platforms
  • Accelerated on almost all current graphics

cards

  • Mesa (www.mesa3d.org): open source

implementation running on the processor

  • Usually in C/C++ but various bindings available

15

slide-17
SLIDE 17

Hardware

  • In this class we are going to concern
  • urselves with producing images on video

screens rather than onto printers, or plotters since that allows a much greater amount of interactivity

  • Convenient to think of models in

mathematical terms but hardware brings CG back to reality

16

slide-18
SLIDE 18

Video Display Hardware

  • Vector (calligraphic) displays
  • Raster displays

17

slide-19
SLIDE 19

Vector displays

  • Lines drawn directly, no predefined

grid

  • Commands tell the electron gun

where to move and when to turn

  • n/off
  • + Lines are smooth
  • + Close to the 'pure mathematics' of

the model

  • - Slower with more elements to be

drawn, can start to flicker

  • - Only lines possible, no filled

polygons, or bitmaps

  • - Monochrome for each electron gun

18

slide-20
SLIDE 20

Raster displays

  • Image represented by a rectangular

grid of pixels (picture elements)

  • Image stored in a frame buffer
  • Electron gun(s) continually scanning

in a regular pattern (line by line across entire screen)

  • + Constant time to redraw any

number of elements

  • + No flicker
  • - Jagged edges from conversion to

pixels

  • - Discretized version of the model

19

slide-21
SLIDE 21

Vector vs. Raster

  • You need to keep redrawing

the image on the screen to keep it from fading away

  • Vector displays redraw as

quickly as possible given the number of objects on the screen

  • CRT based raster displays

redraw the image (or refresh the screen) at a fixed rate (e.g. 60 times per second) no matter how complex the scene.

20

slide-22
SLIDE 22

Vector Games

  • Asteroids, Battlezone, ...
  • Monochrome, color filters,

RGB electron guns

  • Vectrex console in the 80s

21

slide-23
SLIDE 23

Buffers in Raster Displays

  • Pretty much all CG done

using raster displays

  • The screen is

represented by a 2D array of elements

22

slide-24
SLIDE 24

Frame Buffer

  • Array of computer memory used to store

an image to be displayed

  • The user manipulates the values in the frame

buffer: 60 times a second (or at some other fixed rate) the frame buffer is copied onto the display device.

  • If video screen is 512 pixels wide by 512

pixels tall the frame buffer must be able to store 512 X 512 elements ... one element for each pixel on the screen

23

slide-25
SLIDE 25

Monochrome display

  • 512 x 512 x 1bit (bit is

either 0=off, or 1=on.)

  • Each of the 512 x 512

pixels can be either on

  • r off (white or black)

24

slide-26
SLIDE 26

Grayscale display

  • 512 x 512 x 8bit (each

pixel is 8 bits deep so values 0-255 are possible)

  • Each of the 512 x 512

pixels can be one of 256 shades of grey (from black to white)

25

slide-27
SLIDE 27

Color display: 24-bit

  • 512 x 512 x 24bit (each pixel has 8 bits for red, 8 bits

for green, and 8 bits for blue)

  • Each pixel can be black->bright red (0-255) combined

with black->bright green (0-255) combined with black- >bright blue (0-255)

  • Each of the 512 x 512 pixels can be one of 16 million

colors

26

slide-28
SLIDE 28

Color display: 8-bit with colormap

  • Want benefits of 24 bit color with only 8 bit display
  • 512 x 512 x 8-bit (each pixel is 8 bits deep so values

0-255 are possible)

  • Each of the 512 x 512 pixels can be one of 256 index

values into a video lookup table

  • Video lookup table has 256 24-bit RGB values where

each value has 8 bits for red, 8 bits for green, and 8 bits for blue

  • 16 million colors are possible, but only 256 of them can

be displayed at the same time

27

slide-29
SLIDE 29

Color display: 8-bit with colormap

28

slide-30
SLIDE 30

Frame Buffer

  • Depth of frame buffer

(e.g. 8 bit) determines number of simultaneous colors possible

  • Width of color map (e.g.

24 bit) determines number of colors that can be chosen from

Screen size Monoch rome 8-bit 24-bit 512x512 32K 256K 768K 640x480 38K 300K 900K 1280x1024 160K 1.3M 3.8M 1920x1200 280K 2.2M 6.6M

29

slide-31
SLIDE 31

Hardware affects on computer animation

  • A program may take several minutes, hours,
  • r days to render a single image. These

images can then be stored and played back

  • r recorded to create animation
  • A more interesting situation is when the

animation is live with the computer generated image changing while the user watches, or as the user interacts with the computer

30

slide-32
SLIDE 32

Animation

  • For animation, a SECOND frame buffer is

needed

  • This is similar to how a motion picture

works at 24 frames per second:

  • 1. A new frame is moved in front of the lens
  • 2. The shutter is opened to display the frame
  • 3. The shutter is closed

31

slide-33
SLIDE 33

Computer Graphics

  • In the case of a film, each of the frames has already

been generated and its just a question of showing them

  • In interactive computer graphics the frames are being

drawn one at a time. The frame buffer is regularly sent to the display device (eg 60 times per second) whether the frame buffer has been completely updated or not

  • We don't want the user to see the screen being cleared

and the new image being drawn on the screen each time the display refreshes. We only want the user to see a succession of completely drawn images

32

slide-34
SLIDE 34

Another buffer needed

  • Solution is to have two frame buffers
  • User draws into one buffer while the
  • ther is being displayed
  • When drawing is complete the buffers are

swapped

  • Only swap buffers in between screen

refreshes

  • when electron gun of the CRT is off and

moving from bottom of screen to the top

33

slide-35
SLIDE 35

Drawing speed

  • If the screen refreshes 60 times a second you can have a

new image on the screen:

  • 1/60th of a second ... 60 frames per second if all frames

take equal time

  • 1/30th of a second ... 30 frames per second if all frames

take equal time

  • 1/20th of a second ... 20 frames per second if all frames

take equal time

  • 1/10th of a second ... 10 frames per second if all frames

take equal time

  • Very small change in the time it takes to draw a scene

into the frame buffer can have a major impact on the speed of the application

34

slide-36
SLIDE 36

How to run at 45fps ?

  • Can your program run at 45 frames per

second (fps)?

  • Yes:
  • if 30 frames take 1/60th each
  • the next 15 frames take 1/30th each you

will display 45 frames per second

35

slide-37
SLIDE 37

Human Perception

  • For smooth motion you want at least 10

frames per second

  • Preferably more than 15 frames per second
  • Movie (theater): 24fps
  • TV: 30fps (60 updates or fields)
  • 60 frames is good
  • More is better up to screen rate

36

slide-38
SLIDE 38

Next time...

  • 2D graphics: “how we convert from

geometry to pixels”

37

slide-39
SLIDE 39

Bonus Video

  • Larry Cuba’s StarWars video
  • EVL (then called the Circle Graphics

Habitat) at the University of Illinois at Chicago Circle

  • Dept. of Chemistry computer
slide-40
SLIDE 40