EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

86
PPT-6: Three-Dimensional Viewing EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020) Team Hamilton Presentation: Sumeet Santosh Bhadale Tianlin Zhang Damaruka Venkata Sai Tellakula

Transcript of EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

Page 1: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

PPT-6: Three-Dimensional Viewing

EEL 5771-001

Course: Intro to Computer Graphics(Fall 2020)

Team Hamilton Presentation:

Sumeet Santosh Bhadale

Tianlin Zhang

Damaruka Venkata Sai Tellakula

Page 2: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

Team Member’s Contributions

• Member [ Sumeet Santosh Bhadale ]:• 3-D Viewing Concepts

• 3-D Viewing Pipeline

• 3-D Viewing Parameters

• Member [ Tianlin Zhang ]:• 3-D Viewing Effects

• From World to Viewing Transformation

• 3-D Viewing Projections: Orthogonal

• Member [ Damaruka Venkata Sai Tellakula ]:• 3-D Viewing Projections: Parallel

• 3-D Viewing Projections: Perspective

• 3-D Clipping

Page 3: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

Introduction

• Basic considerations of 3D Viewing involve :

• View any object from any spatial position, e.g. : Front of an object , behind the object, middle of a group of objects, inside an object.

• 3D Description of objects are projected on to a flat viewing surface.

• Volume of space is enclosed by the clipping boundaries.

Page 4: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

3-D Viewing Concepts: What are Setups?

• Setups involve defining or setting up the viewing

co-ordinate reference.

• That basically refers to a position and orientation

for a view/projection plane as shown in Figure. A.

• Objects are transferred to the viewing reference

coordinates and projected onto the view plane

Figure. A: Coordinate reference for obtaining a

selected view of a three-dimensional scene.

World Coordinate Frame

Viewing Coordinate

Frame

Page 5: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

3-D Viewing Concepts: Examples

• Some examples of 3D Viewing Software's:

Figure. A: Blender lets you view, render, animate in 3D Figure. B: Chemdoodle used to view chemical structures in 3D

Page 6: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

3-D Viewing Concepts: What are Wire frames ?• A wire-frame, also wireframe model, is a most basic visual representation of

a dimensional (3D) physical object.

• It is created by specifying each edge of the physical object where two mathematically continuous smooth surfaces meet, or by connecting an object's constituent vertices using (straight) lines or curves.

• The object is projected into screen space and

rendered by drawing lines at the location

of each edge.

• Two Types of Wireframe modelling:

Pro's and Con’s.

Pro’s Wireframe

Modelling

Con’s Wireframe

Modelling

User gives a

simple input to

create a shape.

It does not include

information about

inside and outside

boundary surfaces

Page 7: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

3-D Viewing Concepts: Wireframe Examples• Some examples of simple Wireframe models of 3D Objects:

Figure. A: shows all eight vertices and twelve

edges and their numbers in white and yellow

Figure. B: Wireframe Model of a House

Page 8: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

3-D Viewing Concepts: Wire frame Ambiguities?• Computer generated wireframe models usually just contain information about

the locations of all the corners and edges in space coordinates.

• But these models generally don’t consist any surface definition of the object

making it an inherent ambiguity problem where there is a persistent ambiguity

of how the surfaces of the model look.

• For example, in the Figure. P ,which

corner is in front, corner A or corner B?

Figure. P

Page 9: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

3-D Viewing Concepts: Wire frame Ambiguities Examples

• The following is a well-known example

that consists of 16 vertices and 32 edges.

• The inner cube represents a hole here but

the direction of the opening is unknown.

• The latter image shows three

possibilities of the actual object

interpretation.

Page 10: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

3-D Viewing Concepts: What is Depth Cueing?

• Modeling atmospheric attenuation by rendering distant objects at a lower intensity than near ones, hence giving them the appearance of depth.

• Depth information plays an important role to identify viewing direction.

• This can be achieved by varying the brightness

of lines according to the distance.

Page 11: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

3-D Viewing Concepts: Depth Cueing Example

Page 12: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

3-D Viewing Concepts: Few More Concepts

• Correct Visibility: Surface-elements (edges, polygons), which are

