Thursday, March 10, 2016

A simple SAH BVH build

Here is a cut at a BVH build that cuts along the longest axis using the surface-area-heuristic (SAH).   The SAH minimizes:

SUM_left_right number_of_children_in_subtree*surface_area_of_bounding_box_of_subtree

This has been shown by many people to work shockingly well.


Here's my build code and it works ok.   I still have to sort because I need to sweep along an axis.   Is it worth it to tree each of three axes instead of longest?   Maybe.... bundles of long objects would be the adversarial case for the code below.


3 comments:

friedlinguini said...

"Worth it" isn't really answerable without more information, since you're comparing the up-front cost of creation against an arbitrary number of ray intersections. You might also consider simply rotating among the three axes.

By the way, you have some memory leaks there. Ideally you'd probably want to reuse the buffers globally (or at least per-thread), but std::vectors would be convenient if you're not worried about heap allocation overhead.

Peter Shirley said...

Good call on the memory leak. By worth it I really just mean worth investing developer (i.e., my) time in. Rotating would certainly make it more robust for adversarial cases like bundles of sticks.

Entertainment said...

home city trung kính

http://homecitytrungkinh.com.vn/

home city

http://homecitytrungkinh.com.vn/tong-quan-du-an-home-city/

chung cư trung kính

http://homecitytrungkinh.com.vn/mat-bang-can-ho-chung-cu-trung-kinh/

trung kính complex

http://homecitytrungkinh.com.vn/tien-ich-trung-kinh-complex/

5S Online - mùa 3 - Tập 66: Tình cậu duyên anh - Phần 1

5S Online - mùa 3 - Tập 65: Con nuôi sếp tổng - Phần 2

5S Online - mùa 3 - Tập 64: Con nuôi sếp tổng - Phần 1

5S Online - mùa 3 - Tập 63: Cắt đuôi sao cho xuôi - Phần 3

5S Online - mùa 3 - Tập 62: Cắt đuôi sao cho xuôi - Phần 2

5S Online - mùa 3 - Tập 61: Cắt đuôi sao cho xuôi - Phần 1

5S Online - Tập 54: Làm giàu quá khó cần có vận may - Phần 3

5S Online - Tập 53: Làm giàu quá khó cần có vận may - Phần 2

5S Online - Tập 52: Làm giàu quá khó cần có vận may - Phần 1

chung cư t&t riverside

chung cư 440 vĩnh hưng

chung cư t&t riverside 440 vĩnh hưng

bat dong san

bat dong san cho thue

bat dong san ban