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
path: root/intern
diff options
context:
space:
mode:
authorPatrick Mours <pmours@nvidia.com>2021-10-08 14:45:34 +0300
committerPatrick Mours <pmours@nvidia.com>2021-10-08 19:03:06 +0300
commit3a65571195524ea50682611306ab4d103807112a (patch)
tree02371e03009c584893deb0c71e3ae58940e7bd35 /intern
parent94d2736dfb33c20a49781eec00168f174ff8b767 (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')
-rw-r--r--intern/cycles/blender/blender_object.cpp9
-rw-r--r--intern/cycles/render/hair.cpp3
-rw-r--r--intern/cycles/render/mesh.cpp2
3 files changed, 9 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;
}
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);