BVH评价标准

BVH评价标准

记录一下看的一些论文中的BVH的一些评价标准。

Lower Spatial Overlap 更少的空间重叠区域

Benthin C , Woop S , Wald I , et al. Improved Two-Level BVHs using Partial Re-Braiding[C]High Performance Graphics. 2017.


相比于空间分割方法KD-TREE:

BVHs do not adapt well to scenes containing large triangles with overlapping bounding boxes.
–Ernst M , Greiner G . [IEEE 2007 IEEE Symposium on Interactive Ray Tracing - Ulm, Germany (2007.09.10-2007.09.12)] 2007 IEEE Symposium on Interactive Ray Tracing - Early Split Clipping for Bounding Volume Hierarchies[J]. 2007:73-78.

如果两棵子树对应的包围盒“重叠”的越多,那么一条射线穿过该区域时同时击中两子树的概率也就越大,这就意味着两棵子树都得进行相交测试。这样遍历与相交测试的开销也就增加,从而导致最后渲染的效率下降。下面是基于栈的BVH遍历代码:

bool BVHAccel::intersect(const Ray &ray) const {
  double t0 = ray.min_t;
  double t1 = ray.max_t;
  // try early exit
  if (!root->bb.intersect(ray, t0, t1)) return false;
  // create traversal stack
  stack<BVHNode *> tstack;
  // push initial traversal data
  tstack.push(root);
  // process traversal
  BVHNode *l, *r;
  while (!tstack.empty()) {
    // pop traversal data
    BVHNode *current = tstack.top();
    tstack.pop();
    // get children
    l = current->l;
    r = current->r;
    // if leaf
    if (!(l || r)) {
      for (size_t i = 0; i < current->range; ++i) {
        if (primitives[current->start + i]->intersect(ray)) return true;
      }
    }
    // test bboxes
    double tl0 = ray.min_t;
    double tl1 = ray.max_t;
    double tr0 = ray.min_t;
    double tr1 = ray.max_t;
    bool hitL, hitR;
    hitL = (l != NULL) && l->bb.intersect(ray, tl0, tl1);
    hitR = (r != NULL) && r->bb.intersect(ray, tr0, tr1);	
    // both hit
    if (hitL && hitR) {
      tstack.push(l);
      tstack.push(r);
    } else if (hitL) {
      tstack.push(l);
    } else if (hitR) {
      tstack.push(r);
    }
  }
  return false;
}

考虑一个内部节点下有两个待分割的primitives,最原始的方法就是分别分配到左右子节点当中,如下图所示:

图中黑色的方框是两个primitives的AABB,粉色区域是AABB重叠的区域。试想一条从上而下的射线Ray击中该重叠区域,则遍历过程中,会将左右子节点都入栈,在BVH的上层出现该情况,则可能需要遍历相应多层才能确定最近相交点。这便增加了traversal steps与primitives intersections的计算开销。

SAH Cost

Stich M , Friedrich H , Dietrich A . Spatial Splits in Bounding Volume Hierarchies[C]Conference on High Performance Graphics. ACM, 2009.

SAH代价可以参考BVH with SAH这篇博客,我觉得说的挺好。

Build Time

当然构建时间也是一个重要指标,构建BVH的实时性是保证光追实时性的基础。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值