Skip to content

Commit 2ae4c93

Browse files
committed
Merge branch 'stafah/centroid' into 'main'
Use centroids for SAH partition (GH-1102) See merge request omniverse/warp!1802
2 parents ce3c0d6 + 595473a commit 2ae4c93

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
- Add more examples to `Tiles and SIMT code` documentation, demonstrating caveats when switching between the CPU and GPU and using `wp.tile()` ([GH-1042](https://github.com/NVIDIA/warp/issues/1042)).
2020
- Add support for `int64` and `uint64` key types to `wp.tile_sort()` ([GH-1089](https://github.com/NVIDIA/warp/issues/1089)).
2121
- Add `wp.tile_scan_max_inclusive()` and `wp.tile_scan_min_inclusive()` for cumulative maximum and minimum operations across tiles ([GH-1090](https://github.com/NVIDIA/warp/issues/1090)).
22+
- Changed BVH SAH constructor to use centroids instead of bounds to determine partition axis, improving build quality and traversal performance in some scenarios ([GH-1102](https://github.com/NVIDIA/warp/issues/1102)).
2223

2324
### Removed
2425

warp/native/bvh.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -392,15 +392,20 @@ float TopDownBVHBuilder::partition_sah_indices(const vec3* lowers, const vec3* u
392392
assert(end - start >= 2);
393393

394394
int n = end - start;
395-
vec3 edges = range_bounds.edges();
396-
397-
bounds3 b = calc_bounds(lowers, uppers, indices, start, end);
398395

396+
bounds3 centroid_bounds;
397+
for (int i = start; i < end; ++i)
398+
{
399+
vec3 item_center = 0.5f * (lowers[indices[i]] + uppers[indices[i]]);
400+
centroid_bounds.add_point(item_center);
401+
}
402+
vec3 edges = centroid_bounds.edges();
403+
399404
split_axis = longest_axis(edges);
400405

401406
// compute each bucket
402-
float range_start = b.lower[split_axis];
403-
float range_end = b.upper[split_axis];
407+
float range_start = centroid_bounds.lower[split_axis];
408+
float range_end = centroid_bounds.upper[split_axis];
404409

405410
// Guard against zero extent along the split axis to avoid division-by-zero
406411
if (range_end <= range_start)

0 commit comments

Comments
 (0)