But, here are two excellent resources ( 1, 2) that explain how we ended up with the equation that we solve in this code. The algorithm might be a bit too complicated to explain in this blog. Thus, when the ray intersects a face of the box, we can determine if the object it contains is also being intersected. We can transform the Origin-Extent format to Min-Max format easily as shown below: void AAABBClass::SetMinMax(FVector origin, FVector extent)įloat boxMinX = FindMin(origin.X - extent.X, origin.X + extent.X) įloat boxMaxX = FindMax(origin.X - extent.X, origin.X + extent.X) įloat boxMinY = FindMin(origin.Y - extent.Y, origin.Y + extent.Y) įloat boxMaxY = FindMax(origin.Y - extent.Y, origin.Y + extent.Y) įloat boxMinZ = FindMin(origin.Z - extent.Z, origin.Z + extent.Z) įloat boxMaxZ = FindMax(origin.Z - extent.Z, origin.Z + extent.Z) īoxMin = FVector(boxMinX, boxMinY, boxMinZ) īoxMax = FVector(boxMaxX, boxMaxY, boxMaxZ) This box can be represented by only 2 vectors – Min-Box-Corner and Max-Box-Corner. The box is not necessarily a cube-the length, width,Īnd height of the box may each be different.“(*) “A 3D AABB is a simple 6-sided box with each side parallel to one of Such bounding boxes can be expensive to compute collisions for. We basically use an AABB box instead of a bounding shape that would exactly fit the shape of the mesh object. Such that, the axes of the boxes align with the axes of the coordinate system the box lies in.Īn image from 3D Primer for Graphics and Game Development(*) This cube can be used to represent the bounds of a 3D object. Cube with Origin at O and extents (x,y,z) We will be using the same origin-extent format for our box. Let us first understand what a AABB is with a diagram we have seen before in the Octree. This is one of the most widely used applications of intersection techniques since Ray Tracing optimization involves doing an AABB intersection for complex mesh objects. The next intersection test that we will be looking into is AABB – Ray intersection.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |