computer graphics -introduction

30
Computer Graphics - Introduction Human-Centered CAD Lab. 2009-03-24 1

Upload: others

Post on 18-Dec-2021

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Computer Graphics -Introduction

Computer Graphics - Introduction

Human-Centered CAD Lab.

2009-03-241

Page 2: Computer Graphics -Introduction

Basic Theories in Computer Graphics

2

Computer graphics is an essential tool in CAD

Interactive shape manipulation is an essential element of CAD

Page 3: Computer Graphics -Introduction

Graphic Library

3

Driver: Hardware-dependent software to drive a specific graphic

device Different graphic devices are driven by different driver

routines

Application Program Driver Input/Output Devices

Page 4: Computer Graphics -Introduction

Cathode Ray Tube

4

Page 5: Computer Graphics -Introduction

Cathode Ray Tube

5

B R G B R G BG

G B R G B R GR

B R G B R G BG

G B R G B R GR

G B R G B R GR

R

R

B

R

GB

Shadow mask Phosphors on glass faceplate

Green beam

Blue beam

Red beam

Beam convergence

Page 6: Computer Graphics -Introduction

Display Process

6

Page 7: Computer Graphics -Introduction

LCD (Liquid Crystal Display)

Each pixel of an LCD typically consists of a layer of molecules aligned between two transparent electrodes, and two polarizing filters, the axes of transmission of which are perpendicular to each other. With no actual liquid crystal between the polarizing filters, light passing through the first filter would be blocked by the second polarizer.

Molecular orientation of liquid crystal is twisted according to the electric field and polarization of the incident light is rotated through liquid crystal layer.

7

Page 8: Computer Graphics -Introduction

LCD (Liquid Crystal Display)

8

Page 9: Computer Graphics -Introduction

Graphic Library – cont’

9

Graphic Library Collection of sub-programs performing graphic functions

by calling driver routines Each subprogram is implemented by driver routines

Application Program Graphic Library Driver Input/Output Devices

Page 10: Computer Graphics -Introduction

Graphic Library – cont’

10

Any Graphic Library can support limited drivers

Application program written with a specific graphic library may have to be rewritten when a graphic device is not supported by the used graphic library

Better to have same subprogram names and usage in all graphic libraries

Page 11: Computer Graphics -Introduction

Graphic Library – cont’

11

CORE Graphic System in 1977 by SIGGRAPH (Special Interest Group on Computer Graphics) under ACM (Association for Computing Machinery)

Weak for raster graphics

GKS (Graphic Kernel System) Standard for 2D graphics GKS – 3D

Page 12: Computer Graphics -Introduction

Graphic Library – cont’

12

PHIGS (Programmer’s Hierarchical Interactive Graphics System) by ISO Support dynamic display, better user interaction

PEX (PHIGS Extension to X) Extension of PHIGS by using windowing capability of X

GL, OpenGL

Page 13: Computer Graphics -Introduction

Coordinate Systems

13

Reference coordinate systems to specify the locations of points on the objects and their projected locations on the screen

Device Coordinate System Horizontal axis of screen becomes u-axis, vertical axis

becomes v-axis u,v coordinates (integer value, number of pixels) define

the location in screen Different graphic devices have different origin location and

the range of u, v values

Page 14: Computer Graphics -Introduction

Virtual Device Coordinate System

14

Origin is located at the same location with respect to the screen

Ranges of u, v values are same

Location in screen is provided to the device driver in virtual coordinates, then driver changes the coordinates into specific device coordinates

Page 15: Computer Graphics -Introduction

World Coordinate System

15

Reference coordinate system to describe the whole scene

Used to describe the location and orientation of objects in the scene

Used to specify the location of the view point and view site

Page 16: Computer Graphics -Introduction

Model Coordinate System

16

Coordinate system fixed to each object

Model coordinates of points on the object do not vary while the model translates and rotates

Object translation and rotation is described by the location of the origin and the axes orientations of model coordinate system

Page 17: Computer Graphics -Introduction

Viewing Coordinate System

17

Used to facilitate the projection calculation of 3D points

Determined by view point and view site

Page 18: Computer Graphics -Introduction

Viewpoint and viewsite

18

World coordinate system

Viewpoint Screen

Viewsite

Page 19: Computer Graphics -Introduction

Viewing coordinate system – cont’

19

XV, YV, ZV coordinate system Origin is at viewsite ZV is from viewsite to viewpoint YV is in the vertical upper direction in the screen XV points to the right in the screen when viewed from view

point

OpenGL Origin is at viewpoint ZV is from viewpoint to viewsite Left-handed coordinate system

Page 20: Computer Graphics -Introduction

Two types of projection

20

xv

yv

zv

Viewsite

Center of projectionViewpoint

xv

yv

zv

Viewsite

ViewpointScreen

Perspective projection Parallel projection

Page 21: Computer Graphics -Introduction

Parallel projection

21

Point on the objects are represented by XV, YV, ZVcoordinates and use XV, YV for screen coordinates

Page 22: Computer Graphics -Introduction

Perspective projection

22

Zv

yv

zv

Side view along xv

Viewpoint

Yv

Ys

SL

Zv

xv

zv

Top view along yv

Viewpoint

Xv

Xs

Viewsite

Viewsite

Screen

Page 23: Computer Graphics -Introduction

Perspective projection – cont’

23

Similarity rule is used to determine screen coordinates from XV, YV, ZV coordinates

YV is obtained by projecting up-vector onto the screen By specifying Up-vector, camera rotation is fixed

VS

VS

SV

YLSY

XLSX

XSXL

::

Page 24: Computer Graphics -Introduction

Transformation between coordinate systems

24

Coordinate valuein model coordinates

Coordinate valuein world coordinates

Coordinate valuein viewing coordinates

Virtual device coordinates

Device coordinates

Model transformation

Viewing transformation

Projection transformation

Page 25: Computer Graphics -Introduction

Viewing volume

25

To specify the volume to display

Similar to the window when we look outside from inside a house

Page 26: Computer Graphics -Introduction

Viewing volume for parallel projection

26

Horizontal and vertical size is specified by XV, YVcoordinates

xv

yv

zv

Viewsite

ViewpointScreenWindow

Viewing volume

Page 27: Computer Graphics -Introduction

Viewing volume for perspective projection

27

xv

yv

zv

Viewsite

Center of projection

Viewpoint

Screen

Window

Viewing volume

Page 28: Computer Graphics -Introduction

Viewing volume: Near plane and far plane

28

Near plane, Far plane: Used to eliminate entities too far or near from view point

Viewing volume

Window

Screen

Near plane

Far plane

Page 29: Computer Graphics -Introduction

View port

29

Region on graphic monitor where screen is projected by viewport mapping

Display monitor

Viewport 1

Viewport 2

Page 30: Computer Graphics -Introduction

View port – cont’

30

View port is specified by using virtual device coordinates

Location on screen → Location on view portby scaling and translation

Same aspect ratio is desired