Game Engine Design Ch

Document Sample
Game Engine Design Ch Powered By Docstoc
					     3D Game Engine Design
           Ch. 2.5.

                        3D MAP LAB




3D Game Engine Design                1
   2.5. Standard 3D Objects
      Useful as bounding regions for
          Rapid culling in the rendering process
          Rapid determining of the collision
           detection of two objects
      Primitives
          Spheres
          Oriented Boxes
          Capsules, Lozenges
          Ellipsoids and etc.

3D Game Engine Design                               2
                        Spheres
      Center Point and Radius with points

      Sphere Containing Axis-Aligned Box
          Compute the minimum-volume axis-
           aligned bounding box
          Select the smallest enclosing sphere of
           the box with centered at the box center
          Rapid, but not as good a fit.


3D Game Engine Design                                3
                  Spheres (cont’d)
      Sphere Centered at Average of Points
          Sphere Center : Average of Points
          Sphere Radius : Smallest value from
           center to points enclosing all points
          2x Iteration than Axis-Aligned box method
      Minimum-Volume Sphere (Welzl 91)
          Uses a randomized linear algorithm
          Maintain a set of supporting points( lying
           on the sphere) while processing the input
           point set at a time.
3D Game Engine Design                                   4
                Oriented Boxes
      Oriented Box
          Provide a better fit than spheres
          Defined by
            A center
            3 Orthonormal Axes         for
            3 extents of Axes
            , points inside or on the box
            Orthonormal matrix
                           where
3D Game Engine Design                          5
         Oriented Boxes (cont’d)
      Axis-Aligned Box
          Find the extreme points      and
      Fitting with a Gaussian Distribution
          Gaussian Distribution

              : mean of the distribution
              : the covariance matrix of the
           distribution
          Fitting points with anisotropic gaussian
           distribution
3D Game Engine Design                                 6
         Oriented Boxes (cont’d)
      Fitting with a Gaussian Distribution



          Axes of the box : unit-length eigenvectors
           of covariance matrix M
          Extents :




3D Game Engine Design                                   7
         Oriented Boxes (cont’d)
      Minimum-Volume Box
          Best-fitting box : the minimum volume
           containing the points
          Iterative scheme for a minimization
            For any coordinate axes      , points are
              projected onto the axes
            The values :




3D Game Engine Design                                    8
          Oriented Boxes (cont’d)
     Iterative Minimization for M-V Box
         Center of the minimum-volume box

         Extents of the minimum-volume box

         Selection of coordinate axes
                 : unit length vector and an
               angle
             The volume of Box :
             Find          that minimizes the volume

3D Game Engine Design                                   9
          Oriented Boxes (cont’d)
   Fitting Triangles with Gaussian Distribution
       Data points : vertices of a triangle mesh
       Fit of an oriented box to the convex hull of the
        vertices
        triangles , i-th triangle
       Triangle and its interior

       Mean point of the convex hull



3D Game Engine Design                                      10
          Oriented Boxes (cont’d)
   Fitting Triangles with Gaussian Distribution
       Covariance matrix of the convex hull



       Axes of Oriented Box :
         unit length eigenvectors   of M
       Extents of Oriented Box :




3D Game Engine Design                              11
                        Capsules
       Capsule
           The set of all points that are distant
            from a line segment with end point
            and direction
           Shape : a cylinder that has 2
            hemispherical caps at the end points
       Least square fitting
           Line fitting :      , where average of
            the data points and unit-length
            direction vector
                to be the maximum distance from
            the data points to Line
3D Game Engine Design                                12
                  Capsules (cont’d)
       Least Square Fitting
           Select unit axes vectors        and set
            Data points
           Find the domain of             for the 2
            hemisphere at end

           Find the largest  so that all points lie
            above the hemisphere



3D Game Engine Design                                  13
                  Capsules (cont’d)
       Least Square Fitting
           Find the smallest  so that all points lie
            below the hemisphere

           End points :
       Minimum of minimum-Area Projected
        Circles
           Projection of points onto the Plane
           Compute the minimum-area circle of
            projected points and find       and
3D Game Engine Design                                   14
                        Lozenges
       Lozenges
           Set of all points that are distant
            from a rectangle with origin and edge
            directions
           Shape : an oriented rectangle with
             Attached 4 half-cylinder sides
             4 quarter-spherical corners




3D Game Engine Design                               15
                        Lozenges
       Fitting with a Gaussian Distribution
           Compute the mean       of the points and
            the covariance matrix M
           Unit-length eigenvectors of the M :
           Data points :
           Data points are bounded by 2 planes

           Lozenge radius :


3D Game Engine Design                                  16
                 Lozenges (cont’d)
       Fitting with a Gaussian Distribution
           Lozenge edge              : end of the
            hemicylinder
           Find the Lozenge edge
             Analogous to the fitting by 3D capsule
             2D capsule containing


               The largest  so that all points lie
                above the hemicircle


3D Game Engine Design                                  17
                 Lozenges (cont’d)
       Fitting with a Gaussian Distribution
           Find the Lozenge edge
             The smallest     so that all points lie
               below the hemicircle

           The Lozenge edge




3D Game Engine Design                                   18
                        Cylinders
       Cylinder
           A distance         from a line
       Least Squares Line Contains Axis
               Fit the points by a line using the least-
                square algorithm
                       , where      average of the data
                points and unit-length direction vector
               Select unit axes vectors          and set
                Data points

3D Game Engine Design                                       19
                 Cylinders (cont’d)
       Least Squares Line Contains Axis
           Cylinder radius :
           Cylinder height :
           Modified Axis


       Least Squares Line Moved to a
        Minimum-Area Center
           Minimum-area circle containing   is
            computed and has center

3D Game Engine Design                             20
                        Ellipsoids
       Ellipsoid
           Center
           Orthonormal axis directions
           The ellipsoid with center and axes




3D Game Engine Design                            21
                 Ellipsoids (cont’d)
        Axis-Aligned Ellipsoid
            Firstly generate the axis-aligned box
             containing the points
                           be the vectors of the
                min/max box components
            Compute the ratios of semi-axis lengths

            Semi-Axis Lengths



3D Game Engine Design                                  22
                 Ellipsoids (cont’d)
     Fitting Points with a Gaussian Distribution
         Similar to the case of an oriented box
         Center of the ellipsoid : the mean of points
         Axes : eigenvectors of the covariance matrix
         Semi-Axis Lengths : eignevalues




3D Game Engine Design                                    23
                 Ellipsoids (cont’d)
       Minimum-Volume Ellipsoid
           Random Linear Techniques (Welzl 91)
           Constrained numerical minimization
             Difficult to implement
             Not possible for real-time apps.




3D Game Engine Design                             24

				
DOCUMENT INFO
Shared By:
Categories:
Stats:
views:62
posted:5/28/2011
language:English
pages:24