occluded by other surface elements, are not drawn so that only

visible areas are shown.

• Shading: Depending on the angle of view or the angle of incident

light, surfaces are colored brighter or darker.

• Illumination Models: Physical simulation of lighting conditions and

propagation and their influence on the appearance of surfaces.

• Stereo Images: A separate image is created and presented (with

various techniques) for each eye to generate a 3D-impression.

Page 13: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

3-D Viewing Concepts: Contd.

• Shadows: Areas which have no line of sight to the light-source are displayeddarker.

• Reflections, Transparency: Reflecting objects show mirror-images, andthrough transparent objects the background can be seen.

• Textures: Patterns or samples are painted on surfaces to give the objects amore complex look (looks much more realistic then).

• Surface Details: Small geometric structures on surfaces (like orange peel,bark, cobblestones, tire profiles) are simulated using tricks.

Page 14: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

3-D Viewing Pipeline

• The steps for computer generation of a view of 3D scene are analogous to the process of taking photograph by a camera.

• For a snapshot, we need to position the camera at a particular point in space and then need to decide camera orientation.

• Finally when we snap the shutter, the seen is cropped to the size of window of the camera and the light from the visible surfaces is projected into the camera film.

• The above gives the basic idea of a 3D Viewing Pipeline

Page 15: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

3-D Viewing Pipeline: Block Diagram

Figure. A General viewing coordinates (VC) to projection coordinates (PC) to normalized

coordinates (NC) and three-dimensional transformation pipeline, from modeling coordinates

(MC) to world coordinates (WC) to ultimately device coordinates (DC).

Page 16: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

3-D Viewing Pipeline

• Object space: Coordinate space where each component is defined.

• World space: All components put together into the same 3D scene via affine transformation. (camera, lighting defined in this space)

• Eye space: Camera at the origin, view direction coincides with the z axis. Hither and Yon planes perpendicular to the z axis

• Clipping space: Clipping takes place here. All points are in a homogeneous coordinate form, i.e. each point is represented by(x,y,z,w)

• 3D image space (Canonical view volume): A parallel piped shape defined by (-1:1,-1:1,0,1). Objects in this space are distorted.

• Screen space: x and y coordinates are screen pixel coordinates

Page 17: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

3-D Viewing Pipeline: Spaces

• Object Space and World Space Eye Space

• Clip Space Image Space

Page 18: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

3-D Viewing Pipeline : Modelling Transformation to View Port

• Modeling Transformations

• Transform from the local coordinate system to the 3d world coordinate system.

• Build complex models by positioning simple components

• Viewing Transformations

• Placing virtual camera in the world

• Transformation from world coordinates to

eye coordinates

• Animation : Vary transformations over time to create motion

Page 19: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

3-D Viewing Pipeline: Illustration of the Process

Page 20: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

3-D Viewing Parameters : View Coordinates

• Establish a 3D viewing reference frame • Viewing Origin: Define the viewpoint or viewing position (sometimes

is referred to as the eye position or the camera position)

• Yview (view-up vector V): Defines Yview direction

FIGURE A A right-handed viewing-

coordinate system, with axes xview,

yview, zview, relative to a right-handed

world-coordinate frame

Page 21: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

3-D Viewing Parameters: View Planes

FIGURE A: Orientation of the view plane FIGURE B: Three possible positions for the view

view-plane normal vector N plane along the zview axis

Page 22: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

3-D Viewing Parameters

• The uvn Viewing-Coordinate Reference Frame ( Viewing Coordinate System)

• Direction of Zview axis: the view-plane normal vector N;

• Direction of Yview axis: the view-up vector V;

• Direction of Xview axis: taking the vector cross product of V and N to get U.

Page 23: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

3-D Viewing Parameters

FIGURE A: A right-handed viewing system defined with unit

vectors u, v, and n.

Page 24: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

3-D Viewing Parameters : Clipping Planes

• Clipping planes are used in 3D computer graphics in order to prevent the renderer from calculating surfaces at an extreme distance from the viewer.

• The plane is perpendicular to the camera, a set distance away (the threshold), and occupies the entire viewport.

