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?
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
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
§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 }
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
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.
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)