Javier Gonzalez-Sanchez | SER431 | Fall 2018 | 3 jgs Think about this § A class Mesh All data is here § A class Renderer Render a mesh object with and without textures, normals, etc. Render a mesh object and visualize its AABB or its normal lines. § What about textures? § Where do we do collision detection?
Javier Gonzalez-Sanchez | SER431 | Fall 2018 | 5 jgs Primitives as Bounding Volumes § Simple primitives are used as bounding volumes for more complex objects § Bounding volumes can be used for approximate intersection tests: § If the bounding volumes of two objects do not intersect à the objects themselves do not intersect. § If the bounding volumes of two objects overlap then maybe there is an intersection maybe not
Javier Gonzalez-Sanchez | SER431 | Fall 2018 | 6 jgs Bounding Volumes § Axis-aligned Bounding Box (AABB) The planes of the box are aligned with the world coordinates § Object-oriented Bounding Box (OBB) The planes are aligned to enclose the object as close as possible Minimum Volume bounding boxes
Javier Gonzalez-Sanchez | SER431 | Fall 2018 | 8 jgs §Axis-aligned Bounding Box (AABB) § An AABB is defined by its minimal and maximal positions in space Pmin=(xmin, ymin, zmin), Pmax = (xmax, ymax, zmax) § Calculate Initialize pmin to +infinite or the first vertex Initialize pmax to –infinite or the first vertex foreach vertex p do { if (p.x < pmin.x) then pmin.x = p.x if (p.y < pmin.y) then pmin.y = p.y if (p.z > pmax.z) then pmax.z = p.z }
Javier Gonzalez-Sanchez | SER431 | Fall 2018 | 10 jgs Intersection Computations (AABB) § Compare min and max in X, Y and Z directions § If all of them intersect, then the object intersects
Javier Gonzalez-Sanchez | SER431 | Fall 2018 | 12 jgs Updating AABB § Translation invariant ✘ Any other kind of movements, box no longer remains axis-aligned ✘ Needs to be recomputed frame by frame § Very simple computation
Javier Gonzalez-Sanchez | SER431 | Fall 2018 | 13 jgs Hierarchical Bounding Volumes § At the bottom of such a hierarchy a primitive of one type bounds another § For instance, using axis aligned bounding boxes (AABB), to bound triangles. The overlap test between two AABBs less expensive than the triangle- triangle intersection test.
Javier Gonzalez-Sanchez | SER431 | Fall 2018 | 14 jgs Hierarchical Bounding Volumes § Similar to spatial subdivision § But for each object Slightly different § Union of children may not encompass the parent § If does not intersect, do not explore the children § If intersects, do bounding volume intersection on children § Continue till you get to the triangle-triangle intersection (Very few of them needs to be computed)
Javier Gonzalez-Sanchez | SER431 | Fall 2018 | 15 jgs Homework Add Objects to your world Calculate AABB Draw AABB with lines What about drawing the Normal lines?
jgs SER431 Advanced Graphics Javier Gonzalez-Sanchez [email protected] Fall 2018 Disclaimer. These slides can only be used as study material for the class SER431 at ASU. They cannot be distributed or used for another purpose.