diff options
author | Stefan Werner <stefan.werner@tangent-animation.com> | 2020-02-18 01:44:12 +0300 |
---|---|---|
committer | Stefan Werner <stefan.werner@tangent-animation.com> | 2020-02-18 01:44:12 +0300 |
commit | f5740ec8cfc097c4cdf213e0295892094cd6c80c (patch) | |
tree | 1ac10d859cb994cb997e8b7ce953a1c747989aac /intern/cycles/bvh | |
parent | 435476cb87404ac2252641cf5fd50a816836083d (diff) |
Cycles: Enabled quaternion motion blur with Embree.
Bringing Embree's motion blur closer to Cycles' native blur.
This requries Embree 3.8.0 or newer.
Differential Revision: https://developer.blender.org/D6575
Diffstat (limited to 'intern/cycles/bvh')
-rw-r--r-- | intern/cycles/bvh/bvh_embree.cpp | 15 |
1 files changed, 13 insertions, 2 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 { |