34
3D Polygon Rendering Pipeline 원원 – (http://www.cs.princeton.edu/courses/archive/fall00/cs426/lectures/pi peline/index.htm) Thomas Funkhouser (Princeton University) C0S 4 26 원원원원원 원원원원 원원원 원원원

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

Embed Size (px)

Citation preview

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

3D Polygon Rendering Pipeline

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

Thomas Funkhouser (Princeton University) C0S 426

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

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

Basis

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

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

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

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

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

3D polygon rendering

Many applicatons use rendering of 3d polygons with direct illumination

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

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

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

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

3d Rendering Pipeline

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

For direct illumination

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

Example

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

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

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

In Pipeline

Transform into3d world coordinate system

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

In Pipeline

Illuminate according to lighting and reflectance

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

In Pipeline

Transform into 3D camera coordinate system

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

In Pipeline

Transform into 2D camera coordinate system

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

In Pipeline

Clip primitives outside camera’s view

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

In Pipeline

Draw pixels

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

In Pipeline

Transform

Transform

Transform

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

Transformations

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

Transformations review Transformations map points from

one coordinate system to another

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

Viewing Transformations

Viewing transformations

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

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

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

Projection

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

space(m<n) In computer graphics

– Map 3D camera coordinates to 2D screen coordinates

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

Taxonomy of Projections

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

Taxonomy of Projections

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

Parallel Projection

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

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

Orthographic Projections

DOP perpendicular to view plane

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

Oblique Projections

DOP not perpendicular to view plane

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

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

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

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

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

Taxonomy of Projections

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

Perspective Projection

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

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

Perspective Projetion

How many vanishing point?

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

Perspective Projection View Volume

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

Perspective Projection

Compute 2D coordinates from 3D coordinates with similar triangles

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

Perspective Projection (Cont)

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

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

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

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

/

'

'

'

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

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