Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Mours <pmours@nvidia.com>2019-10-01 20:39:11 +0300
committerPatrick Mours <pmours@nvidia.com>2019-10-01 21:01:51 +0300
commit8dd9172aa23b28fb092fd2324937f2358be81343 (patch)
treeaa73b1517249003e5a9207ebd49a88652a3fd443 /intern/cycles
parent6700027863f152ba06c911aa96f4528b3ce7e268 (diff)
Fix "motion_blur" tests with OptiX in Cycles
Curves with motion blur produced wrong results with OptiX (T69801). This is because the AABBs for the motion steps were calculated from incorrect attribute data because the offset into the attribute data array was incorrect. Reviewed By: brecht Differential Revision: https://developer.blender.org/D5961
Diffstat (limited to 'intern/cycles')
-rw-r--r--intern/cycles/device/device_optix.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/intern/cycles/device/device_optix.cpp b/intern/cycles/device/device_optix.cpp
index 84d7ecf6934..b745235aed5 100644
--- a/intern/cycles/device/device_optix.cpp
+++ b/intern/cycles/device/device_optix.cpp
@@ -881,20 +881,23 @@ class OptiXDevice : public Device {
// Get AABBs for each motion step
for (size_t step = 0; step < num_motion_steps; ++step) {
+ // The center step for motion vertices is not stored in the attribute
const float3 *keys = mesh->curve_keys.data();
-
size_t center_step = (num_motion_steps - 1) / 2;
- // The center step for motion vertices is not stored in the attribute
if (step != center_step) {
- keys = motion_keys->data_float3() +
- (step > center_step ? step - 1 : step) * num_segments;
+ size_t attr_offset = (step > center_step) ? step - 1 : step;
+ // Technically this is a float4 array, but sizeof(float3) is the same as sizeof(float4)
+ keys = motion_keys->data_float3() + attr_offset * mesh->curve_keys.size();
}
- for (size_t i = step * num_segments, j = 0; j < num_curves; ++j) {
+ size_t i = step * num_segments;
+ for (size_t j = 0; j < num_curves; ++j) {
const Mesh::Curve c = mesh->get_curve(j);
+
for (size_t k = 0; k < c.num_segments(); ++i, ++k) {
BoundBox bounds = BoundBox::empty;
c.bounds_grow(k, keys, mesh->curve_radius.data(), bounds);
+
aabb_data[i].minX = bounds.min.x;
aabb_data[i].minY = bounds.min.y;
aabb_data[i].minZ = bounds.min.z;
@@ -917,7 +920,6 @@ class OptiXDevice : public Device {
// Disable visibility test anyhit program, since it is already checked during intersection
// Those trace calls that require anyhit can force it with OPTIX_RAY_FLAG_ENFORCE_ANYHIT
unsigned int build_flags = OPTIX_GEOMETRY_FLAG_DISABLE_ANYHIT;
-
OptixBuildInput build_input = {};
build_input.type = OPTIX_BUILD_INPUT_TYPE_CUSTOM_PRIMITIVES;
build_input.aabbArray.aabbBuffers = (CUdeviceptr *)aabb_ptrs.data();
@@ -975,7 +977,6 @@ class OptiXDevice : public Device {
// No special build flags for triangle primitives
unsigned int build_flags = OPTIX_GEOMETRY_FLAG_NONE;
-
OptixBuildInput build_input = {};
build_input.type = OPTIX_BUILD_INPUT_TYPE_TRIANGLES;
build_input.triangleArray.vertexBuffers = (CUdeviceptr *)vertex_ptrs.data();