[Bf-blender-cvs] [3a655711955] master: Fix T90666: Toggling motion blur while persistent data is enabled results in artifacts

Patrick Mours noreply at git.blender.org
Fri Oct 8 18:03:21 CEST 2021


Commit: 3a65571195524ea50682611306ab4d103807112a
Author: Patrick Mours
Date:   Fri Oct 8 13:45:34 2021 +0200
Branches: master
https://developer.blender.org/rB3a65571195524ea50682611306ab4d103807112a

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

===================================================================

M	intern/cycles/blender/blender_object.cpp
M	intern/cycles/render/hair.cpp
M	intern/cycles/render/mesh.cpp

===================================================================

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;
   }
 
diff --git a/intern/cycles/render/hair.cpp b/intern/cycles/render/hair.cpp
index e104455f7dd..e757e3fd3e0 100644
--- a/intern/cycles/render/hair.cpp
+++ b/intern/cycles/render/hair.cpp
@@ -441,6 +441,9 @@ void Hair::apply_transform(const Transform &tfm, const bool apply_to_motion)
     curve_radius[i] = radius;
   }
 
+  tag_curve_keys_modified();
+  tag_curve_radius_modified();
+
   if (apply_to_motion) {
     Attribute *curve_attr = attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
 
diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp
index 2ecea3101db..9c93f6f881c 100644
--- a/intern/cycles/render/mesh.cpp
+++ b/intern/cycles/render/mesh.cpp
@@ -508,6 +508,8 @@ void Mesh::apply_transform(const Transform &tfm, const bool apply_to_motion)
   for (size_t i = 0; i < verts.size(); i++)
     verts[i] = transform_point(&tfm, verts[i]);
 
+  tag_verts_modified();
+
   if (apply_to_motion) {
     Attribute *attr = attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);



More information about the Bf-blender-cvs mailing list