1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

66
1 Computer Graphics Computer Graphics

Transcript of 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Page 1: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

1

Computer GraphicsComputer Graphics

Page 2: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Chapter 1: Introduction to Graphics

2

Page 3: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Computer graphics History

• Computer graphics generally means creation, storage and manipulation of models and images

• Such models come from diverse and expanding set of fields including physical, mathematical, artistic, biological, and even conceptual (abstract) structures

3

Frame from animation by William Latham, shown at SIGGRAPH 1992. Latham uses rules that govern patterns of natural forms to create his artwork.

Page 4: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Graphics Library (GL)

• Examples: OpenGL™, DirectX™, Windows Presentation Foundation™ (WPF), RenderMan™

• Primitives (chars, 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 scene graph that it maintains, a complex DAG. It is a display-centered extract of the Application Model

4

Page 5: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

What is computer graphics

5

Page 6: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Some research fields of computer graphics

6

Page 7: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Basic notions

• Computer graphics – process of producing a picture or image using the computer

• Computer interfaces popular on personal computers• Desktop publishing • Realistic images generated using mathematical and physical methods

7

Page 8: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Steps for creating a picture

• Creating a model • Perform necessary transformation• Lighting and rendering the object• The goal is the creation of an image by writing a program instead of

taking a picture with a camera• There exists an analogy between writing graphical programs and

taking pictures by a camera

8

Page 9: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Pixels

• Pixel or “Picture element” is the simplest element in computer graphics

• Single location on the computer screen or printout• Value of each pixel is the range from white to black or range of

intensities of red, green, blue (RGB) colors.

9

Page 10: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Frame buffers

• The pixels of an image are organized into two dimensional grid – frame buffer

• Multiple frame buffers can be stored in computer memory• Double buffering – first image is drawn into frame buffer and sent to

display. While the user is looking on the display, the next picture is drawing to the second buffer.

10

Page 11: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Windows

• Image don’t fill the entire screen but is drawn into a window• Pixels are adressed within the window based on their location• Relative position of each pixel enables moving the window and

change its size

11

Page 12: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Realistic images

• Calculating pixel values to create impression of a realistic picture• Simulation of objects from the real word• Approximation of physical properties of objects• Limitations given by computing time and memory space

12

Page 13: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

The Graphics Pipeline

• Modeling – creates an internal representation of the objects in the scene

• Rendering – converts the screen description into image• Display – shows the image on the output device

13

Page 14: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

The Graphics Pipeline

14

Object Specification

Model

TransformationScene Description

Scene Description Model

TransformationView and Light Specification

Clipping and Hidden Surface Removal

Shading Image

Page 15: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

The Graphics Pipeline

15

Display TransformationImage Output

Page 16: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Applications of Computer Graphics

1. Display of information2. Design3. Simulation and animation4. User interfaces

16

Page 17: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

• Display of information• Maps • GIS (geographic information system)• CT (computer tomography)• MRI (magnetic resonance imaging) • PET (positron-emission tomography)• Fluid flow, molecular biology, mathematics…

17

Page 18: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Display of Information

18

Page 19: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Applications of Computer Graphics.

• Design• CAD (computer-aided design):

VLSI (very-large-scale integrated) circuits• Together with other tools:

architecture or interior design

19

Page 20: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Interior Design

20

Page 21: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Applications of Computer Graphics

• Simulation and animation• Flight simulation – pilot training• Games and educational software• Benefits:

• Less cost• Less danger, e.g. combination with the VR (virtual reality) techniques can help surgical

interns and astronauts

21

Page 22: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Applications of Computer Graphics

• User interfaces• Friendly working environment:

windows, icons, menus, pointing devices

22

Interface for a painting program

Page 23: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Application Programmer’s Interface

23Specifications of the functions in the graphics library

•The OpenGL graphics system is an Application Programming Interface (API) to graphics hardware.

Page 24: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Three-dimensional APIs

• Objects• Viewers• Light sources• Material properties

24

Page 25: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Camera(Viewer) Specifications

• Position (COP)• Orientation• Focal length• Film plane

25

Page 26: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Sequence of Images

• Wireframe• Flat shading

• HSR (Hidden surface removal)

• Smooth shading• Curves and surfaces

• NURBS, Bezier curves/surfaces

• Texture mapping• Bump mapping, environmental maps, antialiasing…

26

Page 27: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Pixels

27

Page 28: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

A Graphics System

28

Page 29: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Frame Buffer

• High-end systems: VRAM or DRAM• Simpler systems: part of memory• Depth: the number of bits per pixel• True color: depth=24• Resolution: the number of pixels in the frame buffer

29

Page 30: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Rasterization or Scan-conversion

• Conversion of geometric entities to pixels in the frame buffer

• High-end systems• Special-purpose processors

• Simpler systems• A single and shared processor

30

Page 31: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Output Devices

31CRT (Cathode-ray tube)

Page 32: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Output Devices

• CRT• Refresh: at least 50 times per second• Interlace and non-interlace systems• Color CRTs have three colored phosphors and a shadow mask

• Other raster devices:• LCD (liquid-crystal displays)• Plasma panels and digital projection systems• Non-refreshable: printers and plotters

32

Page 33: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Shadow-mask CRT

33

Page 34: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Input Devices

• Mouse

34

Joystick Data tablet Anything else?

Hand Foot Voice Mind?

Page 35: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Images: Physical and Synthetic

• Image formation• Lighting• Shading• Properties of materials

35

Page 36: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Objects and Viewers

• Object: formed from geometric primitives• Points, lines, polygons• Vertex (pl. Vertices) is the most primitive one

• Viewer: • Locations• Viewing angles

36

Page 37: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Objects and Viewers

37

Page 38: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Objects and Viewers

38

3D world 2D image

Page 39: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Light and Images

39

Page 40: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

40

Synthetic-camera Model

Film Plane

Projection Plane

Page 41: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Single Point Light Source

41

Page 42: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Ray Tracing

42

Penetrating transparent surfaces

Reflected by

Mirrors

Diffuse surfaces

Refracted

Absorbed

Page 43: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Human Visual System

43

Visual system does not have the same response to each color.We are most sensitive to green light

Page 44: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Pinhole Camera

44

Page 45: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Pinhole Camera

45

dz

xx

dz

yy

p

p

/

/

d

h

2tan2 1

(xp, yp, -d) is the projection of (x, y, z)

Page 46: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Synthetic-camera Model

46

Bellows Camera Projector

Page 47: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Synthetic-camera Model

47

COP(Center of Projection)

Focal Length

Page 48: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Synthetic-camera Model

48

Page 49: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Synthetic-camera Model

49

Clipping Window

Page 50: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Sequence of Images

• Wireframe• Flat shading

• HSR (Hidden surface removal)

• Smooth shading• Curves and surfaces

• NURBS, Bezier curves/surfaces

• Texture mapping• Bump mapping, environmental maps, antialiasing…

50

Page 51: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Wireframe

51

Page 52: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Flat Shading

52

Page 53: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Smooth Shading

53

Page 54: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Modeling With Curves/surfaces

54

Page 55: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Bump Mapping

55

Page 56: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Environmental Maps

56

Page 57: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Antialiasing

57

Page 58: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Modeling-rendering Paradigm

58

Example: Scene graph

Page 59: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Graphics Architecture

59

Early graphics system

Computeline segments

Drawline segments

Very high rate to avoid flickering

Page 60: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Graphics Architecture

60

Display-processor architecture

Page 61: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Graphics Architecture

61

Arithmetic pipeline: doubling the throughput!

Pipeline Architecture: Geometric pipeline

Page 62: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Pipelining

62

Arithmetic pipeline: doubling the throughput!

Pipeline Architecture: Geometric pipeline

Page 63: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Geometric Pipeline

• Transformation• Conversion between coordinate systems• Translation, rotation, scaling• Aggregate transforms by matrix multiplications

• Clipping• Could be further pipelined

63

Page 64: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Geometric Pipeline

• Projection• Remaining 3D objects are projected into 2D objects• Parallel or perspective projections

• Rasterization• Convert 2D objects into pixels

64

Page 65: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Performance Characteristics

• Latency• Throughput:

• How fast we can move geometric entities through the pipeline• How many pixels per second we can alter in the frame buffer

• Pipeline architecture is not a must• Ray tracing or radiosity for better quality

65

Page 66: 1 Computer Graphics. Chapter 1: Introduction to Graphics 2.

Summary & Notes of Lecture 1

• Application of computer graphics• A graphics system• Human visual system• Pinhole and synthetic camera models• Image formation• Geometric pipeline• Realistic images may require resolution of up to 40006000

66