Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- 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)).
- Add support for `int64` and `uint64` key types to `wp.tile_sort()` ([GH-1089](https://github.com/NVIDIA/warp/issues/1089)).
- 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)).
- 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)).

### Removed

Expand Down
15 changes: 10 additions & 5 deletions warp/native/bvh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,15 +392,20 @@ float TopDownBVHBuilder::partition_sah_indices(const vec3* lowers, const vec3* u
assert(end - start >= 2);

int n = end - start;
vec3 edges = range_bounds.edges();

bounds3 b = calc_bounds(lowers, uppers, indices, start, end);

bounds3 centroid_bounds;
for (int i = start; i < end; ++i)
{
vec3 item_center = 0.5f * (lowers[indices[i]] + uppers[indices[i]]);
centroid_bounds.add_point(item_center);
}
vec3 edges = centroid_bounds.edges();

split_axis = longest_axis(edges);

// compute each bucket
float range_start = b.lower[split_axis];
float range_end = b.upper[split_axis];
float range_start = centroid_bounds.lower[split_axis];
float range_end = centroid_bounds.upper[split_axis];

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