• Used in real-time rendering, clipping planes can help preserve processing for objects within clear sight

Page 25: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

3-D Viewing Parameters : Clipping Planes• The use of clipping planes can result in a detraction from the realism of a scene,

as the viewer may notice that everything at the threshold is not rendered correctly

or seems to (dis)appear spontaneously. • The addition of fog a variably transparent region of color or texture just before the

clipping plane can help soften the transition between what should be in plain sightand opaque, and what should be beyond notice and fully transparent, andtherefore does not need to be rendered.

• Finding parts of the objects in the viewing volume. Algorithms from 2D clipping can easily be applied to 3D and used to clip objects against faces of thenormalized view volume.

Algorithms : Cohen Sutherland Clipping , Liang BarskyClipping.

Page 26: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

Generating 3D Viewing Effects

• By varying viewing parameters, different viewing effects can be achieved

Page 27: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

3D Viewing Effects

Wide angle view

pannin

gw

alk

-aro

un

d

Page 28: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

From World to Viewing Transformation

• The translation, scaling and rotation transformations used for 2D can be extended to three dimensions.

• In 3D, each transformation is represented by a 4x4 matrix.

• Using homogeneous coordinates it is possible to represent each type of transformation in a matrix form and integrate transformations into one matrix.

• To apply transformations, simply multiply matrices, also easier in hardware and software implementation.

• Homogeneous coordinates can represent directions.

• Homogeneous coordinates also allow for non-affine transformations, e.g., perspective projection.

Page 29: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

Transformation sequence

• Before object description can be projected to the view plane, they must be transferred to viewing coordinates.

• World coordinate positions are converted to viewing coordinates.

• Conversion of object descriptions from world to viewing coordinates is equivalent to transformation that superimpoes the viewing reference frame onto the world frame using the translation and rotation.

Page 30: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

From World to Viewing Transformation

• First, we translate the view reference point to the origin of the world coordinate system

Page 31: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

From World to Viewing Transformation

• Second, we apply rotations to align the xv,, yv and zv axes with the world xw, yw and zw axes, respectively.

Page 32: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

From World to Viewing Transformation

• If the view reference point is specified at word position (x0, y0, z0), this point is translated to the world origin with the translation matrix T.

Page 33: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

From World to Viewing Transformation

• The rotation sequence requires 3 coordinate-axis transformation depending on the direction of N.

• First, we rotate around xw-axis to bring zv into the xw -zw plane.

−=

1000

00

00

0001

CosSin

SinCosx

R

Page 34: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

From World to Viewing Transformation

• Then, we rotate around the world yw axis to align the zw and zv axes.

−=

1000

00

0010

00

CosSin

SinCos

yR

Page 35: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

From World to Viewing Transformation

• The final rotation is about the world zw axis to align the yw and yv axes.

=

1000

0100

00

00

CosSin

SinCos

zR

Page 36: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

From World to Viewing Transformation

• The complete transformation from world to viewing coordinate transformation matrix is obtained as the matrix product

TRRRM =xyzvcwc ,

Page 37: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

From World to Viewing Transformation

• Another method for generating the rotation-transformation matrix is to calculate uvn vectors and obtain the composite rotation matrix directly.

