53
Graphics Graphics Lab @ Korea University cgvr.korea.ac.kr 3D Viewing 고고고고고 고고고 고고고고 고고고

viewing3d pipeline

Embed Size (px)

DESCRIPTION

Its Computer Graphics Topic in Engineering for Mumbai University.

Citation preview

Page 1: viewing3d pipeline

Graphics

Graphics Lab @ Korea University

cgvr.korea.ac.kr

3D Viewing

고려대학교 컴퓨터 그래픽스 연구실

Page 2: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

3d Rendering Pipeline

Model TransformationModel Transformation

LightingLighting

Viewing TransformationViewing Transformation

Projection TransformationProjection Transformation

ClippingClipping

Viewport TransformationViewport Transformation

Scan ConversionScan Conversion

3D Primitives

Image

This is a pipelined sequence of operations to draw a 3D primitive into a

2D image for direct illumination

Page 3: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

In Pipeline

Transform into3d world coordinate system

Model TransformationModel Transformation

LightingLighting

Viewing TransformationViewing Transformation

Projection TransformationProjection Transformation

ClippingClipping

Viewport TransformationViewport Transformation

Scan ConversionScan Conversion

Image

3D Primitives

Page 4: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

In Pipeline

Transform into3d world coordinate system

Model TransformationModel Transformation

LightingLighting

Viewing TransformationViewing Transformation

Projection TransformationProjection Transformation

ClippingClipping

Viewport TransformationViewport Transformation

Scan ConversionScan Conversion

Image

Illustrate according to lighting and reflectance

3D Primitives

Page 5: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

In Pipeline

Transform into3d world coordinate system

Model TransformationModel Transformation

LightingLighting

Viewing TransformationViewing Transformation

Projection TransformationProjection Transformation

ClippingClipping

Viewport TransformationViewport Transformation

Scan ConversionScan Conversion

Image

Illustrate according to lighting and reflectance

Transform into 3D viewing coordinate system

3D Primitives

Page 6: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

In Pipeline

Transform into3d world coordinate system

Model TransformationModel Transformation

LightingLighting

Viewing TransformationViewing Transformation

Projection TransformationProjection Transformation

ClippingClipping

Viewport TransformationViewport Transformation

Scan ConversionScan Conversion

Image

Illustrate according to lighting and reflectance

Transform into 3D viewing coordinate system

Transform into 2D viewing coordinate system

3D Primitives

Page 7: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

In Pipeline

Transform into3d world coordinate system

Model TransformationModel Transformation

LightingLighting

Viewing TransformationViewing Transformation

Projection TransformationProjection Transformation

ClippingClipping

Viewport TransformationViewport Transformation

Scan ConversionScan Conversion

Image

Illustrate according to lighting and reflectance

Transform into 3D viewing coordinate system

Transform into 2D viewing coordinate system

Clip primitives outside window’s view

3D Primitives

Page 8: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

In Pipeline

Transform into3d world coordinate system

Model TransformationModel Transformation

LightingLighting

Viewing TransformationViewing Transformation

Projection TransformationProjection Transformation

ClippingClipping

Viewport TransformationViewport Transformation

Scan ConversionScan Conversion

Image

Illustrate according to lighting and reflectance

Transform into 3D viewing coordinate system

Transform into 2D viewing coordinate system

Clip primitives outside window’s view

Transform into viewport

3D Primitives

Page 9: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

In Pipeline

Transform into3d world coordinate system

Model TransformationModel Transformation

LightingLighting

Viewing TransformationViewing Transformation

Projection TransformationProjection Transformation

ClippingClipping

Viewport TransformationViewport Transformation

Scan ConversionScan Conversion

Image

Illustrate according to lighting and reflectance

Transform into 3D viewing coordinate system

Transform into 2D viewing coordinate system

Clip primitives outside window’s view

Transform into viewport

Draw pixels(includes texturing, hidden surface etc.)

3D Primitives

Page 10: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Transformation

Transform into3d world coordinate system

Model TransformationModel Transformation

LightingLighting

Viewing TransformationViewing Transformation

Projection TransformationProjection Transformation

ClippingClipping

Viewport TransformationViewport Transformation

Scan ConversionScan Conversion

Image

Illustrate according to lighting and reflectance

Transform into 3D viewing coordinate system

Transform into 2D viewing coordinate system

Clip primitives outside window’s view

