in the name of god computer graphics. overview introduction geometry interaction graphic systems...

33
In the name of God Computer Graphics

Upload: pamela-randall

Post on 18-Jan-2016

217 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: In the name of God Computer Graphics. Overview Introduction Geometry Interaction Graphic systems Graphics Standards

In the name of God

Computer Graphics

Page 2: In the name of God Computer Graphics. Overview Introduction Geometry Interaction Graphic systems Graphics Standards

Overview

• Introduction

• Geometry

• Interaction

• Graphic systems

• Graphics Standards

Page 3: In the name of God Computer Graphics. Overview Introduction Geometry Interaction Graphic systems Graphics Standards

Is Computer Graphics Important?

Page 4: In the name of God Computer Graphics. Overview Introduction Geometry Interaction Graphic systems Graphics Standards

Graphics Systems

• Interface between users and application software

• Consists of input subroutines and output subroutines accepting input data or commands from a user and converting internal representations into external pictures on screen, respectively

Page 5: In the name of God Computer Graphics. Overview Introduction Geometry Interaction Graphic systems Graphics Standards

Software Portability and Graphics Standards

• It used to be low-level and device dependent packages supplied by the vendor, making it very difficult to port the software.

• We have now moved to high-level device independent packages, which allow much easier porting of software.

• Several standard device-independent graphics libraries are based on geometric modeling.

Page 6: In the name of God Computer Graphics. Overview Introduction Geometry Interaction Graphic systems Graphics Standards

• Graphics Software Standards:– CORE -- 3D Core Graphics Systems -- a

specification produced by an ACM SIGGRAPH committee in 1977.

– GKS - Graphical Kernel System -- (1985) cleaned up and implemented the 2D portion of CORE.

– GKS-3D (1988) -- implemented CORE’s 3D portions.

• Permitted the grouping of primitives (such as lines, polygons, and character strings -- and their attributes) into collections.

Graphics Software History(1)

Page 7: In the name of God Computer Graphics. Overview Introduction Geometry Interaction Graphic systems Graphics Standards

– PHIGS - Programmers Hierarchical Interactive Graphics System (1988)

• PHIGS also supports a retained database of structures, and automatically updated the screen when the database had been altered.

– PHIGS+ (1992) • added features for photorealistic rendering.

– Other standards• Postscript

• X-Windows

• OpenGL

• PEX

Graphics Software History(2)

Page 8: In the name of God Computer Graphics. Overview Introduction Geometry Interaction Graphic systems Graphics Standards

3D Graphics

• Goal: To produce 2D images of a mathematically described 3D environment

• Issues:– Describing the environment: Modeling– Computing the image: Rendering

• What does it take to describe a scene?

Page 9: In the name of God Computer Graphics. Overview Introduction Geometry Interaction Graphic systems Graphics Standards

Graphics Toolkits• Graphics toolkits typically take care of the details of producing

images from geometry• Input (via API functions):

– Where the objects are located and what they look like– Where the camera is and how it behaves– Parameters for controlling the rendering

• Functions (via API):– Perform well defined operations based on the input environment

• Output: Pixel data in a framebuffer – an image in a special part of memory– Data can be put on the screen– Data can be read back for processing (part of toolkit)

Page 10: In the name of God Computer Graphics. Overview Introduction Geometry Interaction Graphic systems Graphics Standards

OpenGL

• OpenGL is an open standard graphics toolkit– Derived from SGI’s GL toolkit

• Provides a range of functions for modeling, rendering and manipulating the framebuffer

• Why use it?• Alternatives: Direct3D, Java3D - more complex

and less well supported respectively

Page 11: In the name of God Computer Graphics. Overview Introduction Geometry Interaction Graphic systems Graphics Standards

Coordinate Systems(1)

• The use of coordinate systems is fundamental to computer graphics

• Coordinate systems are used to describe the locations of points in space

• Multiple coordinate systems make graphics algorithms easier to understand and implement

Page 12: In the name of God Computer Graphics. Overview Introduction Geometry Interaction Graphic systems Graphics Standards

Coordinate Systems (2)• Different coordinate systems represent the same

point in different ways

• Some operations are easier in one coordinate system than in another– For instance, given a point and a box, which coordinate

system makes it easy to determine if the point is in the box?

x

y(2,3)

u

v

x

y(1,2)

u

v

Page 13: In the name of God Computer Graphics. Overview Introduction Geometry Interaction Graphic systems Graphics Standards

Transformations• Transformations convert points between

coordinate systems

x

y(2,3)v

x

y(1,2)

u

v

u

u=x-1v=y-1

x=u+1y=v+1

Page 14: In the name of God Computer Graphics. Overview Introduction Geometry Interaction Graphic systems Graphics Standards

Transformations(Alternate Interpretation)

• Transformations modify an object’s shape and location in one coordinate system

• The previous interpretation is better for some problems, this one is better for others

x

y(2,3)

(1,2)

x

yx’=x-1y’=y-1

x=x’+1y=y’+1

Page 15: In the name of God Computer Graphics. Overview Introduction Geometry Interaction Graphic systems Graphics Standards

