Download presentation
1
Three-Dimensional Viewing Hearn & Baker Chapter 7
COMPUTER GRAPHICS Three-Dimensional Viewing Hearn & Baker Chapter 7
2
Overview 3D viewing involves some tasks that are not present in 2D viewing: Projection, Visibility checks, Lighting effects, etc.
3
Overview First, set up viewing (or camera) coordinate reference
The position and orientation for a view plane (or projection plane) that corresponds to a camera film plane Figure Coordinate reference for obtaining a selected view of a three-dimensional scene.
4
Projections Parallel projection Perspective projection
As used in engineering and architectural drawings Shows accurate dimensions Perspective projection Objects far away are shown smaller than nearby same size objects Figure Three parallel-projection views of an object, showing relative proportions from different viewing positions.
5
Depth Cueing Depth info is important to identify viewing direction
Depth cueing: Vary the brightness of lines according to distance
6
3D Viewing Pipeline Choose a viewing position (place the camera)
Decide on camera orientation Direction and rotation (up direction) Figure Photographing a scene involves selection of the camera position and orientation.
7
Some viewing operations in 3D are same as in 2D
3D Viewing Pipeline Some viewing operations in 3D are same as in 2D 2D viewport, 2D clipping window, etc. Some are different Even though clipping window is 2D on the view plane, the scene is clipped against a volume (view volume)
8
3D Viewing Pipeline Figure General three-dimensional transformation pipeline, from modeling coordinates (MC) to world coordinates (WC) to viewing coordinates (VC) to projection coordinates (PC) to normalized coordinates (NC) and, ultimately, to device coordinates (DC).
9
3D Viewing-Coordinate Parameters
Select View point (or viewing position, eye position, camera position) P0=(x0,y0,z0) View-up vector V to define yview Direction to define zview Figure A right-handed viewing-coordinate system, with axes x view, y view, and z view, relative to a right-handed world-coordinate frame.
10
The View-Plane Normal Vector
Viewing direction is along zview axis So, view plane (or projection plane) is normally perpendicular to this axis Orientation of the view plane (and direction of positive zview axis) can be defined by a view-plane normal vector N Figure Orientation of the view plane and view-plane normal vector N.
11
The View-Plane Normal Vector
Then, a scalar parameter is used to set the position of the view plane at coordinate zvp along zview axis Figure Three possible positions for the view plane along the z view axis.
12
The View-Up Vector After view plane normal N, we choose a direction for view-up vector V (used to determine positive yview) V should be perpendicular to N Viewing routines typically adjust user-defined V Often, V=(0,1,0) is a convenient choice Figure Adjusting the input direction of the view-up vector V to an orientation perpendicular to the view-plane normal vector N.
13
The uvn Viewing-Coordinate
Reference Frame Right-handed viewing systems are more common, but sometimes left-handed viewing systems are used In left-handed viewing systems viewing direction is towards the positive zview direction Left-handed coordinate references are often used to represent screen coordinates and for the normalization transformation
14
The uvn Viewing-Coordinate
Reference Frame View-plane normal N defines zview axis direction View-up vector V is used to obtain yview axis direction We need to determine xview axis direction cross product of N and V gives U in xview axis direction cross product of N and U gives adjusted V u, v, n are unit vectors in directions U, V, N Figure A right-handed viewing system defined with unit vectors u, v, and n.
15
Generating 3D Viewing Effects
By varying viewing parameters, different viewing effects can be achieved
16
Transformation from World to Viewing Coordinates
Translate viewing coordinate origin (P0) to the world coordinate origin Align xview, yview, zview with xw, yw, zw
17
Transformation from World to Viewing Coordinates
The transformation matrix is the product of these translation and rotation matrices
18
Projection Transformations
In parallel projection, coordinate positions are transferred to view plane along parallel lines orthogonal/orthographic oblique For perspective projection, coordinates are transferred to view plane along lines that converge at a point
19
Orthogonal Projections
Projection along lines parallel to the view-plane normal N Front, side, rear orthogonal projections are often called elevations The top one is called plan view Figure Orthogonal projections of an object, displaying plan and elevation views.
20
Axonometric and Isometric Orthogonal Projections .
Orthogonal projections which show more than one face of an object are called axonometric orthogonal projections Isometric: Most common axonometric o.p.s that are generated by aligning projection plane so that it intersects principal axes at the same distance from origin
21
Orthogonal Projection Coordinates
If projection direction is parallel to zview xp=x, yp=y z coordinate is kept for visibility detection procedures Figure An orthogonal projection of a spatial position onto a view plane.
22
Clipping Window and Orthogonal Projection View Volume
Edges of the clipping window specify the x and y limits These are used to form the top, bottom, and two sides of a clipping region called the orthogonal-projection view volume Limit the volume in zview direction by near-far (or front-back) clipping planes
23
Figure 10-22 A finite orthogonal view volume with the view plane “in front” of the near plane.
24
Normalization Transformation for an Orthogonal Projection
mapping coordinates into a normalized view volume with coordinates in the range -1 to 1
25
Oblique Parallel Projections
Projection path is not perpendicular to view plane It can be defined with a vector direction The effect is same as z-axis shearing transformation Figure An oblique parallel projection of a cube, shown in a top view (a), produces a view (b) containing multiple surfaces of the cube.
26
Figure 10-32 Top view of an oblique parallel-projection transformation
Figure Top view of an oblique parallel-projection transformation. The oblique view volume is converted into a rectangular parallelepiped, and objects in the view volume, such as the green block, are mapped to orthogonal-projection coordinates.
27
Perspective Projections
Project objects to view plane along converging paths to projection reference point (or center of projection) Figure A perspective projection of two equal-length line segments at different distances from the view plane.
28
Perspective Projections
If it is at origin On the viewplane, z’=zvp. Solve this for u Substitute this u into x’ and y’ equations If projection reference point is on zview Figure A perspective projection of a point P with coordinates (x, y, z) to a selected projection reference point. The intersection position on the view plane is (xp, yp, zvp ).
29
Figure A perspective-projection view of an object is upside down when the projection reference point is between the object and the view plane. Q. What if the scene is between the projection reference point and the view plane?
30
Figure Changing perspective effects by moving the projection reference point away from the view plane.
31
Vanishing Points Lines parallel to view plane are still parallel
But, other lines parallel to each other are now converging The point such lines converge at are vanishing points Vanishing points for lines parallel to principal axes are principal vanishing points How many principal v.p.s can be seen depends on projection plane orientation 1-point, 2-point, or 3-point projections
32
Perspective Projection View Volume
An infinite pyramid of vision is chopped off by near and far clipping planes and we get a truncated pyramid (or frustum)
33
Perspective-Projection Transformation Matrix
Cannot directly apply a matrix and get the result 2 steps are required First, calculate the homogeneous coordinates using perspective projection matrix Ph=Mpers P Then, after normalization and clipping, divide by h (homogeneous parameter, h=zprp-z) sz (scaling) and tz (translation) factors for normalizing projected z coordinate values (they depend on the selected normalization range
34
Symmetric Perspective Projection Frustum
If the line from perspective reference point through clipping window center (centerline) is perpendicular to view plane, we have a symmetric frustum Clipping window can be specified by width and height, or field-of-view angle and aspect ratio With a symmetric frustum, perspective transformation is a mapping to orthogonal coordinates (figure on next slide)
35
Figure A symmetric frustum view volume is mapped to an orthogonal parallelepiped by a perspective-projection transformation.
36
Oblique Perspective-Projection Frustum
Centerline not perpendicular to view plane First, transform this into a symmetric frustum (z-axis shearing) Then proceed as before
37
Viewport Transformation and 3D Screen Coordinates
Once we have normalized projection coordinates, clipping can be done on the symmetric cube (or unit cube) After clipping, cube contents can be transferred to screen coordinates For x and y, same as in 2D Depth info (z coordinates) must be retained for visibility testing and surface rendering
38
3D Clipping Algorithms No matter what the projection details were, we now have a normalized cube, so we clip against planes parallel to Cartesian planes (either at coordinates 0 and 1, or -1 and 1) The task is to identify object sections within the cube (save parts inside and eliminate parts outside) Algorithms are extensions of the 2D algorithms
39
3D Region Codes The idea is the same as in 2D (we added 2 more bits for near and far planes) A point is now P=(xh,yh,zh,h) h can be a value other than 1 (in perspective projection), so, the inequalities to be satisfied are -1<=xh/h<=1 -1<= yh/h<=1 -1<= zh/h<=1
40
3D Region Codes And bit values can be decided by
h values should be nonzero and often positive (these can be easily checked) So, our inequalities become -h <= xh <= h, -h <= yh <= h, and -h <= zh <= h And bit values can be decided by bit 1 = 1 if h + xh < 0 (left) bit 2 = 1 if h - xh < 0 (right) bit 3 = 1 if h + yh < 0 (bottom) bit 4 = 1 if h - yh < 0 (top) bit 5 = 1 if h + zh < 0 (near) bit 6 = 1 if h - zh < 0 (far)
41
Figure Values for the three-dimensional, six-bit region code that identifies spatial positions relative to the boundaries of a view volume.
42
__ Figure Three-dimensional region codes for two line segments. Line P1P2 intersects the right and top clipping boundaries of the view volume, while line P3P4 is completely below the bottom clipping plane. __
43
Figure 10-52 Three-dimensional object clipping
Figure Three-dimensional object clipping. Surface sections that are outside the view-volume clipping planes are eliminated from the object description, and new surface facets may need to be constructed.
44
Figure 10-53 Clipping a line segment against a plane with normal vector N.
45
Figure Clipping the surfaces of a pyramid against a plane with normal vector N. The surfaces in front of the plane are saved, and the surfaces of the pyramid behind the plane are eliminated.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.