diff options
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/bvh/bvh_embree.cpp | 15 | ||||
-rw-r--r-- | intern/cycles/cmake/external_libs.cmake | 2 | ||||
-rw-r--r-- | intern/cycles/kernel/geom/geom_object.h | 8 | ||||
-rw-r--r-- | intern/cycles/util/util_transform.h | 31 |
4 files changed, 19 insertions, 37 deletions
diff --git a/intern/cycles/bvh/bvh_embree.cpp b/intern/cycles/bvh/bvh_embree.cpp index 851fdad7842..35c1b463b49 100644 --- a/intern/cycles/bvh/bvh_embree.cpp +++ b/intern/cycles/bvh/bvh_embree.cpp @@ -563,9 +563,20 @@ void BVHEmbree::add_instance(Object *ob, int i) rtcSetGeometryTimeStepCount(geom_id, num_motion_steps); if (ob->use_motion()) { + array<DecomposedTransform> decomp(ob->motion.size()); + transform_motion_decompose(decomp.data(), ob->motion.data(), ob->motion.size()); for (size_t step = 0; step < num_motion_steps; ++step) { - rtcSetGeometryTransform( - geom_id, step, RTC_FORMAT_FLOAT3X4_ROW_MAJOR, (const float *)&ob->motion[step]); + RTCQuaternionDecomposition rtc_decomp; + rtcInitQuaternionDecomposition(&rtc_decomp); + rtcQuaternionDecompositionSetQuaternion( + &rtc_decomp, decomp[step].x.w, decomp[step].x.x, decomp[step].x.y, decomp[step].x.z); + rtcQuaternionDecompositionSetScale( + &rtc_decomp, decomp[step].y.w, decomp[step].z.w, decomp[step].w.w); + rtcQuaternionDecompositionSetTranslation( + &rtc_decomp, decomp[step].y.x, decomp[step].y.y, decomp[step].y.z); + rtcQuaternionDecompositionSetSkew( + &rtc_decomp, decomp[step].z.x, decomp[step].z.y, decomp[step].w.x); + rtcSetGeometryTransformQuaternion(geom_id, step, &rtc_decomp); } } else { diff --git a/intern/cycles/cmake/external_libs.cmake b/intern/cycles/cmake/external_libs.cmake index 5bf681792ca..0b082b11cf7 100644 --- a/intern/cycles/cmake/external_libs.cmake +++ b/intern/cycles/cmake/external_libs.cmake @@ -135,7 +135,7 @@ if(CYCLES_STANDALONE_REPOSITORY) #### # embree if(WITH_CYCLES_EMBREE) - find_package(embree 3.2.4 REQUIRED) + find_package(embree 3.8.0 REQUIRED) endif() #### diff --git a/intern/cycles/kernel/geom/geom_object.h b/intern/cycles/kernel/geom/geom_object.h index af4e6fbd89b..ac2ddf575ca 100644 --- a/intern/cycles/kernel/geom/geom_object.h +++ b/intern/cycles/kernel/geom/geom_object.h @@ -81,13 +81,7 @@ ccl_device_inline Transform object_fetch_transform_motion(KernelGlobals *kg, const uint num_steps = kernel_tex_fetch(__objects, object).numsteps * 2 + 1; Transform tfm; -# ifdef __EMBREE__ - if (kernel_data.bvh.scene) { - transform_motion_array_interpolate_straight(&tfm, motion, num_steps, time); - } - else -# endif - transform_motion_array_interpolate(&tfm, motion, num_steps, time); + transform_motion_array_interpolate(&tfm, motion, num_steps, time); return tfm; } diff --git a/intern/cycles/util/util_transform.h b/intern/cycles/util/util_transform.h index 407654245cb..d0a6264d5cf 100644 --- a/intern/cycles/util/util_transform.h +++ b/intern/cycles/util/util_transform.h @@ -344,10 +344,10 @@ ccl_device_inline Transform transform_empty() ccl_device_inline float4 quat_interpolate(float4 q1, float4 q2, float t) { - /* use simpe nlerp instead of slerp. it's faster and almost the same */ + /* Optix is using lerp to interpolate motion transformations. */ +#ifdef __KERNEL_OPTIX__ return normalize((1.0f - t) * q1 + t * q2); - -#if 0 +#else /* __KERNEL_OPTIX__ */ /* note: this does not ensure rotation around shortest angle, q1 and q2 * are assumed to be matched already in transform_motion_decompose */ float costheta = dot(q1, q2); @@ -365,7 +365,7 @@ ccl_device_inline float4 quat_interpolate(float4 q1, float4 q2, float t) float thetap = theta * t; return q1 * cosf(thetap) + qperp * sinf(thetap); } -#endif +#endif /* __KERNEL_OPTIX__ */ } ccl_device_inline Transform transform_quick_inverse(Transform M) @@ -468,29 +468,6 @@ ccl_device void transform_motion_array_interpolate(Transform *tfm, #ifndef __KERNEL_GPU__ -# ifdef WITH_EMBREE -ccl_device void transform_motion_array_interpolate_straight( - Transform *tfm, const ccl_global DecomposedTransform *motion, uint numsteps, float time) -{ - /* Figure out which steps we need to interpolate. */ - int maxstep = numsteps - 1; - int step = min((int)(time * maxstep), maxstep - 1); - float t = time * maxstep - step; - - const ccl_global DecomposedTransform *a = motion + step; - const ccl_global DecomposedTransform *b = motion + step + 1; - Transform step1, step2; - - transform_compose(&step1, a); - transform_compose(&step2, b); - - /* matrix lerp */ - tfm->x = (1.0f - t) * step1.x + t * step2.x; - tfm->y = (1.0f - t) * step1.y + t * step2.y; - tfm->z = (1.0f - t) * step1.z + t * step2.z; -} -# endif - class BoundBox2D; ccl_device_inline bool operator==(const DecomposedTransform &A, const DecomposedTransform &B) |