Representation Of Virtual Objects - PowerPoint PPT Presentation

1 / 38
About This Presentation
Title:

Representation Of Virtual Objects

Description:

Occlusion. Depth of field. Further away objects become hazier ... 6 Redraw image as viewpoint changes applying perspective and occlusion to induce Reality' ... – PowerPoint PPT presentation

Number of Views:130
Avg rating:3.0/5.0
Slides: 39
Provided by: rho2
Category:

less

Transcript and Presenter's Notes

Title: Representation Of Virtual Objects


1
Representation Of Virtual Objects
2
2D v 3D
  • Computer screen 2D
  • Virtual environment 3D
  • Map 3D to 2D
  • Movement of objects is in 3 dimensional space
  • High processing power

3
What Makes a Picture 3-D?
  • Requires many more lines and angles to produce 3D
  • Must be able to define the lines and calculate
    which are visible as viewpoint changes to show
    motion
  • Colour, size and clarity of image indicate where
    shape is in relation to viewer

4
Steps to create a 3D scene
  • Creating a virtual 3-D world by defining a
    heirarchy of objects
  • Determining what part of the world will be shown
    on the screen.
  • Determining how every pixel on the screen will
    look so that the whole image appears as realistic
    as possible.

5
View the scene from one point
6
Another view
7
Inducing reality
  • Define the shapes so that they can be seen in
    motion 3D
  • Apply a surface texture
  • Show perspective
  • Lighting
  • Blurring the edges

8
A simple shape
Defined as a set of points or Vertices With
surfaces or facets defined by spline boundaries
created by joining points with lines
9
More complex shapes
  • Shape defined as polygons(triangles)
  • Rounded surfaces created by more polygons

10
Defining the surface
  • Colour
  • variation over surface
  • Texture
  • rough, smooth, etc
  • Lighting
  • creates shadowing
  • Reflectance
  • dependant on texture and colour

11
Realism added by surface mapping
12
Lighting and reflectance
  • Exhibits shadowing and shading
  • Gouraud shading
  • Ray-tracing used to calculate light paths based
    on reflectance values

13
Perspective and Z-buffering
  • Objects appear smaller further away
  • Zero-point
  • Uses Z co-ordinate to compute
  • Relative position
  • Occlusion

14
Depth of field
  • Further away objects become hazier
  • Focus attention on nearer objects
  • Occurs naturally but must be added to virtual
    environment

15
Anti-aliasing
  • Sharp contrast unreal
  • Curved lines - stepped
  • Edges blurred removing stepping
  • More natural

16
Basic Analysis
  • 1 Define points in 3D space
  • 2 Define lines and Facets which join points
    together
  • 3 Apply texture to facets
  • 4 Define reflectance properties and colour of
    surface
  • 5 Define light sources to generate shadows and
    shading
  • 6 Redraw image as viewpoint changes applying
    perspective and occlusion to induce Reality

17
Definition of a vertex in 2D
  • Distance Between Two Points
  • The distance between two points ltAx,Aygt and
    ltBx,By gt can be found using the pythagorus
    theorem
  • dx Ax-Bx
  • dy Ay-By
  • distance sqrt(dxdx dydy)

18
A vector
  • Vectors themselves can be added by adding each of
    their components
  • or they can be multiplied (scaled) by multiplying
    each component by some constant k (where k ltgt 0).

19
2D Vectors
  • Vectors can be
  • added
  • multiplied
  • scaled
  • To calculate the length of a vector we simply
    calculate the distance between the origin and the
    point at ltx,ygt
  • length ltx,ygt - lt0,0gt
  • sqrt( (x-0)(x-0) (y-0)(y-0) )
  • sqrt(xx yy)

20
Definition of a 2D Line
  • First we can imagine a line as having 2 endpoints
    in 2D space
  • P1ltx1,y1gt and
  • P2ltx2,y2gt.
  • Alternatively we can imagine the line as having
    an origin (starting point) and a direction
    (vector)
  • Origin ltXo, Yo gt
  • Direction ltXd, Yd gt
  • we can assume that the line's origin is at one
    endpoint and it's direction is the difference
    between both endpoints
  • Origin P1 ltx1, y1 gt
  • Direction P2-P1 ltx2-x1, y2-y1gt
  • ltx,ygt ltxo, yogt k ltxd, ydgt

21
Definition of a 3D Point
  • A point is similar to it's 2D counterpart, we
    simply add an extra component, Z, for the 3rd
    axis
  • Points are now represented with 3 numbers
    ltx,y,zgt.
  • Left-hand rule

22
Distance Between Two 3D Points
  • The distance between two points ltAx,Ay,Azgt and
    ltBx,By,Bzgt can be found by again using the
    pythagorus theorem
  • dx Ax-Bx
  • dy Ay-By
  • dz Az-Bz
  • distance sqrt(dxdx dydy dzdz)

23
Definition of a 3D Vector
  • Either a point at ltx,y,zgt or a line going from
    the origin lt0,0,0gt to the point ltx,y,zgt.
  • 3D Vector addition and subtraction is virtually
    identical to the 2D case. You can add a 3D vector
    ltvx,vy,vzgt to a 3D point ltx,y,zgt to get the new
    point ltx',y',z'gt like so
  • x' x vx
  • y' y vy
  • z' z vz

