Advanced Game Engineering RealTime Rendering - PowerPoint PPT Presentation

1 / 24
About This Presentation
Title:

Advanced Game Engineering RealTime Rendering

Description:

Advanced Game Engineering. Advanced Game Engineering. Real-Time Rendering & Transforms ... ??? ??? ???(Ambient), ???(diffuse), ????(specular)? ??? ?? ... – PowerPoint PPT presentation

Number of Views:67
Avg rating:3.0/5.0
Slides: 25
Provided by: eclInc
Category:

less

Transcript and Presenter's Notes

Title: Advanced Game Engineering RealTime Rendering


1
Advanced Game EngineeringReal-Time Rendering
Transforms
  • ???
  • 2006/03/29
  • Dept. of Itis, Univ. of Incheon
  • icuuibs_at_hotmail.com

2
Contents
  • 3. Transforms
  • 3. 5 Projections
  • 3.5.1 - Orthographic Projection
  • 3.5.2 - Perspective Projection.
  • 4. Visual Appearance
  • 4. 1 Light Sources

3
Orthographic Projection
  • Orthographic Projection
  • Orthographic projection? ??
  • ??? Parallel lines ??? Parallel lines
  • (3.59) ?? P0? x,y ??? ??? ??,
  • z??? 0?? ???? simple Orthographic projection
    matrix

4
Orthographic Projection
5
Orthographic Projection
  • ??
  • Clearly,p0 is noninvertible, since its
    determinant po 0
  • In order words , The transform drops from three
    to two dimensions,
  • And there is no way to retrieve the dropped
    dimension
  • Problem
  • A problem with using this kind of orthographic
    projection for viewing is that it projects both
    points with positive and points with negative
    z-values onto the projection plane
  • ?? ??-Useful ways
  • It is usually useful to restrict the z-values(
    and the x- and y- values) to a certain interval
    from, say n (near plane) to f (far plane).
  • This is the purpose of the next transformation.

6
Orthographic Projection
  • A more common matrix for performing orthographic
    projection is expressd in terms of the six
    tuple, (l,r,b,t,n,f)
  • This matrix Essentially scales and translates the
    AABB(axis aligned bounding boxing see the
    definition in Section 13.2) formed by these
    planes into an axis-aligned cube centered around
    the origin
  • They minimum corner of the AABB is (l,b,n) and
    the maximum corner (r,t,f)
  • The axis-aligned cube has a minimum corner
    of(-1,-1,-1) and a maximum corner of (1,1,1,) .
  • This cube is called the canonical view volume(??
    ?? ??)
  • the coordinates in this volume are called
    normalized device coordinates
  • The transformation procedure is shown in Figure
    3.14

7
Orthographic Projection
8
Orthographic Projection
  • The reason for transforming into the canonical
    view volume is that clipping is more efficiently
    performed there, especially in the case of a
    hardware implementation
  • After the transformation into the canonical view
    volume, vertices of the geometry to be rendered
    are clipped against this cube.
  • This orthographic transform is shown next page.

9
Orthographic Projection
10
Orthographic Projection
  • As suggested b the above equation, p0 can be
    written as the concatenation of a translation,
    T(t), followed by a scaling matrix, S(s), where
    s (2/(r-l),2/(t-b),2/(f-n)), and t
    (-t1)/2,-(tb)2,-(fn)/20. this matrix in
    invertible
  • Po-1T(-t)S((r-l)/2,(t-b)/2,(f-n)/2)
  • In computer graphics, a left-hand coordinate
    system is most often used after projection
  • Because the far value is less than the near value
    for the way we defined our AABB. The orthographic
    transform will always include a mirroring
    transform.
  • The AABBs coordinates are (-1 ,-1, 1) for
    (l,b,n) and (1,1,-1)