• Given the vectors N and V, these unit vectors are calculated as ),,(

),,(

),,(

321

321

321

vvv

uuu

nnn

==

=

=

==

unv

NV

NVu

N

Nn

Page 38: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

From World to Viewing Transformation

• This method also automatically adjusts the direction for V so that v is perpendicular to n. The rotation matrix for the viewing transformation is then

Page 39: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

From World to Viewing Transformation

• The matrix for translating the viewing origin to the world origin is

Page 40: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

From World to Viewing Transformation

• The composite matrix for the viewing transformation is then

==

1000

0

0

0

,Pnnnn

Pvvvv

Puuuu

TRMzyx

zyx

zyx

VCW C

Page 41: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

Projection Transformations

• Convert the viewing coordinate description of the scene to coordinate positions on the projection plane.

• Viewing 3D objects on a 2D display requires a mapping from 3D to 2D.

• Two types of projection:

• Parallel Projection

• Perspective Projection

Page 42: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

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

Page 43: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

3-D Viewing Projections: Orthogonal

• Orthogonal projections of an object, displaying plan and elevation views.

• Front, side, and rear orthogonal projections are often called elevations

Orthogonal projections of an object,

displaying plan and elevation views.

Page 44: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

Multiview Orthographic Projection

•Projection plane parallel to principal faces

• Usually form front, top, side views

Front

View

Side

View

Top View

Page 45: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

Orthogonal

• So any orthogonal projection is a parallel projection but not vice versa.

• Left is orthogonal, right is parallel but not orthogonal

Page 46: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

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

Page 47: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

Orthogonal Projection Coordinates

• If projection direction is parallel to zview

• xp=x, yp=y

• z coordinate is kept for visibility detection procedures

An orthogonal projection of a spatial position onto a view

plane.

Page 48: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

Clipping Window and Orthogonal Projection View Volume

• In a camera, the type of lens determines how much of the scene gets transferred to the picture.

• In computer graphics the clipping window is used for this purpose.

• 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.

Page 49: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

Clipping Window and Orthogonal Projection View Volume

Limit the volume in zview

direction by near-far (or

front-back) clipping

planes.

Page 50: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

Normalization Transformation for an Orthogonal Projection • Mapping coordinates into a

normalized view volume with coordinates in the range -1 to 1

+

+−

+−

=

1000

200

02

0

002

minmax

minmax

minmax

minmax

minmax

minmax

,

farnear

farnear

farnear

normortho

zz

zz

zz

ywyw

ywyw

ywyw

xwxw

xwxw

xwxw

M

Page 51: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

3-D Viewing Projections: ParallelMath behind :

• The projections coordinates in terms of x,y,L and φ can be expressed as

• xp = x + L cos φ

• yp = y + L sin φ

• Length L depends on the angle α and the perpendicular distance of the point (x, y, z) from the view plane:

• L = L1(zvp − z) where L1 = cot α.

• We can then write the oblique parallel projection equations can now be written as

• xp = x + L1(zvp − z) cos φ

• yp = y + L1(zvp − z) sin φ

• An orthogonal projection is obtained when L1 = 0 (which occurs at the projection angle α = 90◦).

• Figure showing the parallel projection (x, y, z) to position (xp, yp, zvp) on a projection plane at position zvp along the Zview axis.

Page 52: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

3-D Viewing Projections: ParallelCavalier Projections

• Typical choices for angle φ are 30o and45o, which display a combination view of the front, side, and top of an object.

• Two commonly used values for α are those for which tan α = 1 and tan α = 2.

• For the first case, α = 45o and the views obtained are called cavalier projections.

• All lines perpendicular to the projection plane are projected with no change in length.

Cavalier projections of a cube onto a view plane for two values of angle φ.

The depth of the cube is projected with a length equal to that of the width and height.

Page 53: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

3-D Viewing Projections: Parallel

Cabinet Projections

• When the projection angle α is chosen so that tan α =2, the resulting view is called a cabinet projection.

• For this angle (≈63.4◦), lines perpendicular to the viewing surface are projected at half their length.

• Cabinet projections appear more realistic than cavalier projections because of this reduction in the length of perpendiculars.

Cabinet projections of a cube onto a view plane for two values of angle φ.

The depth is projected with a length that is one half that of the width and height of the cube.

Page 54: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

View Volumes• A view volume for an oblique parallel projection is set up using the same procedures as

in an orthogonal projection.

• We select a clipping window on the view plane with coordinate positions (xwmin, ywmin) and (xwmax, ywmax), for the lower-left and upper-right corners of the clipping rectangle.

• The top, bottom, and sides of the view volume are then defined by the direction of projection and the edges of the clipping window.

• In addition, we can limit the extent of the view volume by adding a near plane and a far plane, as shown below.

• Figure shows the Top view of a finite view volume for an oblique parallel projection in the direction of vector Vp.

Page 55: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

View Volumes

• Oblique parallel projections may be affected by changes in the position of the view plane, depending on how the projection direction is to be specified.

• In some systems, the oblique parallel-projection direction is parallel to the line connecting a reference point to the center of the clipping window.

• Therefore, moving the position of the view plane or clipping window without adjusting the reference point changes the shape of the view volume.

Page 56: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

3-D Viewing Projections: Parallel

Method:

• A parallel-projection view is obtained by transferring object descriptions to the view plane along projection paths that can be in any selected direction relative to the view-plane normal vector. Simply, when the projection path is not perpendicular to the view plane, this mapping is called an oblique parallel projection.

• This projection is a combination of Front view, Top view and Side view.

• Figure showing the three different views of an object.

Page 57: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

3-D Viewing Projections: ParallelMath behind :

• Let’s understand the math with an example which can make it easy and understandable.

• These Parallel projections are specified with two different angles α and φ. L be the length of projection on view plane.

• Lets the (x, y, z) are the axes and projected to (xp, yp, zvp) on a view plane, which is at location zvp along the viewing z axis.

• Position (x, y, zvp) is the corresponding orthogonal-projection point.

• α is the intersection angle with the line of projection plane that joins (xp, yp, zvp) and (x, y, zvp).

• φ is the angle between horizontal direction in the projection and the view-plane line.

• Values:

• α lies between 0 to 900

• φ lies between 0 to 3600

• Figure showing the parallel projection (x, y, z) to position (xp, yp, zvp) on a projection plane at position zvp

along the Zview axis.

Page 58: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

Projection Equations

• We can denote the components of the projection vector relative to the viewing-coordinate frame as Vp = (Vpx, Vpy, Vpz), where Vpy/Vpx = tan φ.

• Then, comparing similar triangles, we have the first set of equations

• And we can write the equivalent of the oblique parallel-projection equations 11 in terms of the projection vector as

Page 59: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

Clipping Ready Transformation

• Using the projection-vector parameters from the equations in above slide, we can express the elements of the transformation matrix for an oblique parallel projection as.

• This matrix shifts the values of the x and y coordinates by an amount proportional to the distance from the view plane, which is at position zvp on the zview axis.

• The z values of spatial positions are unchanged. If Vpx = Vpy = 0,we have an orthogonal projection and matrix Moblique is reduced to the identity matrix.

• For a general oblique parallel projection, matrix represents a z-axis shearing transformation.

Page 60: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

Clipping Ready Transformation• All coordinate positions within the oblique view volume are sheared by an amount

proportional to their distance from the view plane.

• The effect is to shear the oblique view volume into a rectangular parallelepiped, as illustrated below.

• Thus, positions inside the view volume are sheared into orthogonal-projection coordinates by the oblique parallel-projection transformation.

Page 61: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

Normalization The View Volume• Because the oblique parallel-projection equations convert object descriptions to

orthogonal-coordinate positions, we can apply the normalization procedures following this transformation.

• The oblique view volume has been converted to a rectangular parallelepiped. Following the normalization as before in orthogonal, we again map to the symmetric normalized cube within a left-handed coordinate frame.

• Thus, the complete transformation, from viewing coordinates to normalized coordinates, for an oblique parallel projection is

• Moblique,norm = Mortho,norm x Moblique

• Transformation of Moblique , which converts the scene description to orthogonal-projection coordinates; and transformation Mortho,norm is matrix previously referred, which maps the contents of the orthogonal view volume to the symmetric normalization cube.

• Clipping routines can then be applied to the normalized view volume, followed by the determination of visible objects, the surface-rendering procedures, and the viewport transformation.

Page 62: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

3-D Viewing Projections: PerspectiveDefinition:

• Even the parallel projections are easy to project. In some situations such as for example for simulating a camera we need to consider the light rays from objects in a scene follow converging paths to the camera film plane.

• These projections on 3D objects based on perspective of the camera are called as Perspective Projections.

• The projection of objects to the view plane along converging paths causes the Projection reference point.

• Figure shows a perspective projection of two equal-length line segments at different distances from the view plane.

Page 63: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

Math Behind:

• Sometimes we need to select the projection reference point as another viewing parameter in a graphics package, but some systems place this convergence point at a fixed position, such as at the viewpoint.

• The figure shows the projection path of a spatial position (x, y, z) to a general projection reference point at (xprp, yprp, zprp).

3-D Viewing Projections: Perspective

• Figure shows 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 ) .

Page 64: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

Math Behind:

• The projection line intersects the view plane at the coordinate position (xp, yp, zvp), where zvp is some selected position for the view plane on the zview axis.

• The equations describing coordinate positions along this perspective-projection line in parametric form as

• x = x − (x − xprp)u

• y = y − (y − yprp)u 0 ≤ u ≤ 1

• z = z − (z − zprp)u

• Coordinate position (x, y, z) represents any point along the projection line.

• When u = 0, we are at position P = (x, y, z). At the other end of the line, u = 1 and we have the projection reference-point coordinates (xprp, yprp, zprp).

3-D Viewing Projections: Perspective

Page 65: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

• On the view plane, z = zvp and we can solve the z equation for parameter u at this

position along the projection line: u = (zvp − z)/zprp − z

• Substituting this value of u, the general perspective-transformation equations

• Calculations for a perspective mapping are more complex than the parallel-

projection equations, because the denominators in the perspective calculations are

functions of the z coordinate of the spatial position.

• Therefore, we now need to formulate the perspective - transformation procedures a

little differently so that this mapping can be concatenated with the other viewing

transformations.

3-D Viewing Projections: Perspective

Page 66: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

3-D Viewing Projections: Perspective

One –Point Perspective:

• These projections takes place when the projection plane is parallel to two principal axes. We can also say that the projection plane is perpendicular to one of the principal axes.

