🔥

Bounding Volumes 包围盒 包围体积

Quick way to avoid intersections: bound complex object with a simple volume
对于一个复杂的物体,可以用一个相对简单的形状包起来。
  • Object is fully contained in the volume
  • If it doesn’t hit the volume, it doesn’t hit the object
    • 如果一个光线连包围盒都碰不到,那么更不可能碰到里面的物体。
  • So test BVol first, then test object if it hits
notion image
notion image
我们可以把长方体理解为三个不同的对面形成的交集:前面和后面、左面和右面、上面和下面,每个面都是无限大的平面。
我们通常用的包围盒都是轴对齐包围盒(AABB),轴对齐指的是每个面对的要么是 xy平面、yz平面和 xz 平面。
💡
光线怎么和包围盒求交
对于二维如何求交
notion image
对两个线段求交集,得到光线进入盒子的时间。对于 3D 的情况:
  • Recall: a box (3D) = three pairs of infinitely large slabs
  • Key ideas
    • The ray enters the box only when it enters all pairs of slabs
      • 只有三个对面都满足光线已经进去了,才能说光线进入了盒子。
    • The ray exits the box as long as it exits any pair of slabs
      • 当光线已经离开任意一个对面,说明光线已经离开盒子。
  • For each pair, calculate the tmin and tmax (negative is fine)
  • For the 3D box, tenter = max{tmin}, texit = min{tmax}
  • If tenter < texit, we know the ray stays a while in the box (so they must intersect!) (not done yet, see the next slide)
    • 进入时间小于出去时间,说明这段时间内,光线就在盒子里,说明有交点。
    • 但目前为止没考虑负时间怎么处理。
notion image
iff:当且仅当
💡
为什么要选择横平竖直的面呢?平行于 xy平面、yz平面和 xz 平面的面。
因为好求,计算量不同,下面可以直接用 x 分量。
notion image