Cycles: hide particles with broken motion blur traces.
Currently cycles cannot correctly render motion blur for objects that appear or disappear during the shutter window. Until that can be fixed properly, it may be better to hide such particles rather than let them render as if they were stationary for half of the frame. Reviewed By: brecht Differential Revision: https://developer.blender.org/D2125
This commit is contained in:

committed by
Brecht Van Lommel

parent
2ce9bab8ce
commit
1f19fba566
@@ -395,8 +395,8 @@ Object *BlenderSync::sync_object(BL::Object& b_parent,
|
||||
object->name = b_ob.name().c_str();
|
||||
object->pass_id = b_ob.pass_index();
|
||||
object->tfm = tfm;
|
||||
object->motion.pre = tfm;
|
||||
object->motion.post = tfm;
|
||||
object->motion.pre = transform_empty();
|
||||
object->motion.post = transform_empty();
|
||||
object->use_motion = false;
|
||||
|
||||
/* motion blur */
|
||||
|
@@ -70,6 +70,14 @@ void Object::compute_bounds(bool motion_blur)
|
||||
BoundBox mbounds = mesh->bounds;
|
||||
|
||||
if(motion_blur && use_motion) {
|
||||
if(motion.pre == transform_empty() ||
|
||||
motion.post == transform_empty()) {
|
||||
/* Hide objects that have no valid previous or next transform, for
|
||||
* example particle that stop existing. TODO: add support for this
|
||||
* case in the kernel so we don't get render artifacts. */
|
||||
bounds = BoundBox::empty;
|
||||
}
|
||||
else {
|
||||
DecompMotionTransform decomp;
|
||||
transform_motion_decompose(&decomp, &motion, &tfm);
|
||||
|
||||
@@ -85,6 +93,7 @@ void Object::compute_bounds(bool motion_blur)
|
||||
bounds.grow(mbounds.transformed(&ttfm));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(mesh->transform_applied) {
|
||||
bounds = mbounds;
|
||||
@@ -228,7 +237,7 @@ vector<float> Object::motion_times()
|
||||
bool Object::is_traceable()
|
||||
{
|
||||
/* Mesh itself can be empty,can skip all such objects. */
|
||||
if (bounds.size() == make_float3(0.0f, 0.0f, 0.0f)) {
|
||||
if (!bounds.valid() || bounds.size() == make_float3(0.0f, 0.0f, 0.0f)) {
|
||||
return false;
|
||||
}
|
||||
/* TODO(sergey): Check for mesh vertices/curves. visibility flags. */
|
||||
|
@@ -323,6 +323,15 @@ ccl_device_inline Transform transform_clear_scale(const Transform& tfm)
|
||||
return ntfm;
|
||||
}
|
||||
|
||||
ccl_device_inline Transform transform_empty()
|
||||
{
|
||||
return make_transform(
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* Motion Transform */
|
||||
|
Reference in New Issue
Block a user