Fix: Improve Cycles point clouds in HIPRT

Fixes a few issues with point clouds with HIPRT.
1. Crashing when building the BLAS due to an incorrect sized array.
2. A typo leading to all point cloud intersections being skipped.
3. A typo leading to some motion blurred point clouds rendering
as if they were stationary, or not rendering at all.

Pointclouds, with deformable motion blur, with BVH time steps set to >0
still do not render. Curves seem to have the same issue.

Ref #125086

Pull Request: https://projects.blender.org/blender/blender/pulls/125834
This commit is contained in:
Alaska
2024-09-03 16:31:41 +02:00
committed by Sergey Sharybin
parent 56e5b61ad0
commit 8cf4d47fe2
2 changed files with 8 additions and 8 deletions

View File

@@ -637,6 +637,7 @@ hiprtGeometryBuildInput HIPRTDevice::prepare_point_blas(BVHHIPRT *bvh, PointClou
int num_bounds = 0;
if (point_attr_mP == NULL) {
bvh->custom_prim_info.resize(num_points);
bvh->custom_primitive_bound.alloc(num_points);
for (uint j = 0; j < num_points; j++) {
const PointCloud::Point point = pointcloud->get_point(j);
@@ -651,8 +652,8 @@ hiprtGeometryBuildInput HIPRTDevice::prepare_point_blas(BVHHIPRT *bvh, PointClou
}
}
else if (bvh->params.num_motion_point_steps == 0) {
bvh->custom_primitive_bound.alloc(num_points * num_steps);
bvh->custom_prim_info.resize(num_points);
bvh->custom_primitive_bound.alloc(num_points);
for (uint j = 0; j < num_points; j++) {
const PointCloud::Point point = pointcloud->get_point(j);
@@ -664,17 +665,18 @@ hiprtGeometryBuildInput HIPRTDevice::prepare_point_blas(BVHHIPRT *bvh, PointClou
if (bounds.valid()) {
bvh->custom_primitive_bound[num_bounds] = bounds;
bvh->custom_prim_info[num_bounds].x = j;
bvh->custom_prim_info[num_bounds].y = PRIMITIVE_POINT;
bvh->custom_prim_info[num_bounds].y = PRIMITIVE_MOTION_POINT;
num_bounds++;
}
}
}
else {
const int num_bvh_steps = bvh->params.num_motion_point_steps * 2 + 1;
const float num_bvh_steps_inv_1 = 1.0f / (num_bvh_steps - 1);
bvh->custom_prim_info.resize(num_points * num_bvh_steps);
bvh->custom_primitive_bound.alloc(num_points * num_bvh_steps);
bvh->prims_time.resize(num_points * num_bvh_steps);
for (uint j = 0; j < num_points; j++) {
const PointCloud::Point point = pointcloud->get_point(j);
@@ -908,7 +910,7 @@ hiprtScene HIPRTDevice::build_tlas(BVHHIPRT *bvh,
current_header.frameIndex = transform_matrix.size();
if (ob->get_motion().size()) {
int motion_size = ob->get_motion().size();
assert(motion_size == 1);
assert(motion_size != 1);
array<Transform> tfm_array = ob->get_motion();
float time_iternval = 1 / (float)(motion_size - 1);