3D Polygon Rendering Pipeline 원본 – ( Thomas Funkhouser (Princeton

Preview:

Citation preview

3D Polygon Rendering Pipeline

원본 – (http://www.cs.princeton.edu/courses/archive/fall00/cs426/lectures/pipeline/index.htm)

Thomas Funkhouser (Princeton University) C0S 426

고려대학교 그래픽스 연구실 민성환

Basis

3D Plolygon rendering – 3 차원으로 모델링 된 물체의 형상에 대해

색감 , 질감 , 그림자 , 빛의 반사 및 굴절 효과등을 부여하는 과정

Pipeline– 하나의 process( 작업 ) 을 서로 다른 기능을

가진 여러 개의 subprocess 로 나누어 각 프로세서가 동시에 서로 다른 데이터 처리

3D polygon rendering

Many applicatons use rendering of 3d polygons with direct illumination

3d polygon rendering (cont) What steps are necessary to utilize spat

ial coherence while drawing these polygons into a 2D image?

3d Rendering Pipeline

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

For direct illumination

Example

OpenGL executes steps of 3D rendering pipeline for each polygon.

glBegin(GL_POLYGON)glVertex3f(0.0,0.0,0.0);…glEnd();

In Pipeline

Transform into3d world coordinate system

In Pipeline

Illuminate according to lighting and reflectance

In Pipeline

Transform into 3D camera coordinate system

In Pipeline

Transform into 2D camera coordinate system

In Pipeline

Clip primitives outside camera’s view

In Pipeline

Draw pixels

In Pipeline

Transform

Transform

Transform

Transformations

Transformations review Transformations map points from

one coordinate system to another

Viewing Transformations

Viewing transformations

Viewing Transformation 1.Translate the view reference point to

the origin of the world-coordinate system 2.Apply rotations to align the axes with

the world axes,respectively

Projection

General definition– Transform points in n-space to m-

space(m<n) In computer graphics

– Map 3D camera coordinates to 2D screen coordinates

Taxonomy of Projections

Taxonomy of Projections

Parallel Projection

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

Orthographic Projections

DOP perpendicular to view plane

Oblique Projections

DOP not perpendicular to view plane

Parallel Projection Matrix

General parallel projection transformation

z

)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

Parallel Projection Matrix

General parallel projection transformation

11000

0000

0sin10

0cos01

c

c

c

s

s

s

s

z

y

x

L

L

w

z

y

x

z

Taxonomy of Projections

Perspective Projection

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

Perspective Projetion

How many vanishing point?

Perspective Projection View Volume

Perspective Projection

Compute 2D coordinates from 3D coordinates with similar triangles

Perspective Projection (Cont)

Perspective Projection Matrix

4x4 matrix representation?

1

/

/

s

s

ccs

ccs

w

Dz

zDyy

zDxx

1????

????

????

????

c

c

c

s

s

s

s

z

y

x

w

z

y

x

Perspective Projection Matrix

4x4 matrix representation?

1

/

/

s

s

ccs

ccs

w

Dz

zDyy

zDxx

10/100

0100

0010

0001

c

c

c

s

s

s

s

z

y

x

Dw

z

y

x

DZw

Zz

yy

xx

cs

c

c

c

/

'

'

'

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

Recommended