3D Viewing Transformation
Tong-Yee Lee
1
2
Setup Camera parameters to view 3D scenes
3
Viewing and viewport Transformation
viewport transformation:
open a window on the monitor screen to
display an image display
4
Case A): rotating objects, the camera does not move
Case B): rotating camera, the object does not move
5
World space and
eye space coordinate
: visible objects are on
negative Z direction
6
World
Coordinate
Local Coordinate
View coordinate
Project plane
OpenGL Graphics
Pipeline
8
使用glViewport
指定 Viewport 變換
使用GL_PROJECTION 指定投影變換,OpenGL 支持透視投影和正側投影(一般用於工程製圖)-1<=x,y,z<=1
Front and Back Clipping Planes
OpenGL: Field of View, gluPerspective�Yet another way to set viewing
glFrustum(left, right, bottom, top, near, far)
gluPerspective(fovy, aspect, near, far)
aspect = w/h
front plane
World coordinate v.s. eye corrdinate
11
Eye-coordinate to Clip coordinate
12
13
14
Viewing Specification
15
Back-face culling
16
Back-face culling (trivial rejection)
Viewing direction
Back-face culling (trivial rejection)
One method of implementing back-face culling is by discarding all triangles where the dot productOne method of implementing back-face culling is by discarding all triangles where the dot product of their surface normal and the camera-to-triangle vector is greater than or equal to zero
where P is the view point, V0 is the first vertex of a triangle and N is its normal, defined as a cross product of two vectors representing sides of the triangle adjacent to V0
V0
V1
V2
P
N
Reject condition
P
N
V0
18
Viewing frustum and backface culling: The mesh is coarsened outside of the viewing frustum. Triangles oriented away from the viewer are coarsened as well.
View dependent LOD (Level of Details)
19
20
21
22
23
Intuitive Camera Specification
24
25
26
27
28
29
30
31
32
33
X axis vector
Y axis vector
Z axis vector
34
35
Intuitive Camera Specification
36
37
Not easy for user to pick up
exact up vector!!
So, we compute v automatically
from up vector.
38
39
Note that matrix storage order is column major
in OpenGL
40
Treat yourself (viewer) as an airplane heading to –Zc
Note that: as a viewer is moving, the object is moving in
opposite direction on the viewing plane!!
u (i.e., x) axis
n (i.e.,z) axis
v (i.e., y) axis
俯仰
翻滾
偏航
41
Pitch (x), Roll (z) and Yaw (y) rotation
42
This is z-like rotation
How about slide()
43
延camera座標軸 walking
i.e., needs to transfer its change to word coordinate on eye position
And eye u, v, w directions are not changed!
Flythrough �a Scene!!!
‘P’-64
=ctrl+‘P’
Homework
#3 (optional) Add
this camera control!!
45
Camera Frame
Light v.s. Eye coordinate
46
Animate camera along paths
47
http://graphics.csie.ncku.edu.tw/Motion_Overview/
Motion Overview of Human Actions
Same v.s. Different camera paths for different motions
48
Cinemachine Tutorials | How to make Unity the path animation?
Camera editing Using Unity
49
Cinemachine Tutorials | How to make Unity the path animation?
https://www.programmersought.com/article/69213097748/
50
Zoom-in/Zoom-out
Camera moving
51
Sliding a camera to create panorama images
52