computer sciecne

14
Model Model Model M1 M2 M3 3D World Scene 3D View Scene V P Clip Normalize 2D/3D Device Scene 2D Image Projectio n Rasterizat ion Modeling Transformation s Viewing Transformation s MCS WCS VCS NDCS DCS SCS Viewing Pipeline

Upload: vishnu-gupta

Post on 10-Dec-2015

213 views

Category:

Documents


0 download

DESCRIPTION

computer science notes

TRANSCRIPT

Page 1: computer sciecne

Model

Model

Model

M1

M2

M3

3D WorldScene

3D ViewScene

V

P Clip Normalize 2D/3D DeviceScene

2D ImageProjection

Rasterization

ModelingTransformations

ViewingTransformations

MCS WCS VCS

NDCS DCSSCS

Viewing Pipeline

Page 2: computer sciecne

• Model coordinates to World coordinates:Modelling transformations

Model coordinates:1 circle (head),2 circles (eyes),1 line group (nose),1 arc (mouth),2 arcs (ears).With their relative coordinates and sizes

World coordinates:All shapes with theirabsolute coordinates and sizes.circle(0,0,2)circle(-.6,.8,.3) circle(.6,.8,.3)lines[(-.4,0),(-.5,-.3),(.5,.3),(.4,0)]arc(-.6,0,.6,0,1.8,180,360)arc(-2.2,.2,-2.2,-.2,.8,45,315)arc(2.2,.2,2.2,-.2,.8,225,135)

Page 3: computer sciecne

• World coordinates to Viewing coordinates:Viewing transformations

World coordinates

Viewing coordinates:Viewers position and view angle. i.e. rotated/translated

Page 4: computer sciecne

• Projection: 3D to 2D. Clipping depends on viewing frame/volume. Normalization: device independent coordinates

Device Independent Coordinates:Invisible shapes deleted, others reduced to visible parts.3 arcs, 1 circle, 1 line group

Viewing coordinates:

Page 5: computer sciecne

• Device Independent Coordinates to Device Coordinates. Rasterization

Unit measures Pixels

Device Independent Coordinates

Screen Coordinates orDevice Coordinates

Page 6: computer sciecne

2D Viewing Transformation Pipeline2D Viewing Transformation Pipeline

Construct World Coordinate Scene Using

Modeling Coordinate Transformation

Construct World Coordinate Scene Using

Modeling Coordinate Transformation

Convert World Coordinates to

Viewing Coordinates

Convert World Coordinates to

Viewing Coordinates

Transform Viewing Coordinates to

Normalized Coordinates

Transform Viewing Coordinates to

Normalized Coordinates

Map Normalized Coordinates to Device

Coordinates

Map Normalized Coordinates to Device

Coordinates

MC WC

VC

NC

DC

Page 7: computer sciecne

World Coordinates:• User-Defined Limits• Floating point values

Device Coordinates:• Device dependent Limits• Positive Integer values

Coordinate SystemsCoordinate Systems

(x, y)

xmin xmax

yman

ymin

(u,v)

umin umax

vmin

vmax

Clipping Window Viewport

Page 8: computer sciecne

2D Viewing• World coordinates to Viewing coordinates• Window to Viewport.

Window: A region of the scene selected for viewing (also called clipping window)Viewport: A region on display device for mapping to window

World Coordinates Viewing Coordinates

WindowWindow

Viewport

Page 9: computer sciecne

Clipping Window vs. Viewport

• The clipping window selects what we want to see in our virtual 2D world.

• The viewport indicates where it is to be viewed on the output device (or within the display window)

• By default the viewport have the same location and dimensions of the GLUT display window you create– But it can be modified so that only a part of the

display window is used for OpenGL display

Page 10: computer sciecne

The clipping window

xwmin xwmax

ywmin

ywmax

xvmin xvmax

yvmin

yvmax

xvmin xvmax

yvmin

yvmax

x0

y0

xview

yview

xworld

yworld

xview

yview

RectangularWindow

RotatedWindow

Page 11: computer sciecne

World-coordinates to Viewing Coordinates

• Mwc,vc= R·T

x0

y0

xview

yview

xworld

yworld

xview

yviewxview

yview

xworld

yworldyview

),( 00 yx T )(R

Page 12: computer sciecne

Normalization

Page 13: computer sciecne

• Coordinate transformation: Different sizes and/or height width ratios?

• For any point:

should hold.minmax

min

minmax

min

minmax

min

minmax

min

ywyw

ywyw=

yvyv

yvyv

xwxw

xwxw=

xvxv

xvxv

Page 14: computer sciecne

• This can also be accomplished in 2 steps:1. Scale over the fixed point:

2. Translate lower-left corner of the clipping window to the lower-left corner of the viewport

minmax

minmaxminmin

minmax

minmaxminmin

ywyw

yvyvywyw+yv=yv

xwxw

xvxvxwxw+xv=xv

yxminmin s,s,yw,xwS

minminminmin ywyv,xwxv T