SlideShare a Scribd company logo
1 of 29
Download to read offline
6. Perspective
Projection
COL781: Computer Graphics
Blender manual
Luciano Testoni
Last class’s homework
Given unit vectors u and v, find a way to construct a rotation matrix R which
maps u to v, i.e. Ru = v. Is it unique, or are there many different such rotations?
u
v
R = ?
Hierarchical transformations
hip
chest
head
left upper arm
left lower arm
left hand
right upper arm
right lower arm
right hand
left upper leg
…
…
Hierarchical transformations
hip
chest
head
left upper arm
left lower arm
left hand
right upper arm
right lower arm
right hand
left upper leg
…
…
Shapes are specified in the corresponding part’s
local coordinate frame
Each part’s transformation is relative to its parent
Given point in left hand frame,
Vec3 world_point
= world_from_hip * hip_from_chest
* chest_from_ularm * uarm_from_llarm
* llarm_from_lhand * lhand_point
or simply
Mat3x3 world_from_lhand
= world_from_hip * hip_from_chest
* chest_from_ularm * uarm_from_llarm
* llarm_from_lhand
Mat3x3 world_from_lhand
= world_from_hip * hip_from_chest
* chest_from_ularm * uarm_from_llarm
* llarm_from_lhand
Mat3x3 world_from_lhand
= world_from_llarm * llarm_from_lhand
Going down the tree:
Push parent’s matrix on stack
Multiply child’s matrix on right
Going back up: Pop parent’s matrix from stack
hip
chest
head
left upper arm
left lower arm
left hand
right upper arm
right lower arm
right hand
left upper leg
…
…
Scene graph
Usually the entire scene is represented
as a tree / DAG!
Nodes may contain geometry or other content
Edges contain transformations
Why a DAG? So we can reuse the same
geometry multiple times: instancing
Scene
Camera Lights
Car ⋯
Door Wheel
Handle
So far we know:
• How to draw 2D shapes
• How to transform 2D and 3D shapes
Today: How to draw 3D shapes on a 2D screen?
Parallel projection
Easy way: Just drop one of the coordinates lol
• Useful for engineering drawings
• Doesn’t match how eyes and cameras
actually see things!
Angel & Shreiner, Interactive Computer Graphics
Perspective
Jeff Lynch
Algorithmic drawing
in the 1500s
Albrecht Dürer
A point is drawn where the ray from
the viewpoint meets the image plane.
Pinhole camera model
3D object
camera / eye / etc.
sensor / retina aperture
/ pupil
Assume camera is at the origin,
pointing in the direction −z.
Where is the point p projected to?
Similarly v = yd/z
(W.l.o.g., let’s take d = −1)
x
z
=
u
d
u =
xd
z
−z
x,y
d
q = (u,v,d)
Scene point
p = (x,y,z)
Image plane
What if the camera is not at the origin and/or not looking along −z?
Just change to a coordinate system in which it is.
Viewing transformation
Usually, user specifies:
• center of projection c
• target point t or view vector v = (t−c)/‖t−c‖
• “up vector” u
Construct orthonormal basis
e2 = (v×u)/‖v×u‖
e1 = v×e2
e3 = −v
Camera → world: M = [e1 e2 e3 c]
World → camera: M−1
Once point is in camera space, projected point =
[
xd/z
yd/z]
Model space
World space
Camera space
Canon EF Lens Work III
16 mm (110°)
Up close and zoomed wide
with short focal length Ren Ng
200 mm (12°)
Walk back and zoom in
with long focal length
Ren Ng
Choose transformation so that points in field of view fall inside [−1,1] × [−1,1]
(ℓ,b)
(r,b)
(ℓ,t)
(r,t)
−1
−1
1
1
“Normalized
device coordinates”
Coordinates after
perspective division
(Actually there’s a bit more in NDC… Will correct later!)
Puzzle:
What is the maximum possible angle of view in perspective projection?
Why does no graphics application or game let you set
your angle of view to anything remotely close to it?
Wouter van Oortmerssen
Angle of view: 90°
Wouter van Oortmerssen
Angle of view: 120°
Wouter van Oortmerssen
Angle of view: 150°
Wouter van Oortmerssen
Angle of view: 170°
90°
120°
150°
170°
And finally, we can rasterize our triangles!
−1
−1
1
1 (0,0) W
H
(W,H)
Normalized
device coordinates
Screen coordinates
(locations of pixels)
• Model space → world space
• World space → camera space
• Camera space → projection plane
(division by z)
• Projection plane → NDC
• NDC → screen coordinates
Two problems:
• Every step is a matrix, except
perspective division.
• Final result has lost depth information
(the z coordinate): don’t know which
points are in front of which
Homework exercise: DIY 3D GFX
Draw a cube! (manually, or with Excel,
or using a plotting library)
Start with vertices at (±1,±1,±1),
translate somewhere along −z, maybe
apply some rotation, then draw the
projected points and join them with
edges.
Keenan Crane
Translated by (2,3,−5),
no rotation

