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
diff options
context:
space:
mode:
authorAlexander Gavrilov <angavrilov@gmail.com>2016-08-05 00:24:29 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2016-08-05 02:00:41 +0300
commit1f19fba56611cba09246a0722ef3968976e3c2d3 (patch)
tree336af12c1bdfba9cf37f857dfa0b4144fce75ff2
parent2ce9bab8ce88d25830633b8258063811d861c2f8 (diff)
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
-rw-r--r--intern/cycles/blender/blender_object.cpp4
-rw-r--r--intern/cycles/render/object.cpp31
-rw-r--r--intern/cycles/util/util_transform.h9
3 files changed, 31 insertions, 13 deletions
diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp
index 4886735a18f..c34dec3be51 100644
--- a/intern/cycles/blender/blender_object.cpp
+++ b/intern/cycles/blender/blender_object.cpp
@@ -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 */
diff --git a/intern/cycles/render/object.cpp b/intern/cycles/render/object.cpp
index 662d87e8b6b..7024a8bcc79 100644
--- a/intern/cycles/render/object.cpp
+++ b/intern/cycles/render/object.cpp
@@ -70,19 +70,28 @@ void Object::compute_bounds(bool motion_blur)
BoundBox mbounds = mesh->bounds;
if(motion_blur && use_motion) {
- DecompMotionTransform decomp;
- transform_motion_decompose(&decomp, &motion, &tfm);
+ 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);
- bounds = BoundBox::empty;
+ bounds = BoundBox::empty;
- /* todo: this is really terrible. according to pbrt there is a better
- * way to find this iteratively, but did not find implementation yet
- * or try to implement myself */
- for(float t = 0.0f; t < 1.0f; t += (1.0f/128.0f)) {
- Transform ttfm;
+ /* todo: this is really terrible. according to pbrt there is a better
+ * way to find this iteratively, but did not find implementation yet
+ * or try to implement myself */
+ for(float t = 0.0f; t < 1.0f; t += (1.0f/128.0f)) {
+ Transform ttfm;
- transform_motion_interpolate(&ttfm, &decomp, t);
- bounds.grow(mbounds.transformed(&ttfm));
+ transform_motion_interpolate(&ttfm, &decomp, t);
+ bounds.grow(mbounds.transformed(&ttfm));
+ }
}
}
else {
@@ -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. */
diff --git a/intern/cycles/util/util_transform.h b/intern/cycles/util/util_transform.h
index 6fed18a3db8..bfc8f55feed 100644
--- a/intern/cycles/util/util_transform.h
+++ b/intern/cycles/util/util_transform.h
@@ -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 */