diff options
author | Patrick Mours <pmours@nvidia.com> | 2021-10-08 14:45:34 +0300 |
---|---|---|
committer | Patrick Mours <pmours@nvidia.com> | 2021-10-08 19:03:06 +0300 |
commit | 3a65571195524ea50682611306ab4d103807112a (patch) | |
tree | 02371e03009c584893deb0c71e3ae58940e7bd35 /intern/cycles/blender | |
parent | 94d2736dfb33c20a49781eec00168f174ff8b767 (diff) |
Fix T90666: Toggling motion blur while persistent data is enabled results in artifacts
Enabling or disabling motion blur requires rebuilding the BVH of affected geometry and
uploading modified vertices to the device (since without motion blur the transform is
applied to the vertex positions, whereas with motion blur this is done during traversal).
Previously neither was happening when persistent data was enabled, since the relevant
node sockets were not tagged as modified after toggling motion blur.
The change to blender_object.cpp makes it so `geom->set_use_motion_blur()` is always
called (regardless of motion blur being toggled on or off), which will tag the geometry
as modified if that value changed and ensures the BVH is updated.
The change to hair.cpp/mesh.cpp was necessary since after motion blur is disabled,
the transform is applied to the vertex positions of a mesh, but those changes were not
uploaded to the device. This is fixed now that they are tagged as modified.
Maniphest Tasks: T90666
Differential Revision: https://developer.blender.org/D12781
Diffstat (limited to 'intern/cycles/blender')
-rw-r--r-- | intern/cycles/blender/blender_object.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp index 95da4a2df84..4b1c4edef7e 100644 --- a/intern/cycles/blender/blender_object.cpp +++ b/intern/cycles/blender/blender_object.cpp @@ -104,23 +104,22 @@ void BlenderSync::sync_object_motion_init(BL::Object &b_parent, BL::Object &b_ob array<Transform> motion; object->set_motion(motion); - Scene::MotionType need_motion = scene->need_motion(); - if (need_motion == Scene::MOTION_NONE || !object->get_geometry()) { + Geometry *geom = object->get_geometry(); + if (!geom) { return; } - Geometry *geom = object->get_geometry(); - int motion_steps = 0; bool use_motion_blur = false; + Scene::MotionType need_motion = scene->need_motion(); if (need_motion == Scene::MOTION_BLUR) { motion_steps = object_motion_steps(b_parent, b_ob, Object::MAX_MOTION_STEPS); if (motion_steps && object_use_deform_motion(b_parent, b_ob)) { use_motion_blur = true; } } - else { + else if (need_motion != Scene::MOTION_NONE) { motion_steps = 3; } |