More Related Content

Similar to 6. Perspective Projection .pdf

Shadow Mapping with Today's OpenGL Hardware
Shadow Mapping with Today's OpenGL HardwareShadow Mapping with Today's OpenGL Hardware
Shadow Mapping with Today's OpenGL HardwareMark Kilgard
 
Lecture Summary : Camera Projection
Lecture Summary : Camera Projection Lecture Summary : Camera Projection
Lecture Summary : Camera Projection 홍배 김
 
Build Your Own VR Display Course - SIGGRAPH 2017: Part 2
Build Your Own VR Display Course - SIGGRAPH 2017: Part 2Build Your Own VR Display Course - SIGGRAPH 2017: Part 2
Build Your Own VR Display Course - SIGGRAPH 2017: Part 2StanfordComputationalImaging
 
3D Math Primer: CocoaConf Chicago
3D Math Primer: CocoaConf Chicago3D Math Primer: CocoaConf Chicago
3D Math Primer: CocoaConf ChicagoJanie Clayton
 
The Day You Finally Use Algebra: A 3D Math Primer
The Day You Finally Use Algebra: A 3D Math PrimerThe Day You Finally Use Algebra: A 3D Math Primer
The Day You Finally Use Algebra: A 3D Math PrimerJanie Clayton
 
3 projection computer graphics
3 projection computer graphics3 projection computer graphics
3 projection computer graphicscairo university
 
View in 3_d_asper_syllabus
View in 3_d_asper_syllabusView in 3_d_asper_syllabus
View in 3_d_asper_syllabuslokesh503
 
View in 3_d_asper_syllabus
View in 3_d_asper_syllabusView in 3_d_asper_syllabus
View in 3_d_asper_syllabuslokesh503
 
projections - engineering drawing
projections - engineering drawing projections - engineering drawing
projections - engineering drawing Krishna Gali
 
Cameras
CamerasCameras
Camerasgayu r
 
ANISH_and_DR.DANIEL_augmented_reality_presentation
ANISH_and_DR.DANIEL_augmented_reality_presentationANISH_and_DR.DANIEL_augmented_reality_presentation
ANISH_and_DR.DANIEL_augmented_reality_presentationAnish Patel
 
Stixel based real time object detection for ADAS using surface normal
Stixel based real time object detection for ADAS using surface normalStixel based real time object detection for ADAS using surface normal
Stixel based real time object detection for ADAS using surface normalTaeKang Woo
 
Build Your Own 3D Scanner: 3D Scanning with Swept-Planes
Build Your Own 3D Scanner: 3D Scanning with Swept-PlanesBuild Your Own 3D Scanner: 3D Scanning with Swept-Planes
Build Your Own 3D Scanner: 3D Scanning with Swept-PlanesDouglas Lanman
 
Computer Vision - cameras
Computer Vision - camerasComputer Vision - cameras
Computer Vision - camerasWael Badawy
 
Computer Vision - Single View
Computer Vision - Single ViewComputer Vision - Single View
Computer Vision - Single ViewWael Badawy
 
ResearchPaper
ResearchPaperResearchPaper
ResearchPaperIan Bloom
 

Similar to 6. Perspective Projection .pdf (20)

Shadow Mapping with Today's OpenGL Hardware
Shadow Mapping with Today's OpenGL HardwareShadow Mapping with Today's OpenGL Hardware
Shadow Mapping with Today's OpenGL Hardware
 
Lecture Summary : Camera Projection
Lecture Summary : Camera Projection Lecture Summary : Camera Projection
Lecture Summary : Camera Projection
 
Build Your Own VR Display Course - SIGGRAPH 2017: Part 2
Build Your Own VR Display Course - SIGGRAPH 2017: Part 2Build Your Own VR Display Course - SIGGRAPH 2017: Part 2
Build Your Own VR Display Course - SIGGRAPH 2017: Part 2
 
3D Math Primer: CocoaConf Chicago
3D Math Primer: CocoaConf Chicago3D Math Primer: CocoaConf Chicago
3D Math Primer: CocoaConf Chicago
 
3DSensing.ppt
3DSensing.ppt3DSensing.ppt
3DSensing.ppt
 
The Day You Finally Use Algebra: A 3D Math Primer
The Day You Finally Use Algebra: A 3D Math PrimerThe Day You Finally Use Algebra: A 3D Math Primer
The Day You Finally Use Algebra: A 3D Math Primer
 
3 projection computer graphics
3 projection computer graphics3 projection computer graphics
3 projection computer graphics
 
View in 3_d_asper_syllabus
View in 3_d_asper_syllabusView in 3_d_asper_syllabus
View in 3_d_asper_syllabus
 
View in 3_d_asper_syllabus
View in 3_d_asper_syllabusView in 3_d_asper_syllabus
View in 3_d_asper_syllabus
 
projections - engineering drawing
projections - engineering drawing projections - engineering drawing
projections - engineering drawing
 
Cameras
CamerasCameras
Cameras
 
Notes04.pdf
Notes04.pdfNotes04.pdf
Notes04.pdf
 
ANISH_and_DR.DANIEL_augmented_reality_presentation
ANISH_and_DR.DANIEL_augmented_reality_presentationANISH_and_DR.DANIEL_augmented_reality_presentation
ANISH_and_DR.DANIEL_augmented_reality_presentation
 
Stixel based real time object detection for ADAS using surface normal
Stixel based real time object detection for ADAS using surface normalStixel based real time object detection for ADAS using surface normal
Stixel based real time object detection for ADAS using surface normal
 
Build Your Own 3D Scanner: 3D Scanning with Swept-Planes
Build Your Own 3D Scanner: 3D Scanning with Swept-PlanesBuild Your Own 3D Scanner: 3D Scanning with Swept-Planes
Build Your Own 3D Scanner: 3D Scanning with Swept-Planes
 
Computer Vision - cameras
Computer Vision - camerasComputer Vision - cameras
Computer Vision - cameras
 
Smart Room Gesture Control
Smart Room Gesture ControlSmart Room Gesture Control
Smart Room Gesture Control
 
Computer Vision - Single View
Computer Vision - Single ViewComputer Vision - Single View
Computer Vision - Single View
 
ResearchPaper
ResearchPaperResearchPaper
ResearchPaper
 
Lec15 sfm
Lec15 sfmLec15 sfm
Lec15 sfm
 

Recently uploaded

Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetEnjoy Anytime
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 

Recently uploaded (20)

Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 

