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
This commit is contained in:
parent
94d2736dfb
commit
3a65571195
Notes:
blender-bot
2023-06-07 10:31:13 +02:00
Referenced by issue #90666, Disabling motion blur while persistent data is enabled results in objects disappearing or not rendering properly - Cycles OptiX
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue