Previous Lab REVIEW - PowerPoint PPT Presentation

1 / 60
About This Presentation
Title:

Previous Lab REVIEW

Description:

Depth Cues. Perspective and Depth of Field ... aperture size: field of view. IMAGE SYNTHESIS GROUP - TRINITY COLLEGE ... field of view (q, f) projection ... – PowerPoint PPT presentation

Number of Views:18
Avg rating:3.0/5.0
Slides: 61
Provided by: johndin
Category:
Tags: review | lab | previous

less

Transcript and Presenter's Notes

Title: Previous Lab REVIEW


1
Previous Lab REVIEW
  • 2 Basic Goals
  • Draw a vector object
  • Transform Vector Objects
  • Translate
  • Scale
  • Rotate
  • Organise Your Transformations Correctly
  • Composite Transforms

2
DRAWING VECTOR OBJECT
  • for all EDGES in EDGELIST
  • Get Vertex1Index and Vertex2Index from EDGE
  • Get Vertex1 from VERTLISTVertIndex2
  • Get Vertex2 from VERTLISTVertIndex2
  • Get (x1, y1) from Vertex1.x Vertex1.y
  • Get (x2, y2) from Vertex2.x Vertex2.y
  • drawLine(x1, y1, x2, y2)

3
TRANSFORMING POINTS
  • Get a (valid) transform matrix M
  • Transformed point Q is obtained from original
    point P as follows
  • Q MP
  • e.g. P (10, 10), M i.e.
    translate by (20, 20)
  • Then Q MP

4
Transforming Vector Objects
  • Get a (valid) transform matrix M
  • For every EDGE in EDGELIST
  • Get Vertex1, Vertex2 (as before), lets call them
    p1 and p2
  • Apply Transformation to p1 and p2 to get
    transformed points q1Mp1, q2Mp2
  • Get (x1, y1) from q1, (x2, y2) from q2
  • drawLine(x1, y1, x2, y2)

5
COMPOSITE TRANSFORMATIONS
  • Get a (valid) transform matrix M1
  • Get a (valid) transform matrix M2
  • Get a (valid) transform matrix M3
  • etc
  • Composition is achieved by multiplying in reverse
    order of how you want them to happen
  • MNEW M3M2M1
  • Use MNEW the same way you used any other
    Transformation by multiplying it with points

6
3D Concepts
7
Three-dimensional Graphics
  • 3D computer graphics involves the additional
    dimension of depth, allowing us to make more
    realistic and higher fidelity representations of
    3D objects in the real world
  • Paradoxically in most cases this is still
    represented in 2D output devices utilising
    techniques to render these objects with the
    illusion of depth
  • 3D Graphics is characterised more by the 3D
    nature of the Models (input into rendering)
    rather than the final display (output) modeling
    world

8
3D Coordinate Systems
  • We add a third dimension to our real-world or
    modeling coordinate system by adding a z-axis to
    our 2D system
  • There are two possible ways of attaching the
    Z-axis
  • This gives rise to a left-handed or a
    right-handed system.
  • Imagine that the thumb and finger of each hand is
    the x and y axis resp. The direction of your
    middle finger shows the direction of the z-axis
    in each system

9
y
y
z
(1,-1,1)
(1,-1,-1)
x
x
Right Handed
Left Handed
z
The Right-handed system is the most commonly used.
10
Three Dimensional Issues
  • More Complicated Objects than 2D
  • bounded by planes and curved surfaces
  • have internal/external components
  • More involved geometric transformations
  • Viewing transformations much more complicated
  • Projection onto a two dimensional output display
    (usually)
  • Identification of Visible Surfaces

11
3D Display Methods
  • Two dimensional output device
  • projection orthographic/perspective
  • depth cueing
  • visible line/surface identification
  • surface rendering
  • exploded/cutaway scenes, cross-sections
  • Three-dimensional output
  • Stereoscopic displays
  • Holograms

12
Three Dimensional Concepts
  • 3D viewing positions
  • projection
  • depth cueing
  • visible line and visible surface identification
  • surface rendering
  • three-dimensional views/ stereoscopic views

13
Camera Positioning
Different views of a 3D model
14
Projection
Representing three dimensions on two dimensional
media by Projection
15
Albrecht Dürer (1471-1528).
16
Depth Cues
Shadows as depth cues
Perspective and Depth of Field
17
Surface Rendering
Light and shadow colour of diferent parts of an
object suggest its three -dimensional nature
18
Exploded/cutaway scenes
19
3D GRAPHICS PIPELINE
WORLD SCENE/OBJECT
Modelling coordinates - world coordinate system,
- object coordinate system
3D MODELLING
VIEWING
3D CLIPPING
Camera coordinates
PROJECTION
Screen/Window coordinates
RASTERIZATION
Device coordinates
2D PIXELMAP DISPLAY
20
Modelling
Polygonal
Implicit
3D Modelling
Particles
Parametric
21
Clipping 3D
view frustrum
outside view so must be clipped
22
Viewing and Projection
3d models
camera setup
viewport
23
Rasterization
24
3D Modelling
  • Two Broad categories of representation of Solids
  • Boundary Representations (B-reps) describe
    objects as a set of surfaces that separate the
    object interior from the environment
  • Space Partitioning representations describe the
    object as a set of small, non-overlapping
    contiguous solids
  • Polygonal Representations
  • Constructive Solid Geometry

25
Representation Schemes
  • Surface
  • Polygon meshes/Polygon Tables
  • Plane Equations
  • Parametric Surfaces
  • Implicit Surface
  • Volume
  • Voxel arrays
  • Octrees

26
3D Modelling
Polygonal Representation
Tessellation or polygonisation
B-rep or boundary representation model
Geometry defined by the sub-space bounded by sets
of planes and surfaces.
27
3D Modelling
Volumetric model.
CSG - constructive solid geometry
3D Object is a collection of volume elements or
voxels which flag spatial occupancy in a discrete
region.
3D Objects defined as boolean operations on solid
primitives.
28
3D Modeling with Polygons
  • We construct 3D models using groups of polygons.
  • Each polygon is planar ? we need a large number
    of small polygons to give the impression of
    curved surfaces

48 polygons
120 polygons
300 polygons
1000 polygons
29
Polygon Mesh
30
Polygon Mesh
31
CSG by boolean operations
32
CSG Tree
33
Octree
Quadtree
Partially occupied (further decomposition
required)
34
3D Matrix Transformations
  • The translation, scaling and rotation
    transformations used for 2D can be extended to
    three dimensions
  • Again, using homogeneous coordinates it is
    possible to represent each type of transformation
    in a matrix form
  • In 3D, each transformation is represented by a
    4x4 matrix

35
3D Scaling and Translation
The elementary Affine Transformations of
translation and scaling may now be represented in
3D as follows
Translation
SX 0 0 0 0 SY 0 0 0 0 SZ
0 0 0 0 1
)
(
Scaling
36
Rotation
  • In 2D, the only rotation possible was about the
    origin.
  • In 3D, there are 3 possible rotations, one about
    each of the x, y and z axes
  • Positive rotations are anti-clockwise, negative
    rotations are clockwise, when looking down a
    positive axis towards the origin

y
x
z
37
Major Axis Rotation Matrices
  • X axis rotation
  • Y Axis Rotation
  • Z Axis Rotation

38
Rotation about Arbitrary Axes
  • We obtain the relevant transformation matrix by
    composition of rotations about the major axes

Rotate about y axis by to align vector with
yz plane
Rotate about x axis by to align vector with
xy plane
y
a
b
y
x
a
b
z
z
39
Rotation about Arbitrary Axes
y
N(nx, ny, nz)
x
b
z
a
d
40
3D Viewing
  • Inherently more complex than 2D process
  • Part of the difficulty lies in trying to display
    three dimensional objects on a 2D display
  • Different views on the same object eventually
    lead to different 2D representations at the
    projection stage
  • the projected 2D image of a 3D object is viewer
    dependent
  • Different views can be specified based on several
    parameters e.g. position, orientation, field of
    view

41
Different Views
42
The Viewing Process
  • To create a view of a scene we need
  • a description of the scene geometry
  • a view definition (camera)
  • We need to transform the 3D objects onto a 2D
    plane
  • A real-world window is defined on this plane
  • This window is then mapped to the viewport as in
    2D viewing
  • The camera definition allows projection of the 3D
    scene geometry onto a 2D surface for display.

43
Camera Analogy
  • View described in terms of
  • camera location position in world co-ordinate
    system
  • direction in which we are aiming the camera
    viewing direction
  • orientation of the camera usually defined by the
    up vector
  • aperture size field of view

44
Viewing Coordinates
  • Often useful to look at the model in terms of the
    Viewing Co-ordinate system defined by the viewing
    parameters defined by
  • View Reference Point (VRP) origin of our viewing
    system (position of the camera)
  • View Plane Normal vector (VPN) viewing
    direction)
  • View UP vector (VUP) establishes orientation of
    camera

Three mutually orthogonal basis vectors
45
3D Viewing Transformation
  • Based on these vectors and the Viewing Reference
    Point (x0, y0, z0) the Viewing Transformation can
    be defined by composition of the following two
    transformations

This is used to determine the location of each
vertex in the camera co-ordinate system
46
Viewing Transformation
  • We might also achieve this in terms of the
    following transformation sequence
  • Translate the view reference point to the origin
    of the world co-ordinate system
  • Apply Rotations to align xv, yv and zv, axes,
    respectively

(x0, y0, z0)
47
Projections
  • After a view has been defined we need to project
    onto a 2D Viewplane
  • The projections used to display 3D objects in 2D
    are called Planar Geometric Projections
  • For computer graphics, the main types of
    projection used are
  • Perspective Projection defined by a Centre Of
    Projection (COP) and a projection plane
  • Parallel Projections defined by a Direction Of
    Projection and a projection plane

48
Parallel Projections
  • Classified as orthographic or oblique
  • The DOP makes 2 angles with the projection plane
  • Orthographic means DOP is perpendicular to the
    projection plane, I.e. both angles are 90 degrees
  • Oblique means DOP not perpendicular, I.e. one or
    both angles are not equal to 90 degrees.

49
Parallel Projections
orthographic
oblique
isometric
axonometric
50
Parallel Projections
  • The simplest of all projections, parallel project
    onto view-plane.
  • Usually view-plane is axis aligned (often at z0)

51
Parallel Projections
  • The result is an orthographic projection if the
    object is axis aligned, otherwise it is an
    axonometric projection.
  • If the projection plane intersects the principle
    axes at the same distance from the origin the
    projection is isometric.

52
Parallel Projection
53
General Parallel Projection
  • Orthographic projections d0
  • Although we can use any a, f, there are some
    common values for the angles
  • If tan a1 cavalier projection (all lengths along
    major axis are preserved) Cavalier
  • If tan a2 all z-axis lengths are halved
    (slightly more realistic) we have a
    CabinetProjection
  • Common values for f are 30º or 45º which display
    a combination view of front, side and top (or
    front, side and bottom)

54
Oblique Projections
D/2
D
D
Cabinet Projection
Cavalier Project
55
Perspective Projection
  • Perspective projections produce a perspective
    foreshortening effect
  • They tend, therefore, to appear more realistic
    that parallel projections
  • Parallel lines in the 3D model which are not
    parallel to the projection plane, converge to a
    vanishing point

56
Perspective Projections
  • If the vanishing point lies on a principle axis,
    it is called a principle vanishing point
  • The number of principal vanishing points is
    determined by the number of principal axes cut by
    the projection plane.
  • If the plane only cut the z axis (most common),
    there is only 1 vanishing point.
  • 2-points sometimes used in architecture and
    engineering. 3-points seldom used add little
    extra realism

57
Perspective Projections
3-point perspective
1-point perspective
2-point perspective
58
Perspective Projections
  • Parameters
  • centre of projection (COP)
  • field of view (q, f)
  • projection direction
  • up direction

59
Perspective Projections
Consider a perspective projection with the
viewpoint at the origin and a viewing direction
oriented along the positive -z axis and
the view-plane located at z -d
a similar construction for xp ?
d
y
yp
-z
divide by homogenous ordinate to map back to 3D
space
60
Perspective Projection Details
Flip z to transform to a left handed
co-ordinate system ? increasing z values mean
increasing distance from the viewer.
Write a Comment
User Comments (0)
About PowerShow.com