2D Translation

• Moves an object

?

?

??

??

y

x

y

x

x

y

x

y

bx

by?

Page 16: In the name of God Computer Graphics. Overview Introduction Geometry Interaction Graphic systems Graphics Standards

2D Translation

• Moves an object

y

x

b

b

y

x

y

x

10

01

x

y

x

y

bx

by

Page 17: In the name of God Computer Graphics. Overview Introduction Geometry Interaction Graphic systems Graphics Standards

2D Scaling

• Resizes an object in each dimension

x

y

xy

x

y

sxx

syy

?

?

??

??

y

x

y

x

Page 18: In the name of God Computer Graphics. Overview Introduction Geometry Interaction Graphic systems Graphics Standards

2D Scaling

• Resizes an object in each dimension

x

y

0

0

0

0

y

x

s

s

y

x

y

x

xy

x

y

sxx

syy

Page 19: In the name of God Computer Graphics. Overview Introduction Geometry Interaction Graphic systems Graphics Standards

2D Rotation• Rotate counter-clockwise about the origin

by an angle

x

y

x

y

?

?

??

??

y

x

y

x

Page 20: In the name of God Computer Graphics. Overview Introduction Geometry Interaction Graphic systems Graphics Standards

2D Rotation

• Rotate counter-clockwise about the origin by an angle

0

0

cossin

sincos

y

x

y

x

x

y

x

y

Page 21: In the name of God Computer Graphics. Overview Introduction Geometry Interaction Graphic systems Graphics Standards

X-Axis Shear

• Shear along x axis (What is the matrix for y axis shear?)

x

y

x

y

?

?

??

??

y

x

y

x

Page 22: In the name of God Computer Graphics. Overview Introduction Geometry Interaction Graphic systems Graphics Standards

X-Axis Shear

• Shear along x axis (What is the matrix for y axis shear?)

0

0

10

1

y

xsh

y

x x

x

y

x

y

Page 23: In the name of God Computer Graphics. Overview Introduction Geometry Interaction Graphic systems Graphics Standards

Reflect About X Axis

• What is the matrix for reflect about Y axis?

x x

?

?

??

??

y

x

y

x

Page 24: In the name of God Computer Graphics. Overview Introduction Geometry Interaction Graphic systems Graphics Standards

Reflect About X Axis

• What is the matrix for reflect about Y axis?

0

0

10

01

y

x

y

x

x x

Page 25: In the name of God Computer Graphics. Overview Introduction Geometry Interaction Graphic systems Graphics Standards

Rotating About An Arbitrary Point

• What happens when you apply a rotation transformation to an object that is not at the origin?

x

y

?

Page 26: In the name of God Computer Graphics. Overview Introduction Geometry Interaction Graphic systems Graphics Standards

Rotating About An Arbitrary Point

• What happens when you apply a rotation transformation to an object that is not at the origin?– It translates as well

x

y

x

Page 27: In the name of God Computer Graphics. Overview Introduction Geometry Interaction Graphic systems Graphics Standards

How Do We Fix it?

• How do we rotate an about an arbitrary point?– Hint: we know how to rotate about the origin of

a coordinate system

Page 28: In the name of God Computer Graphics. Overview Introduction Geometry Interaction Graphic systems Graphics Standards

Rotating About An Arbitrary Point

x

y

x

y

x

y

x

y

Page 29: In the name of God Computer Graphics. Overview Introduction Geometry Interaction Graphic systems Graphics Standards

Rotate About Arbitrary Point

• Say you wish to rotate about the point (a,b)• You know how to rotate about (0,0)• Translate so that (a,b) is at (0,0)

x’=x–a, y’=y–b

• Rotatex”=(x-a)cos-(y-b)sin, y”=(x-a)sin+(y-b)cos

• Translate back againxf=x”+a, yf=y”+b

Page 30: In the name of God Computer Graphics. Overview Introduction Geometry Interaction Graphic systems Graphics Standards

Scaling an Object not at the Origin

• What also happens if you apply the scaling transformation to an object not at the origin?

• Based on the rotating about a point composition, what should you do to resize an object about its own center?

Page 31: In the name of God Computer Graphics. Overview Introduction Geometry Interaction Graphic systems Graphics Standards

Back to Rotation About a Pt

• Say R is the rotation matrix to apply, and p is the point about which to rotate

• Translation to Origin:• Rotation:• Translate back:• The translation component of the composite

transformation involves the rotation matrix. What a mess!

pxx RpRxpxRxRx )(

pRpRxpxx

Page 32: In the name of God Computer Graphics. Overview Introduction Geometry Interaction Graphic systems Graphics Standards

Basic Transformations

• Translation: Rotation:

• Scaling:

100

10

01

y

x

b

b

100

00

00

y

x

s

s

100

0cossin

0sincos

Page 33: In the name of God Computer Graphics. Overview Introduction Geometry Interaction Graphic systems Graphics Standards

3D Translation

11000

100

010

001

1

z

y

x

t

t

t

z

y

x

z

y

x