• The Lines follow along the principal axis and converges to vanishing point.

• The figures show the Vanishing point for a one - point perspective and a real - life example how it looks respectively

Page 67: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

3-D Viewing Projections: Perspective

Two –Point Perspective:

• These projections takes place when the projection plane is parallel to one of the principal axes. We can also say that the projection plane intersects exactly two principal axes.

• This causes the two-point perspective

• The figures shows the intersection of two principal axes causing two -point perspective and a real - life example how it looks respectively

Page 68: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

3-D Viewing Projections: Perspective

Three –Point Perspective:

• For a Three point perspective the projection should not be parallel to any of the axes.

• This causes three intersections of three principal axes (x-y,y-z,z-x).

• The figures shows the intersections of three principal axes causing three -point perspective and a real - life example how it looks respectively

Page 69: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

View Volume• This View Volume is not as we did earlier. Here the bounding planes for the view volume

are not parallel, because the projection lines are not parallel.

• The bottom, top and sides of the view volume are planes through the window edges that all intersect at the projection reference point.

• This forms a view volume that is an infinite rectangular pyramid with its apex at the center of projection.

• A perspective-projection view volume is often referred to as a pyramid of vision because it approximates the cone of vision of our eyes or a camera.

• Figure shows An infinite, pyramid view volume for a perspective projection.

Page 70: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

View Volume

• The displayed view of a scene includes only those objects within the pyramid, just as we cannot see objects beyond our peripheral vision, which are outside the cone of vision.

• By adding near and far clipping planes that are perpendicular to the zview axis (and parallel to the view plane), we chop off parts of the infinite, perspective projection view volume to form a truncated pyramid, or frustum, view volume.

• This figure illustrates the shape of a finite, perspective-projection view volume with a view plane that is placed between the near clipping plane and the projection reference point.

Page 71: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

View Volume• Sometimes the near and far planes are required in a graphics package, and

sometimes they are optional.

• Usually, both the near and far clipping planes are on the same side of the projection reference point, with the far plane farther from the projection point than the near plane along the viewing direction.

• And, as in a parallel projection, we can use the near and far planes simply to enclose the scene to be viewed.

• But with a perspective projection, we could also use the near clipping plane to take out large objects close to the view plane that could project into unrecognizable shapes within the clipping window.

• Similarly, the far clipping plane could be used to cut out objects far from the projection reference point that might project to small blots on the view plane.

• Some systems restrict the placement of the view plane relative to the near and far planes, and other systems allow it to be placed anywhere except at the position of the projection reference point.

Page 72: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

Special Case

What if the view plane is behind the projection reference point?

