lecture 15: perspective projection pipeline
TRANSCRIPT
Lecture 15:Perspective Projection Pipeline
October 27, 2020
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.
Fill Pixels Inside Triangles
10/22/20 CSU CS 410, Fall 2020, © Ross Beveridge 3
Fifty years ago “Scan Conversion”
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.
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
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
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
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
!
"
####
$
%
&&&&
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
!
"
####
$
%
&&&&
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
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
"
#
$$$$
%
&
''''
Visualize View Volume (View 1)
10/22/20 CSU CS 410, Fall 2020, © Ross Beveridge 12
Visualize View Volume (View 2)
10/22/20 CSU CS 410, Fall 2020, © Ross Beveridge 13
Consider Some Key Points
10/22/20 CSU CS 410, Fall 2020, © Ross Beveridge 14
00𝑛
00𝑓
11𝑓1
1𝑛
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.
𝑀!
Visualize Frustum Change
10/22/20 CSU CS 410, Fall 2020, © Ross Beveridge 16
SageMath Notebook CS410lec15n01
10/22/20 CSU CS 410, Fall 2020, © Ross Beveridge 17
Geometry Pipeline
Understand each of these!
SageMath Notebook CS410lec17n01
10/22/20 CSU CS 410, Fall 2020, © Ross Beveridge 18
CanonicalView
Volume
Image Plane Looking Down