Transform into viewport

Draw pixels(includes texturing, hidden surface etc.)

3D Primitives

Page 11: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Transformation

3D Object Coordinate

Model TransformationModel Transformation

Viewing TransformationViewing Transformation

Projection TransformationProjection Transformation

Viewport TransformationViewport Transformation

p(x’, y’)

P(x, y, z)

3D World Coordinate

3D Viewing Coordinate

2D Projection Coordinate

2D Device Coordinate

3D Viewing Coordinate

3D Object Coordinate

3D World Coordinate

Page 12: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Viewing Transformation

3D Object Coordinate

Model TransformationModel Transformation

Viewing TransformationViewing Transformation

Projection TransformationProjection Transformation

Viewport TransformationViewport Transformation

p(x’, y’)

P(x, y, z)

3D World Coordinate Viewing

Transformation 3D Viewing Coordinate

2D Projection Coordinate

2D Device Coordinate

Page 13: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Viewing Transformation

Mapping from world to Viewing coordinates Origin moves to eye position Up vector maps to Y axis Right vector maps to X axis

X

Y

ZCamera

Page 14: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Transformation from WC to VC

Transformation sequences

1. Translate the view reference point to the origin of the

WC system

2. Apply rotations to align the xv, yv, and zv axes with the world axes

General sequence of translate-rotate transformation

Page 15: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Transformation from WC to VC (cont’)

Translation view reference point(x0, y0, z0)

Rotation rotate around the world xw axis to bring zv into the

xwzw plane rotate around the world yw axis to align the zw and zv

axis final rotation is about the zw axis to align the yw and yv

axis

1000

100

010

001

0

0

0

z

y

x

T

Page 16: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Transformation from WC to VC (cont’)

Rotation by uvn system Calculate unit uvn vectors

N : view-plane normal vector V : view-up vector U : perpendicular to both N and V

Form the composite rotation matrix

321

321

321

, ,

, ,

, ,

vvv

uuu

nnn

unv

NV

NVu

N

Nn

1000

0

0

0

321

321

321

nnn

vvv

uuu

R TRM VCWC ,

Page 17: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Camera Models

The most common model is pin-hole camera All captured light rays arrive along paths toward focal

point without lens distortion (everything is in focus) Sensor response proportional to radiance

Other models consider… Depth of field Motion blur Lens distortion

Page 18: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Viewing Parameters

Position Eye position(px, py, pz)

Orientation View direction(dx, dy, dz) Up direction(ux, uy, uz)

Aperture Field of view(xfov, yfov)

Film plane “look at” point View plane normal

Page 19: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Viewing Coordinate

Canonical coordinate system Convention is right-handed (looking down – z axis) Convention for projection, clipping, etc.

X

Y

Viewing up vector maps to Y axis

Viewing right vector maps to X axis

Viewing back vector maps to Z axis (potting out of page)

Page 20: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Viewing Transformation

Transformation matrix maps camera basis vectors to canonical vectors in viewing coordinate system

Right

UpBack

Eye(0, 0, 1)

(0, 1, 0)

(1, 0, 0)

Matrix

Page 21: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Viewing Transformation

3D Object Coordinate

Model TransformationModel Transformation

Viewing TransformationViewing Transformation

Projection TransformationProjection Transformation

Viewport TransformationViewport Transformation

p(x’, y’)

P(x, y, z)

3D World Coordinate

Projection

Transformation

3D Viewing Coordinate

2D Projection Coordinate

2D Device Coordinate

Page 22: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Projection

General definition Transform points in n-space to m-space(m<n)

In computer graphics Map viewing coordinates to 2D screen coordinates

Page 23: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Taxonomy of Projections

Planar geometric projection

Parallel Perspective

Orthographic Oblique

Top

Front

Side

Axonometric Cabinet

Cavalier

Other

One-point

Two-point

Three-point

Page 24: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Parallel & Perspective

Parallel Projection

Perspective Projection

Page 25: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Taxonomy of Projections

Planar geometric projection

Parallel Perspective

Orthographic Oblique

Top

Front

Side

Axonometric Cabinet

Cavalier

Other

One-point

Two-point

Three-point

Page 26: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Parallel Projection

Center of projection is at infinity Direction of projection (DOP) same for all points

View Plane

DOP

Page 27: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Taxonomy of Projections

Planar geometric projection