6. Perspective Projection .pdf

  • 1. 6. Perspective Projection COL781: Computer Graphics Blender manual Luciano Testoni
  • 2. Last class’s homework Given unit vectors u and v, find a way to construct a rotation matrix R which maps u to v, i.e. Ru = v. Is it unique, or are there many different such rotations? u v R = ?
  • 3. Hierarchical transformations hip chest head left upper arm left lower arm left hand right upper arm right lower arm right hand left upper leg … …
  • 4. Hierarchical transformations hip chest head left upper arm left lower arm left hand right upper arm right lower arm right hand left upper leg … …
  • 5. Shapes are specified in the corresponding part’s local coordinate frame Each part’s transformation is relative to its parent Given point in left hand frame, Vec3 world_point = world_from_hip * hip_from_chest * chest_from_ularm * uarm_from_llarm * llarm_from_lhand * lhand_point or simply Mat3x3 world_from_lhand = world_from_hip * hip_from_chest * chest_from_ularm * uarm_from_llarm * llarm_from_lhand
  • 6. Mat3x3 world_from_lhand = world_from_hip * hip_from_chest * chest_from_ularm * uarm_from_llarm * llarm_from_lhand Mat3x3 world_from_lhand = world_from_llarm * llarm_from_lhand Going down the tree: Push parent’s matrix on stack Multiply child’s matrix on right Going back up: Pop parent’s matrix from stack hip chest head left upper arm left lower arm left hand right upper arm right lower arm right hand left upper leg … …
  • 7. Scene graph Usually the entire scene is represented as a tree / DAG! Nodes may contain geometry or other content Edges contain transformations Why a DAG? So we can reuse the same geometry multiple times: instancing Scene Camera Lights Car ⋯ Door Wheel Handle
  • 8. So far we know: • How to draw 2D shapes • How to transform 2D and 3D shapes Today: How to draw 3D shapes on a 2D screen?
  • 9. Parallel projection Easy way: Just drop one of the coordinates lol • Useful for engineering drawings • Doesn’t match how eyes and cameras actually see things! Angel & Shreiner, Interactive Computer Graphics
  • 11. Algorithmic drawing in the 1500s Albrecht Dürer A point is drawn where the ray from the viewpoint meets the image plane.
  • 12. Pinhole camera model 3D object camera / eye / etc. sensor / retina aperture / pupil
  • 13. Assume camera is at the origin, pointing in the direction −z. Where is the point p projected to? Similarly v = yd/z (W.l.o.g., let’s take d = −1) x z = u d u = xd z −z x,y d q = (u,v,d) Scene point p = (x,y,z) Image plane
  • 14. What if the camera is not at the origin and/or not looking along −z? Just change to a coordinate system in which it is.
  • 15. Viewing transformation Usually, user specifies: • center of projection c • target point t or view vector v = (t−c)/‖t−c‖ • “up vector” u Construct orthonormal basis e2 = (v×u)/‖v×u‖ e1 = v×e2 e3 = −v
  • 16. Camera → world: M = [e1 e2 e3 c] World → camera: M−1 Once point is in camera space, projected point = [ xd/z yd/z] Model space World space Camera space
  • 17. Canon EF Lens Work III
  • 18. 16 mm (110°) Up close and zoomed wide with short focal length Ren Ng
  • 19. 200 mm (12°) Walk back and zoom in with long focal length Ren Ng
  • 20. Choose transformation so that points in field of view fall inside [−1,1] × [−1,1] (ℓ,b) (r,b) (ℓ,t) (r,t) −1 −1 1 1 “Normalized device coordinates” Coordinates after perspective division (Actually there’s a bit more in NDC… Will correct later!)
  • 21. Puzzle: What is the maximum possible angle of view in perspective projection? Why does no graphics application or game let you set your angle of view to anything remotely close to it?
  • 27. And finally, we can rasterize our triangles! −1 −1 1 1 (0,0) W H (W,H) Normalized device coordinates Screen coordinates (locations of pixels)
  • 28. • Model space → world space • World space → camera space • Camera space → projection plane (division by z) • Projection plane → NDC • NDC → screen coordinates Two problems: • Every step is a matrix, except perspective division. • Final result has lost depth information (the z coordinate): don’t know which points are in front of which
  • 29. Homework exercise: DIY 3D GFX Draw a cube! (manually, or with Excel, or using a plotting library) Start with vertices at (±1,±1,±1), translate somewhere along −z, maybe apply some rotation, then draw the projected points and join them with edges. Keenan Crane Translated by (2,3,−5), no rotation