18
Lecture 15: Perspective Projection Pipeline October 27, 2020

Lecture 15: Perspective Projection Pipeline

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Lecture 15: Perspective Projection Pipeline

Lecture 15:Perspective Projection Pipeline

October 27, 2020

Page 2: Lecture 15: Perspective Projection Pipeline

10/22/20 CSU CS 410, Fall 2020, © Ross Beveridge Slide 2

How do Pixels get Colored?§ Step back and consider two alternatives

for (each_object) render (object)

for (each_pixel) color (pixel)

o Reasoning goes “What pixels are altered by this object?”

o Basis for OpenGL rendering pipeline.

o Highly Parallel on modern hardware.

o Fast, but object interactions extremely hard.

o Reasoning goes “What object alter this pixels coloring?”

o Basis for Ray Casting and Ray Tracing.

o Highly Parallel

o Cost mainly intersecting 3D objects with light rays cast back into the scene.

Page 3: Lecture 15: Perspective Projection Pipeline

Fill Pixels Inside Triangles

10/22/20 CSU CS 410, Fall 2020, © Ross Beveridge 3

Fifty years ago “Scan Conversion”

Page 4: Lecture 15: Perspective Projection Pipeline

10/22/20 CSU CS 410, Fall 2020, © Ross Beveridge 4

A Characterization of Ten Hidden-Surface AlgorithmsIvan E. Sutherland, Robert F. Sproull, and Robert A. SchumackerACM Computer. Surveys. 6, 1 (March 1974)

Forty seven years ago, draw triangles so closest occludes

all others.

Page 5: Lecture 15: Perspective Projection Pipeline

10/22/20 CSU CS 410, Fall 2020, © Ross Beveridge 5

Thirty seven years ago - foundation of Silicon Graphics and beginning of OpenGL.

In Essence: The Perspective Projection

Pipeline

Page 6: Lecture 15: Perspective Projection Pipeline

Four Major Tasks• Think of rending objects in terms of:–Modeling– Geometry Processing– Rasterization– Fragment Processing

Modeling GeometricProcessing Rasterization Fragment

Processing

Frame BufferToday’s Lecture

10/22/20 CSU CS 410, Fall 2020, © Ross Beveridge 6

Page 7: Lecture 15: Perspective Projection Pipeline

Moving to Formulation #3• Review, #1 origin at PRP (Eye).• Review, #2 origin at image center.• Review, #1 and #2– No useful information on the z-axis

• We now have a new goal• Project into a canonical view volume• A rectangular volume with bounds:– U: -1 to 1, V: -1 to 1, D: -1 to 1

10/22/20 CSU CS 410, Fall 2020, © Ross Beveridge 7

Page 8: Lecture 15: Perspective Projection Pipeline

Remember When We Started• What happens if you multiply a point in

homogeneous coordinates by a scalar?• Nothing!

10/22/20 CSU CS 410, Fall 2020, © Ross Beveridge 8

xyzw

!

"

####

$

%

&&&&

=

sxsyszsw

!

"

####

$

%

&&&&

= s ⋅

xyzw

!

"

####

$

%

&&&&

Page 9: Lecture 15: Perspective Projection Pipeline

Scalar Multiplication Continued• Multiply a homogeneous matrix by a scalar?• Again, nothing changes.

10/22/20 CSU CS 410, Fall 2020, © Ross Beveridge 9

ax + by+ cz+ dwex + fy+ gz+ hwix + jy+ kz+ lwmx + ny+oz+ pw

!

"

#####

$

%

&&&&&

=

a b c de f g hi j k lm n o p

!

"

#####

$

%

&&&&&

xyzw

!

"

####

$

%

&&&&

ax + by+ cz+ dwex + fy+ gz+ hwix + jy+ kz+ lwmx + ny+oz+ pw

!

"

#####

$

%

&&&&&

=

s ax + by+ cz+ dw( )s ex + fy+ gz+ hw( )s ix + jy+ kz+ lw( )s mx + ny+oz+ pw( )

!

"

######

$

%

&&&&&&

= s ⋅

a b c de f g hi j k lm n o p

!

"

#####

$

%

&&&&&

xyzw

!

"

####

$

%

&&&&

Page 10: Lecture 15: Perspective Projection Pipeline

Form #1 & Textbook Derivation

10/22/20CSU CS 410, Fall 2020, © Ross Beveridge 10

Lecture Form #1

1 0 0 00 1 0 000

00

1#1 𝑑

00

𝑑 0 0 00 𝑑 0 000

00

𝑑1

00

Equivalent

Page 11: Lecture 15: Perspective Projection Pipeline

Now introduce clipping planes• Text introduces n, the near clipping plane.• Also introduces f, the far clipping plane.• Sets what first called d to n. • The handling of z now carries information?

10/22/20 CSU CS 410, Fall 2020, © Ross Beveridge 11

n 0 0 00 n 0 00 0 n+ f − fn0 0 1 0

"

#

$$$$

%

&

''''

nxny

zn+ zf − fnz

"

#

$$$$$

%

&

'''''

=

n 0 0 00 n 0 00 0 n+ f − fn0 0 1 0

"

#

$$$$

%

&

''''

xyz1

"

#

$$$$

%

&

''''

Page 12: Lecture 15: Perspective Projection Pipeline

Visualize View Volume (View 1)

10/22/20 CSU CS 410, Fall 2020, © Ross Beveridge 12

Page 13: Lecture 15: Perspective Projection Pipeline

Visualize View Volume (View 2)

10/22/20 CSU CS 410, Fall 2020, © Ross Beveridge 13

Page 14: Lecture 15: Perspective Projection Pipeline

Consider Some Key Points

10/22/20 CSU CS 410, Fall 2020, © Ross Beveridge 14

00𝑛

00𝑓

11𝑓1

1𝑛

Page 15: Lecture 15: Perspective Projection Pipeline

Formulation #3: The Algebra

10/22/20 CSU CS 410, Fall 2020, © Ross Beveridge 15

The 1,1 corner of the near clipping plane maps to 1,1 on image plane.The 1,1 corner on the far clipping plane comes toward the optical axis and becomes n/f on the image plane.

𝑀!

Page 16: Lecture 15: Perspective Projection Pipeline

Visualize Frustum Change

10/22/20 CSU CS 410, Fall 2020, © Ross Beveridge 16

Page 17: Lecture 15: Perspective Projection Pipeline

SageMath Notebook CS410lec15n01

10/22/20 CSU CS 410, Fall 2020, © Ross Beveridge 17

Geometry Pipeline

Understand each of these!

Page 18: Lecture 15: Perspective Projection Pipeline

SageMath Notebook CS410lec17n01

10/22/20 CSU CS 410, Fall 2020, © Ross Beveridge 18

CanonicalView

Volume

Image Plane Looking Down