Sie sind auf Seite 1von 98

Computer Graphics

Viewing in 3-D

Vikas Kurdia
(Asst. Professor C.S. Department)
(M.Tech Coordinator C.S. & I.T. Department)
Contents
 In today’s lecture we are going to have a look
at:
 Transformations in 3-D
 How do transformations in 3-D work?
 3-D homogeneous coordinates and matrix based

transformations
 Projections
 History

 Geometrical Constructions
 Types of Projection

 Projection in Computer Graphics


3-D Coordinate Spaces
 Remember what we mean by a 3-D
Images taken from Hearn & Baker, “Computer Graphics with OpenGL” (2004)

coordinatey axis
space

z
x
Right-Hand
z axis x axis Reference System
Translations In 3-D
 Totranslate a point in three dimensions by
Images taken from Hearn & Baker, “Computer Graphics with OpenGL” (2004)

dx, dy and dz simply calculate the new


points as follows:
x’ = x + dx y’ = y + dy z’ = z + dz

(x, y, z)
(x’, y’, z’)
Translated Position
Scaling In 3-D

 Tosale a point in three dimensions by sx,


Images taken from Hearn & Baker, “Computer Graphics with OpenGL” (2004)

sy and sz simply calculate the new points


as follows:
x’ = sx*x y’ = sy*y z’ = sz*z

(x, y, z) (x’, y’, z’)

Scaled Position
Rotations In 3-D
 When we performed rotations in two dimensions
we only had the choice of rotating about the z axis

 Inthe case of three dimensions we have


more options
 Rotate about x – pitch

 Rotate about y – yaw

 Rotate about z - roll


Rotations In 3-D (cont…)
 The equations for the three kinds of rotations
Images taken from Hearn & Baker, “Computer Graphics with OpenGL” (2004)

in 3-D are as follows:

 x’ = x·cosθ - y·sinθ  x’ = x  x’ = z·sinθ + x·cosθ


 y’ = x·sinθ + y·cosθ  y’ = y·cosθ - z·sinθ  y’ = y
 z’ = z  z’ = y·sinθ + z·cosθ  z’ = z·cosθ - x·sinθ
Homogeneous Coordinates In 3-D
 Similar to the 2-D situation we can use
homogeneous coordinates for 3-D
transformations - 4 coordinate y axis
column vector
 All transformations can y

then be represented
as matrices x  P
 y
 
z
  z
P(x, y, z) = 1 
x

z axis x axis
3D Transformation Matrices

1 0 0 dx   sx 0 0 0
 dy  0 0 Scaling by
Translation by 0 1 0  sy 0
dx, dy, dz 0 0 1 dz  0 0 sz 0 sx, sy, sz
   
0 0 0 1 0 0 0 1

 cos θ 0 sin θ 0
1 0 0 0  0 1 0 0 cos θ − sin θ 0 0

0 cos θ − sin θ 0 − sin θ 0 cos θ 0  sin θ cos θ 0 0
   
0 sin θ cos θ 0  0 0 0 1  0 0 1 0
   
0 0 0 1  0 0 0 1
Rotate About X-Axis Rotate About Y-Axis Rotate About Z-Axis
Images taken from Hearn & Baker, “Computer Graphics with OpenGL” (2004)

Remember The Big Idea


What Are Projections?
 Our 3-D scenes are all specified in 3-D world
coordinates
 To display these we need to generate a 2-D image
- project objects onto a picture plane

Picture Plane

Objects in
World Space

 So how do we figure out these projections?


Converting From 3-D To 2-D
 Projection is just one part of the process of
converting from 3-D world coordinates to a
2-D image
3-D world
Project onto Transform to
coordinate Clip against 2-D device
projection 2-D device
output view volume coordinates
plane coordinates
primitives
Types Of Projections
 There are two broad classes of projection:
 Parallel:
Typically used for architectural and
engineering drawings
 Perspective: Realistic looking and used in
computer graphics

Parallel Projection Perspective Projection


Types Of Projections (cont…)
 Foranyone who did engineering or
technical drawing
Parallel Projections
 Some examples of parallel projections

Orthographic Projection

Isometric Projection
Isometric Projections
 Isometricprojections have been used in
computer games from the very early days
of the industry up to today

Q*Bert Sim City Virtual Magic Kingdom


Perspective Projections
 Perspective projections are much more
realistic than parallel projections
Perspective Projections
 There are a number of different kinds of
Images taken from Hearn & Baker, “Computer Graphics with OpenGL” (2004)

perspective views
 The most common are one-point and two
point perspectives

Two-Point
Perspective
One Point Perspective
Projection
Projection
Elements Of A Perspective Projection

Virtual
Camera
The Up And Look Vectors
 The look vector
Projection of
up vector
Up vector
Look vector indicates the
direction in which the camera is
pointing
 ThePosition
up vector determines how the
camera is rotated
 For example, is the camera held vertically or
horizontally
Summary
 In today’s lecture we looked at:
 Transformations in 3-D
 Very similar to those in 2-D
 Projections
 3-D scenes must be projected onto a 2-D image plane
 Lots of ways to do this

• Parallel projections
• Perspective projections
 The virtual camera
Who’s Choosing Graphics?
A couple of quick questions for you:
 Who is choosing graphics as an option?
 Are there any problems with option time-
tabling?
 What do you think of the course so far?
 Is it too fast/slow?
 Is it too easy/hard?

 Is there anything in particular you want to cover?


Topic 5 Concept of
Computer Graphics
 Introduction
 Output Primitives and Attributes
 Two dimensional Viewing
 Graphical User Interfaces
 Three Dimensional Concepts
 Three Dimensional Display in Nuclear
Medicine
Computer Graphics
 Everything on computers that is not text or
sound.
 Computer graphics as drawing pictures on
computers.
 Nuclear Medicine uses computer graphics
to display images
Graphic Software
 General Programming Package (Graphic
Library in C etc)
 Application Package (For None-
programmer)
 Modelling Transformation=>World
Coordinates=>Normalised Coordinates
User Graphic Interface
 Consist of windows, pull-down and pop-up
menus, icons, pointing device.
 Popular graphic user interface: X windows, MS
windows, Macintosh, OpenLook and Motif
 Graphic package: Specialised interactive
dialogue
 General Graphic Package: interface to standard
window system: PHIGS for X windows.
User Graphic Interface
Output Attributes
Transformation Pipeline
Display Processor in
Graphic System
From Object Model
to Display Device
Object Rendering
Basic Building Blocks
For Pictures
 Output Primitives
 Characters,

 Geometric Entities.
 Lines,

 Filled
Areas,
 Colours

 Polygons
Output Primitives -
Lines and Points
Output Primitives - Circles
Output Primitives - Polygon
Properties of the Output Primitives

 How it is displayed:
 Intensity

 Colour

 Style

 Pattern
Geometric Transformation

 Change size, position or orientation:


 translation

 rotation

 scaling

 Altering or Manipulating Display


Transformations
Transformations
Two Dimensional Viewing
 Specify which part of the picture
 whichpart of the picture
 where to put the picture

 Algorithms
 Point Clipping
 Line Clipping

 Polygon Clipping

 Text Clipping
Two Dimensional Viewing
3D Object Representation
 Object Boundaries:
 Plane,

 Curved Surfaces
 Object Interiors:
 Solid Objects:
 Boundary Representation
 Space-partition Representation
3D Object Representation
3D Transformation
 Transformation
 translation, rotation, scaling
 Rotation in 3D
a composite of 3 rotations
 X-axis rotation
3D Transformation
3D Display

 View an object from any spatial position:


front, top etc.
 Projection onto a flat viewing surface.
3D Display
Projection
 Specify a view plane
 Projections
 Parallel

 Perspective

 Projection transformation
 Clipping
Parallel Projection
Perspective Projection
Different Viewing Directions
Changing of Reference Point
3D Surface
 3D Surface Detection:
 Identify
the visible surface
 example: ray-casting method

 Depth Cueing
 the intensity of lines decreases from the front to
the back of the object.
3D Surface Detection
Depth Cueing
Types of Depth Cues
 Stereoscopic display (different image for
different eye)
 Hidden lines/surface removal
 Depth weighting (less intensity for distant
object)
 Illumination (surface lighting)
 Rotation (cine loops)
Surface Illumination
 Surface illumination:
 the intensity of light that we should see.
 Surface rendering algorithm
 calculation of the light based on physical laws.
 Radiosity algorithm: based on the propagation
of radiant energy between the surface and the
source.
Surface Illumination
Shading Techniques
Reflection and Transparency
Radiosity
Lighting Conditions
Colours in Computer Graphics
Colour Models
 Colour Model:
 Themethod for explaining the properties or
behaviour of colour within some particular
context.
 RGB Model:
 based on tristimulus theory
Colour Models
Grey Scale
Logarithmic & Exponential
Colour Translation
Pseudo Colour Display
True Colour Display
3D Display in Nuclear Medicine
Slice-and-Dice Display
 orthogonal slices, oblique slices
Ray Tracing – Volume Rendering
- summed projection, maximum activity projection,
volumeric compositing.
Surface Rendering
 polygon tiling, binary voxel rendering.
Mapping
 Bull’s eye, cylindrical display
Slice-and-Dice
Ray Tracing
Surface Rendering
Volume Rendering
Bull’s Eye Mapping
Clinical Applications in Nuclear
Medicine
 Hot Spot Imaging
 Volume rendering with maximum activity projection
 Cardiac Imaging
 Perfusion imaging(Bull’s eye), surface rendering with colour.
 Functional imaging (oxygen consumption), colouring blood-pool
surface.
 Gated Blood Pool Studies: cine display, surface rendering,
maximum activity projection.
 Brains.
Viewing in 3D
Projections
 Display device (a screen) is 2D…
 How do we map 3D objects to 2D space?

 2D to 2D is straight forward…
 2D window to world.. and a viewport on the 2D surface.
 Clip what won't be shown in the 2D window, and map
the remainder to the viewport.

 3D to 2D is more complicated…
 Solution : Transform 3D objects on to a 2D plane using
projections
Projections
 In 3D…
 View volume in the world
 Projection onto the 2D projection plane
 A viewport to the view surface
 Process…
 1… clip against the view volume,
 2… project to 2D plane, or window,
 3… map to viewport.
Projections
 Conceptual Model of the 3D viewing process
Projections
 Projections: key terms…
 Projection from 3D to 2D is defined by straight projection
rays (projectors) emanating from the 'center of projection',
passing through each point of the object, and intersecting
the 'projection plane' to form a projection.
Types of projections
 2 types of projections
 perspective and parallel.

 Key factor is the center of projection.


 if distance to center of projection is finite : perspective
 if infinite : parallel
Perspective v Parallel
 Perspective:
 visual effect is similar to human visual system...
 has 'perspective foreshortening'
 size of object varies inversely with distance from the center
of projection.
 angles only remain intact for faces parallel to projection
plane.
 Parallel:
 less realistic view because of no foreshortening
 however, parallel lines remain parallel.
 angles only remain intact for faces parallel to projection
plane.
Perspective Projections
 Any parallel lines not parallel to the projection
plane, converge at a vanishing point.
 There are an infinite number of these, 1 for each of the
infinite amount of directions line can be oriented.

 Ifa set of lines are parallel to one of the three


principle axes, the vanishing point is called an
axis vanishing point.
 There are at most 3 such points, corresponding to the
number of axes cut by the projection plane.
Perspective Projections
 Example:
 if z projection plane cuts the z axis: normal to it, so only
z has a principle vanishing point, as x and y are parallel
and have none.

 Can
categorise perspective projections by the
number of principle vanishing points, and the
number of axes the projection plane cuts.
Perspective Projections

2 different examples of a one-point perspective


projection of a cube.
(note: x and y parallel lines do not converge)
Perspective Projections
 Two-point perspective projection:
 This is often used in architectural, engineering
and industrial design drawings.
 Three-point is used less frequently as it adds
little extra realism to that offered by two-point
perspective projection.
Perspective Projections
 Two-point perspective projection:
Perspective Projections
x

Projection plane

x x p (x,y,z)
= s
z+d d ps(xs,ys)
C z
x
xs =
z d
1+
d d
y C z
ys =
z By similar triangles: ps(xs,ys)
1+
d
p (x,y,z)
Projection plane
y
Perspective Projections

 xs   1 0 0 0  x 
    
 ys   0 1 0 0  y 
 0 = . 
  0 0 0 0 z
z   
1 +   0 0 1/ d 1   1 
 d 
 xs 
 
z
 x s  1 + 
   d 
y
 s   ys 
 0  = z 
 z  1 + 
1 +   d 
 d  0 
 1 
 
Parallel Projections
2 principle types:
 orthographic and oblique.

 Orthographic :
 direction of projection = normal to the projection plane.

 Oblique :
 direction of projection != normal to the projection plane.
Parallel Projections
 Orthographic (or orthogonal) projections:
 front elevation, top-elevation and side-elevation.
 all have projection plane perpendicular to a principle axes.

 Useful because angle and distance measurements can


be made...

 However, As only one face of an object is shown, it can


be hard to create a mental image of the object, even
when several view are available.
Parallel Projections
 Orthogonal projections:
Parallel Projections
 Oblique parallel projections
 Objects can be visualised better then with orthographic
projections
 Can measure distances, but not angles*
* Can only measure angles for faces of objects parallel to
the plane
2 common oblique parallel projections:
 Cavalier and Cabinet
Parallel Projections
 Cavalier:
 The direction of the projection makes a 45 degree angle
with the projection plane.
 Because there is no foreshortening, this causes an
exaggeration of the z axes.
Parallel Projections
 Cabinet:
 The direction of the projection makes a 63.4 degree angle
with the projection plane. This results in foreshortening of the
z axis, and provides a more “realistic” view.

Das könnte Ihnen auch gefallen