0% found this document useful (0 votes)
18 views32 pages

Chapter 4 Viewing

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1/ 32

Chapter 4 – Viewing

• Viewing Transformation
– Three transformations
• Camera transformation or eye transformation
• Projection transformation
• Viewport transformation or windowing transformation
• Projective Transformations

Faculty of Computer Science


Graphics Pipeline

• Graphics hardware employs a sequence of


coordinate systems
– The location of the geometry is expressed in each
coordinate system in turn, and modified along the
way
– The movement of geometry through these spaces is
considered a pipeline
Local World View Canonical Display
Coordinate Coordinate Space View Space
Space Space Volume

Faculty of Computer Science


Local Coordinate Space

• It is easiest to define individual objects in a local


coordinate system
– For instance, a cube is easiest to define with faces
parallel to the coordinate axes
• Key idea: Object instantiation
– Define an object in a local coordinate system
– Use it multiple times by copying it and transforming it
into the global system
– This is the only effective way to have libraries of 3D
objects
Faculty of Computer Science
World Coordinate System

• Everything in the world is transformed into one


coordinate system - the world coordinate system
– It has an origin, and three coordinate directions, x, y,
and z
• Lighting is defined in this space
– The locations, brightness’ and types of lights
• The camera is defined with respect to this space
• Some higher level operations, such as advanced
visibility computations, can be done here
Faculty of Computer Science
View Space

• Define a coordinate system based on the eye and image


plane – the camera
– The eye is the center of projection, like the aperture in a camera
– The image plane is the orientation of the plane on which the
image should “appear,” like the film plane of a camera
• Some camera parameters are easiest to define in this space
– Focal length, image size
• Relative depth is captured by a single number in this space
– The “normal to image plane” coordinate

Faculty of Computer Science


Canonical View Volume

• Canonical View Space: A cube, with the origin at the


center, the viewer looking down –z, x to the right, and y up
– Canonical View Volume is the cube: [-1,1]×[-1,1]×[-1,1]
– Variants (later) with viewer looking down +z and z from 0-1
– Only things that end up inside the canonical volume can appear in
the window
• Tasks: Parallel sides and unit dimensions make many
operations easier
– Clipping – decide what is in the window
– Rasterization - decide which pixels are covered
– Hidden surface removal - decide what is in front
– Shading - decide what color things are

Faculty of Computer Science


Window Space
• Window Space: Origin in one corner of the “window” on the
screen, x and y match screen x and y
• Windows appear somewhere on the screen
– Typically you want the thing you are drawing to appear in
your window
– But you may have no control over where the window appears

• You target Window Space, and the windowing system takes care
of putting it on the screen

Faculty of Computer Science


Viewing Transformation
y y

y-wmax y-vmax

(xw,yw) (xv,yv)

y-wmin y-vmin

x x
x-wmin x-wmax x-vmin x-vmax

World coordinate view port

Scaling factor
 𝑓 𝑥 = 𝑥 𝑣𝑚𝑎𝑥 − 𝑥 𝑣𝑚𝑖𝑛 / 𝑥 𝑤𝑚𝑎𝑥 − 𝑥 𝑤𝑚𝑖𝑛
 𝑓 𝑦 = 𝑦 𝑣𝑚𝑎𝑥 − 𝑦 𝑣𝑚𝑖𝑛 / 𝑦 𝑤𝑚𝑎𝑥 − 𝑦 𝑤𝑚𝑖𝑛
 + (  + (

Faculty of Computer Science


Exercises

Q-1:Consider a viewing window of upper left


coner(20,80) and lower right corner(80,40) and view
port of uper left corner(30,60) and lower left corner
(60,40).Convert window coordinate of a point at
(30,70) to viewport.
Q-2:Windowport(100,100,300,300)
Viewport(50,50,150,150).
Convert windowport coordinate (200,200) to
viewport.
Faculty of Computer Science
PROJECTIONS

• Once world-coordinate descriptions of the


objects in a scene are converted to viewing
coordinates.
• Project the three-dimensional objects onto the
two dimensional view plane

Faculty of Computer Science


Two basic projection methods

• parallel projection
• Perspective projection

Faculty of Computer Science


Taxonomy of Planar Geometric
Projections

planar geometric projections

parallel perspective

1 point 2 point 3 point


multiview axonometric oblique
orthographic

isometric dimetric trimetric


Angel: Interactive Computer 1
Graphics 5E © Addison-Wesley 2009 2
Parallel Projection

• Coordinate positions are transformed to the


view plane along parallel lines

Faculty of Computer Science


Parallel Projections

• Projection vector
-the direction for the projection lines
Orthographic parallel projection
-the projection is perpendicular to the view plane

Faculty of Computer Science


Faculty of Computer Science
• Isometric Projection: All projectors make equal angles
generally angle is of 30°.
• Dimetric: In these two projectors have equal angles. With
respect to two principle axis.
• Trimetric: The direction of projection makes unequal angle
with their principle axis.
• Cavalier: All lines perpendicular to the projection plane are
projected with no change in length.
• Cabinet: All lines perpendicular to the projection plane are
projected to one half of their length. These give a realistic
appearance of object.

Faculty of Computer Science


Orthographic Projection

Projectors are orthogonal to projection surface

Angel: Interactive Computer 1


Graphics 5E © Addison-Wesley 2009 7
Multiview Orthographic
Projection
• Projection plane parallel to principal face
• Usually form front, top, side views
isometric (not multiview
orthographic view)
front

in CAD and architecture,


we often display three
multiviews plus isometric
side
top
Angel: Interactive Computer 1
Graphics 5E © Addison-Wesley 2009 8
Advantages and Disadvantages

• Preserves both distances and angles


– Shapes preserved
– Can be used for measurements
• Building plans
• Manuals
• Cannot see what object really looks like
because many surfaces hidden from view
– Often we add the isometric

Angel: Interactive Computer 1


Graphics 5E © Addison-Wesley 2009 9
Axonometric Projections

Allow projection plane to move relative to object

classify by how many angles of


a corner of a projected cube are
the same
q1
none: trimetric q2 q3
two: dimetric
three: isometric

Angel: Interactive Computer 2


Graphics 5E © Addison-Wesley 2009 0
Types of Axonometric Projections

Angel: Interactive Computer 2


Graphics 5E © Addison-Wesley 2009 1
Advantages and Disadvantages

• Lines are scaled (foreshortened) but can find scaling


factors
• Lines preserved but angles are not
– Projection of a circle in a plane not parallel to the projection plane
is an ellipse
• Can see three principal faces of a box-like object
• Some optical illusions possible
– Parallel lines appear to diverge
• Does not look real because far objects are scaled the
same as near objects
• Used in CAD applications
Angel: Interactive Computer 2
Graphics 5E © Addison-Wesley 2009 2
Oblique Projection

Arbitrary relationship between projectors and projection


plane

Angel: Interactive Computer 2


Graphics 5E © Addison-Wesley 2009 3
Advantages and Disadvantages

• Can pick the angles to emphasize a particular face


– Architecture: plan oblique, elevation oblique
• Angles in faces parallel to projection plane are preserved
while we can still see “around” side

• In physical world, cannot create with simple camera;


possible with bellows camera or special lens
(architectural)

Angel: Interactive Computer 2


Graphics 5E © Addison-Wesley 2009 4
Projection Reference Point

Faculty of Computer Science


Perspective Projection

2
Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 6
Perspective Projection

Projectors converge at center of projection

Angel: Interactive Computer 2


Graphics 5E © Addison-Wesley 2009 7
Vanishing Points

• Parallel lines (not parallel to the projection plan) on the


object converge at a single point in the projection (the
vanishing point)
• Drawing simple perspectives by hand uses these
vanishing point(s)

vanishing point

Angel: Interactive Computer 2


Graphics 5E © Addison-Wesley 2009 8
Three-Point Perspective

• No principal face parallel to projection plane


• Three vanishing points for cube

Angel: Interactive Computer 2


Graphics 5E © Addison-Wesley 2009 9
Two-Point Perspective

• On principal direction parallel to projection plane


• Two vanishing points for cube

Angel: Interactive Computer 3


Graphics 5E © Addison-Wesley 2009 0
One-Point Perspective

• One principal face parallel to projection plane


• One vanishing point for cube

Angel: Interactive Computer 3


Graphics 5E © Addison-Wesley 2009 1
Advantages and Disadvantages

• Objects further from viewer are projected smaller than


the same sized objects closer to the viewer (diminution)
– Looks realistic
• Equal distances along a line are not projected into equal
distances (nonuniform foreshortening)
• Angles preserved only in planes parallel to the
projection plane
• More difficult to construct by hand than parallel
projections (but not more difficult by computer)

Angel: Interactive Computer 3


Graphics 5E © Addison-Wesley 2009 2

You might also like