11
Orthographic Projection
  • Before page matrix is a mirroring matrix.
  • the right-handed viewing coordinate -gtleft handed
    normalized device coordinates.
  • Some systems, such as DirectX, also map the
    z-depths to the range 0,1
  • Instead of-1,1.
  • This can be accomplished by applying a simple
    scaling and translation matrix applied after the
    orthographic matrix, that is

12
Orthographic Projection
  • So the orthographic matrix used in DirectX is
  • Which is normally presented in transposed form.
    As DirectX uses a row-major form for writing
    matrices

13
Perspective Projection
  • Perspective projection is used in the majority of
    computer graphics applications,
  • Here, parallel lines are generally not parallel
    after projection rather, they may converge to a
    single point at their extreme
  • Perspective more closely matches how we perceive
    the world, i.e., object further away are smaller

14
Perspective Projection
  • Assume that the camera (viewpoint) is located at
    the origin, and that we want to project a point
    ,P, onto the plane z-d, dgt0, yielding a new
    point q(qz,qy,-d).
  • This scenario is depicted in Figure 3.15.

15
Perspective Projection
  • From the similar triangles shown in this figure,
    the following derivation, for the x-component of
    q, is obtained
  • The expressions for the other components of q are
    qy-dpy/pz (obtained similarly to qx) , and
    qz-d.
  • Together with the above formula, these give us
    the perspective projection matrix, Pp, as shown
    here

16
Perspective Projection
  • That this matrix yields the correct perspective
    projection is confirmed by the simple
    verification of Equation 3.66
  • The last step comes from the fact that the whole
    vector is divided by the w-component (in this
    case pz/d), In order to get a 1 in the last
    position.
  • The resulting z value is always d since we are
    projecting onto this plane.
  • Intuitively ,it is easy to understand why
    homogeneous allow for coordinates for projection

17
Perspective Projection
  • One geometrical transformation, there is also a
    perspective transform that, rather than actually
    projecting onto a plane (which is noninvertible)
    , transforms the view frustum into the canonical
    view volume described previously.
  • Here the view frustum is assumed to start at zn
    and end at zf , with 0gtngtf The rectangle at z
    n has the minimum corner at (l,b,n) and the
    maximum corner at (r,t,n) this shown in Figure
    3.16

18
Perspective Projection
  • The parameters (l,r,b,t,n,f) determine the view
    frustum of the camera
  • The greater the field of view , the more the
    camera sees.
  • The field of view is an important factor in
    providing a sense of the scene
  • The eye itself has a physical field of view
    compared to the computer screen
  • This relationship is

19
Perspective Projection
  • The perspective Transform matrix that transforms
    the frustum into a unit cube is given by Equation
    3.68
  • After applying this transform to a point , we
    will get another point q (qx,qy,qz,qw)T .
  • The w-component, qw , of this point will (most
    often) be nonzero and not equal to one.

20
Perspective Projection
  • To get the perspective transform used in OpenGl,
    first multiply with S(1,1,-1)
  • Some APIs (e.g. DirectX) map the near to z 0 and
    the far plane to z 1

21
Light Sources
  • ??? ?? ??
  • Photon(??)?? ??? ???? ????? ?? ?????? ???? ???
    ??
  • ?? ??(directional light), ? ??(point light),
    ?????? (spot light)

22
Light Sources
  • point light? spot light? ?? ??? ??? ????
    Positional light
  • Figure 4.2, the three different light source
    light source types illuminate a square

23
Light Sources
  • 3?? ?? ?? ???? ?? ?? ??? ??
  • ??? RGB? ??
  • ??? ??? ???(Ambient), ???(diffuse),
    ????(specular)? ??? ??
  • Table 4.1? OpenGl? DirectX?? ???? ??? ?? ????
    ????

24
Light Sources
  • Spotlight
  • direction vector(?? ??) ?????? sdir
  • Cut-off? Scut ??? spotlight ?? ??? ??
  • ??? ????? ?????? Spot exponent ? sexp ?? ??
Write a Comment
User Comments (0)
About PowerShow.com