Parallel Perspective

Orthographic Oblique

Top

Front

Side

Axonometric Cabinet

Cavalier

Other

One-point

Two-point

Three-point

Page 28: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Parallel Projection View Volume

Page 29: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Orthographic & Oblique

Orthographic parallel projection the projection is perpendicular to the view plane

Oblique parallel projection The projectors are inclined with respect to the view

plane

Page 30: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Orthographic Projections

DOP perpendicular to view plane

Page 31: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Orthographic Projections

DOP perpendicular to view plane

Front

Top Side

Page 32: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Orthographic Coordinates

yyxx pp ,

Page 33: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Oblique Projections

DOP not perpendicular to view plane

Cavalier(DOP at 45 )

Cabinet(DOP at 63.4 )

Page 34: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Oblique Projections

DOP not perpendicular to view plane Cavalier projection

Cabinet projection 4.63,2tan

45,1tan

Page 35: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Parallel Projection Matrix

General parallel projection transformation

)sin(

)cos(tan

,tan

sin,cos

1

1

1

Lzyy

Lzxx

zLz

LL

z

LyyLxx

p

p

pp

Where L1 is the inverse of tan α , which is also the value of L when z=1

Page 36: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Parallel Projection Matrix

General parallel projection transformation

11000

0000

0sin10

0cos01

1

1

z

y

x

L

L

w

z

y

x

p

p

p

p

Page 37: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Parallel Projection Matrix

1000

0000

0sin10

0cos01

1

1

L

L

parallelM

Page 38: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Taxonomy of Projections

Planar geometric projection

Parallel Perspective

Orthographic Oblique

Top

Front

Side

Axonometric Cabinet

Cavalier

Other

One-point

Two-point

Three-point

Page 39: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Perspective Projection

Map points onto “view plane” along “projectors” emanating from “center of projection”(cop)

View PlaneCenter of Projection

Proj

ecto

rs

Page 40: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Perspective Projection

How many vanishing point?

Page 41: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Perspective Projection

How many vanishing point?

Three-point

perspective

Page 42: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Perspective Projection

How many vanishing point?

Three-point

perspective

Two-point perspectiv

e

Page 43: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Perspective Projection

How many vanishing point?

Three-point

perspective

Two-point perspectiv

e

One-point perspectiv

e

Page 44: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Perspective Projection View Volume

Page 45: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Perspective Projection

Compute 2D coordinates from 3D coordinates with similar triangles

Page 46: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Perspective Projection

Compute 2D coordinates from 3D coordinates with similar triangles

Page 47: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Perspective Projection Matrix

4x4 matrix representation?

1

p

p

p

p

w

Dz

zyDy

zxDx

1????

????

????

????

z

y

x

w

z

y

x

p

p

p

p

Dzw

zz

yy

xx

p

'

'

'

Page 48: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Perspective Projection Matrix

4x4 matrix representation?

10100

0100

0010

0001

z

y

x

Dw

z

y

x

p

p

p

p

1

p

p

p

p

w

Dz

zyDy

zxDx

Dzw

zz

yy

xx

p

'

'

'

Page 49: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Perspective Projection Matrix

11

00

0100

0010

0001

1000

0000

0010

0001

11

00

0000

0010

0001

DD

PERM

Perspective projection

Perspective transformation

Orthographicprojection

1001

0000

0010

0001

x

PER

D

M

101

0

0000

0010

0001

y

PER

D

M

Center of Projection on the x axis Center of Projection on the y axis

Page 50: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Perspective Projection Matrix

10

0000

0010

0001

or

10

0000

0010

0001

tssr

2-point perspectives

1

0000

0010

0001

tsr

3-point perspectives

Page 51: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Taxonomy of Projections

Planar geometric projection

Parallel Perspective

Orthographic Oblique

Top

Front

Side

Axonometric Cabinet

Cavalier

Other

One-point

Two-point

Three-point

Page 52: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Perspective vs. Parallel

Perspective projection+ Size varies inversely with distance – looks realistic

– Distance and angles are not(in general) preserved

– Parallel line do not (in general) remain parallel

Parallel projection + Good for exact measurements

+ Parallel lines remain parallel

– Angles are not (in general) preserved

– Less realistic looking

Page 53: viewing3d pipeline

CGVR

Graphics Lab @ Korea University

cgvr.korea.ac.kr

Classical Viewing