[Bf-blender-cvs] [3194e05d3f2] cycles_embree: Cycles: Removed scaling from Embree's object motion blur.

Stefan Werner noreply at git.blender.org
Wed Nov 29 22:05:54 CET 2017


Commit: 3194e05d3f27124924f81b70400fb45fe022d9e4
Author: Stefan Werner
Date:   Wed Nov 29 21:58:37 2017 +0100
Branches: cycles_embree
https://developer.blender.org/rB3194e05d3f27124924f81b70400fb45fe022d9e4

Cycles: Removed scaling from Embree's object motion blur.

Cycles native drops scaling from motion interpolation, the scale of the center of the frame gets reused to all motion positions. Embree could interpolate scaling too, but mixing the two then causes trouble with secondary rays, as Cycles does its own transformation interpolation in the intersection refinement. For now, restrict Embree to the common denominator, hopefully soon we can reintroduce scaling motion blur to Cycles.

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

M	intern/cycles/bvh/bvh_embree.cpp

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

diff --git a/intern/cycles/bvh/bvh_embree.cpp b/intern/cycles/bvh/bvh_embree.cpp
index f0d2fc162e2..0b671e535f1 100644
--- a/intern/cycles/bvh/bvh_embree.cpp
+++ b/intern/cycles/bvh/bvh_embree.cpp
@@ -404,9 +404,26 @@ unsigned BVHEmbree::add_instance(Object *ob, int i)
 	unsigned geom_id = rtcNewInstance3(scene, instance_bvh->scene, num_motion_steps, i*2);
 
 	if(ob->use_motion) {
-		rtcSetTransform2(scene, geom_id, RTC_MATRIX_ROW_MAJOR, (const float*)&ob->motion.pre, 0);
+		/* Drop animated scales. Embree knows how to apply motion blur to those, but Cycles doesn't.
+		 * This is necessary to keep it consistent with Cycles' intersection refinement.
+		 * Eventually, Cycles should either also know how to to scaling or rely on Embree to get
+		 * transformation matrices for time steps. */
+		DecompMotionTransform decom;
+		Transform decom_single, comp;
+		transform_motion_decompose(&decom, &ob->motion, &ob->tfm);
+		decom_single.x = decom.pre_x;
+		decom_single.y = decom.pre_y;
+		decom_single.z = decom.mid.z;
+		decom_single.w = decom.mid.w;
+		transform_compose(&comp, &decom_single);
+
+		rtcSetTransform2(scene, geom_id, RTC_MATRIX_ROW_MAJOR, (const float*)&comp, 0);
 		rtcSetTransform2(scene, geom_id, RTC_MATRIX_ROW_MAJOR, (const float*)&ob->tfm, 1);
-		rtcSetTransform2(scene, geom_id, RTC_MATRIX_ROW_MAJOR, (const float*)&ob->motion.post, 2);
+
+		decom_single.x = decom.post_x;
+		decom_single.y = decom.post_y;
+		transform_compose(&comp, &decom_single);
+		rtcSetTransform2(scene, geom_id, RTC_MATRIX_ROW_MAJOR, (const float*)&comp, 2);
 	} else {
 		rtcSetTransform2(scene, geom_id, RTC_MATRIX_ROW_MAJOR, (const float*)&ob->tfm);
 	}



More information about the Bf-blender-cvs mailing list