• That’s kind of a question to think when we are discussing projections.

• Depending on a particular graphics package, positioning for either the projection reference point or the view plane may not be completely optional.

• But if you can obtaing the image on the view plane, it will be inverted.

• A perspective-projection view of an object is upside down when the projection reference point is between the object and the view plane.

Page 73: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

Clipping Ready Transformation

• we can use a three-dimensional, homogeneous-coordinate representation to express the perspective-projection equations in the form

• xp = xh/h and yp = yh/h where h (homogeneous parameter) = zprp - z

• The xh and yh are same numerators as we used for parallel projections.

• The perspective-projection transformation of a

• viewing-coordinate position is then accomplished in two steps. First, we calculate

• the homogeneous coordinates using the perspective-transformation matrix:

• Ph = Mpers · P where

• Ph is the column-matrix representation of the homogeneous point (xh, yh, zh, h) and P is the column-matrix representation of the coordinate position (x, y, z, 1).

Page 74: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

Clipping Ready Transformation

• Being the normal procedure of substitution of xh and yh ,we must also structure the matrix to preserve depth (z-value) information. Otherwise, the z coordinates are distorted by the homogeneous-division parameter h.

• This can be done by setting elements for z transformation so as to normalize the perspective-projection zp coordinates.

• Parameters sz and tz are the scaling and translation factors for normalizing the

• projected values of z-coordinates. Specific values for sz and tz depend on the

• normalization range we select.

Page 75: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

Normalizing The View Volume• When we divide the homogeneous coordinates

by the homogeneous parameter h, we obtain the actual projection coordinates, which are orthogonal-projection coordinates.

• Thus, this perspective projection transforms all points within the frustum view volume to positions within a rectangular parallelepiped view volume.

• The final step in the perspective transformation process is to map this parallelepiped to a normalized view volume.

• We follow the same normalization procedure that we used for a parallel projection.

• The transformed frustum view volume, which is a rectangular parallelepiped, is mapped to a symmetric normalized cube within a left-handed reference frame.

• Normalization transformation from a transformed perspective-projection view volume (rectangular parallelepiped) to the symmetric normalization cube within a left-handed reference frame, with the near clipping plane as the view plane and the projection reference point at the viewing-coordinate origin.

Page 76: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

Normalizing The View Volume

• We have already included the normalization parameter for z coordinates in the perspective-projection matrix, but we still need to determine the values for these parameters when we transform to the symmetric normalization cube.

• Also, we need to determine the normalization transformation parameters for x and y coordinates because the centerline of the rectangular parallelepiped view volume is now the zview axis, no translation is needed in the x and y normalization transformations: We require only the x and y scaling parameters relative to the coordinate origin.

• The scaling matrix for accomplishing the xy normalization is

Page 77: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

Normalizing The View Volume

• From using the following operation• Mnormpers = Mxy scale ·Mobliquepers

• By substituting and computing each and every value in above equation from previous slides the elements of the normalized transformation matrix for a general perspective-projection are

Page 78: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

3D ClippingDefinition

• Clipping is a method to selectively enable or disable rendering operations within a defined region of interest.

• 3D clipping is also just like the 2D clipping and can be achieved by discarding objects that are behind the camera or outside the field and only clips the objects that intersect with any clipping plane.

Page 79: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

3D ClippingAlgorithm:

• Applying 3D clipping algorithms to normalized boundaries allows the viewing pipeline and the clipping procedures to be implemented in a highly efficient way.

• All device-independent transformations (geometric and viewing) are concatenated and applied before executing the clipping routines and each of the clipping boundaries for the normalized view volume is a plane that is parallel to one of the Cartesian planes, regardless of the projection type and original shape of the view volume.

• Depending on normalized view volume being a unit cube or symmetric cube with edge length 2, the clipping planes have coordinate positions either at 0 and 1 or at −1 and 1. For the symmetric cube, the equations for the three-dimensional clipping planes are

xwmin = −1, xwmax = 1

ywmin = −1, ywmax = 1

zwmin = −1, zwmax = 1

Page 80: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

3D Clipping

Algorithm:

• The x and y clipping boundaries are the normalized limits for the clipping window, and the z clipping boundaries are the normalized positions for the near and far clipping planes.

• Clipping algorithms for three-dimensional viewing identify and save all object sections within the normalized view volume for display on the output device.

• All parts of objects that are outside the view-volume clipping planes are eliminated.

• And the algorithms are now extensions of two-dimensional methods, using the normalized boundary planes of the view volume instead of the straight-line boundaries of the normalized clipping window.

Page 81: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

The Use of Homogeneous Coordinates

• Computer-graphics libraries process spatial positions as four-dimensional homogeneous coordinates so that all transformations can be represented as 4 by 4 matrices.

• (x, y, z) → (x, y, z, 1)

• After a position has passed through the geometric, viewing, and projection transformations, it is now in the homogeneous form

• where matrix M represents the concatenation of all the various transformations from world coordinates to normalized, homogeneous projection coordinates, and the homogeneous parameter h may no longer have the value 1.

Page 82: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

The Use of Homogeneous Coordinates• If the homogeneous parameter h does have the value 1, the homogeneous

coordinates are the same as the Cartesian projection coordinates.

• This is often the case for a parallel-projection transformation. But a perspective projection produces a homogeneous parameter that is a function of the z coordinate for any spatial position.

• The perspective-projection homogeneous parameter can even be negative, and this occurs when coordinate positions are behind the projection reference point.

• The homogeneous parameter can be positive or negative and if clipping is performed in projection coordinates after division by the homogeneous parameter h, some coordinate information can be lost, and objects may not be clipped correctly.

• An effective method for dealing with all possible projection transformations and object representations is to apply the clipping routines to the homogeneous coordinate representations of spatial positions.

• And, because all view volumes can be converted to a normalized cube, a single clipping procedure can be implemented in hardware to clip objects in homogeneous coordinates against the normalized clipping planes.

Page 83: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

3D Clipping

• Using some graphics packages, to clip a three-dimensional scene using additional planes that can be specified in any spatial orientation.

• This option is useful in a variety of applications as for example we might want to isolate or clip off an irregularly shaped object, eliminate part of a scene at an oblique angle for a special effect, or slice off a section of an object along a selected axis to show a cross-sectional view of its interior.

• These clipping routines are implemented in software with openGL.

• glClipPlane (id, planeParameters);

• glEnable (id);

• glDisable(id);

• Where id is identifier of clip plane and has values:

• GL CLIP PLANE0, GL CLIP PLANE

• A clipping plane can be specified with the plane parameters A, B, C, and D. The plane then divides three-dimensional space into two parts, so that all parts of a scene that lie on one side of the plane are clipped off.

Page 84: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

3D Clipping

• Assuming that objects behind the plane are to be clipped, then any spatial position (x, y, z) that satisfies the following inequality is eliminated from the scene.

• Ax + By + Cz + D < 0

• As an example, if the values (A, B, C, D) = (1.0, 0.0, 0.0, 8.0), then any coordinate position satisfying x + 8.0 < 0.0 (or, x < −8.0) is clipped from the scene.

• To clip a line segment, we can first test its two endpoints to see if the line is completely behind the clipping plane or completely in front of the plane

• Figure shows a clipping a line segment against a plane with normal vector N.

Page 85: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

References• Computer Graphics with OpenGL Fourth Edition, Donald Hearn, M.Pauline Baker,

Warren R. Carithers.

• https://www.cs.helsinki.fi/group/goa/viewing/proj/yykaakoo.html#:~:text=One%20point%20perspective%20occurs%20when,converge%20to%20a%20vanishing%20point.

• www.google.com

• https://en.wikipedia.org/wiki/Wire-frame_model

• https://www.slideshare.net/ShanmugamSundaramurt/three-dimensional-concepts-computer-graphics

• https://slideplayer.com/slide/8978764/

• https://modelo.io/blog/index.php/the-ultimate-guide-to-creating-a-3d-animation-walkthrough/

• https://studylib.net/doc/5718540/transformation-from-world-to-viewing-coordinates

Page 86: EEL 5771-001 Course: Intro to Computer Graphics(Fall 2020 ...

Thank You!