24
  • Vectors themselves can be added by adding each of
    their components, or they can be multiplied
    (scaled) by multiplying each component by some
    constant k (where k ltgt 0)
  • To calculate the length of a vector we simply
    calculate the distance between the origin and the
    point at ltx,y,zgt
  • length ltx,y,zgt - lt0,0,0gt
  • sqrt( (x-0)(x-0) (y-0)(y-0)
    (z-0)(z-0) )
  • sqrt(xx yy zz)

25
Definition of Object
26
Translation
Three degrees of Freedom in x, y, and z plane
27
Six degrees of freedom
3 degrees of freedom correspond to the
rotational movement about each of the axes Pitch
Roll Yaw
28
Scaling
Multiply one or more components of the line
vectors
29
MatricesA Point in Space
  • x
  • y
  • z
  • w lt- w1
  • a point or vector can be represented in 3D space
    as ltx,y,zgt. When using matrix maths it helps to
    represent it as ltx,y,z,wgt.

30
Modifying the Position of a Point
  • Modifying the Position of a Point
  • Let's say we want to take any point ltx,y,z,wgt
    given and do something to it to get a new point.
    A row vector can be used to represent how we want
    to change a point
  • These values                      x
  • contain the                       y       
    This is our
  • info on how we ----gt A B C D  . z   lt---
    point in 3D
  • want to change                    w       
    space
  • the point
  • To figure out how the row vector A B C D
    changes a point, we can visualize lying the
    point's column vector on it's side on top of it
    like this
  • x  y  z  w
  • A  B  C  D      (x A) (y B) (z C)
    (w D)

31
  • Let's say we want to be able to take any point
    ltx,y,z,wgt and figure out the coordinates for the
    point ltx',y',z',1gt which is exactly 4 units to
    the "right" of it, ie the point which is 4 units
    further along the x axis. We can do this by using
    4 row vectors. The first one will calculate the
    new x point (x'), the next one the new y point
    (y') and so on.
  • First let's look at calculating x'.
  • We know that the new x point can be calculated
    like this x' x 4, so a row vector to
    calculate this would be
  •                      1  0  0  4
  • i.e. when we multiply this out by a point
    ltx,y,z,wgt we'll get
  • (x 1) (y 0) (z 0) (w 4) x 4

32
  • We also know that y' y, z' z and w 1, so we
    can calculate the row vectors for each of the
    other values, and stack them all on top of each
    other
  • x row vector ----gt    1  0  0  4     x'1x
    0y 0z 4 x 4
  • y row vector ----gt    0  1  0  0     x'0x
    1y 0z 0 y
  • z row vector ----gt    0  0  1  0     x'0x
    0y 1z 0 z
  • 1 row vector ----gt    0  0  0  1     x'0x
    0y 0z 1 1

33
  • To take a point ltx,y,z,wgt and calculate the new
    point we just mutiply the point by each of the
    row vectors.
  • Here's a more generic representation of what we
    are doing
  • x'         M11  M12  M13 M14     x
  • y'        M21  M22  M23  M24     y
  • z'         M31  M32  M33  M34     z
  • w'         M41  M42  M43  M44     w
  • In this case ltx,y,z,wgt is the point we are
    popping in, ltx',y',z',w'gt is the point we'll be
    getting out, and each number in the matrix is
    represented by Mij, where i row number and j
    column number.

34
  • x' (x M11) (y M12) (z M13) M14
  • y' (x M21) (y M22) (z M23) M24
  • z' (x M31) (y M32) (z M33) M34
  • w' (x M41) (y M42) (z M43) M44

35
  •   1    0    0    0             x' x
  •   0    1    0    0             y' y
  •   0    0    1    0             z' z
  •   0    0    0    1

36
  • Translation
  • A translation is simply adding (or subtracting) a
    point to any given point. Let's say you want to
    add TX to x, TY to y and TZ to z. The matrix to
    do this is
  •   1    0    0    tx             x' x tx
  •   0    1    0    ty             y' y ty
  •   0    0    1    tz             z' z tz
  •   0    0    0    1 
  • Scaling
  • Sometimes we may need to scale a point, ie
    mutiply each axis by a given number. This is
    handy for things like zoom effects.
  •   sx   0    0    0             x' sx x
  •   0    sy   0    0             y' sy y
  •   0    0    sz   0             z' sz tz
  •   0    0    0    1
  • Of course, if you only want to scale along the X
    axis (say) then you simply set SX to the scale
    value and set SY and SZ to 1.

37
  • Basic Rotations
  • Things start getting a wee bit tricky here. For
    starters we can rotate things around the x axis,
    the y axis, or the z axis. Notice how each axis
    forms a line in 3D space? Well we can also rotate
    things around any arbitrary line. This is handy
    if we want to do effects like objects rotating
    about their own axis.
  • The matrix for rotating around the x axis by
    angle é is
  •   1      0      0     0             x'
    x
  •   0    cos é  -sin é  0             y' (cos
    é) y - (sin é) z
  •   0    sin é   cos é  0             z' (sin
    é) y (cos é) z
  •   0      0      0     1
  • The matrix for rotating around the y axis by
    angle é is
  •   cos é   0    sin é   0            x' (cos
    é) x (sin é) z
  •     0     1     0      0             y'
    y
  •   -sin é  0    cos é   0             z' -(sin
    é) x (cos é) z
  •     0      0    0      1
  • And the matrix for rotating around the zaxis by
    angle é is

38
Underlying geometry
  • Vertices
  • Lines
  • Faces
  • Transforms
Write a Comment
User Comments (0)
About PowerShow.com