Cycles: motion blur is now curved and passes exactly through the midpoint.

Previously it would only interpolate between the previous and next frame,
which meant it might not hit the current frame position.
This commit is contained in:
Brecht Van Lommel
2012-10-17 12:55:23 +00:00
parent afb75ad2af
commit d08b06f773
7 changed files with 54 additions and 24 deletions

View File

@@ -57,7 +57,7 @@ void Object::compute_bounds(bool motion_blur)
if(motion_blur && use_motion) {
MotionTransform decomp;
transform_motion_decompose(&decomp, &motion);
transform_motion_decompose(&decomp, &motion, &tfm);
bounds = BoundBox::empty;
@@ -219,7 +219,7 @@ void ObjectManager::device_update_transforms(Device *device, DeviceScene *dscene
mtfm_post = mtfm_post * itfm;
memcpy(&objects[offset+8], &mtfm_pre, sizeof(float4)*4);
memcpy(&objects[offset+12], &mtfm_post, sizeof(float4)*4);
memcpy(&objects[offset+16], &mtfm_post, sizeof(float4)*4);
}
#ifdef __OBJECT_MOTION__
else if(need_motion == Scene::MOTION_BLUR) {
@@ -227,21 +227,21 @@ void ObjectManager::device_update_transforms(Device *device, DeviceScene *dscene
/* decompose transformations for interpolation */
MotionTransform decomp;
transform_motion_decompose(&decomp, &ob->motion);
memcpy(&objects[offset+8], &decomp, sizeof(float4)*8);
transform_motion_decompose(&decomp, &ob->motion, &ob->tfm);
memcpy(&objects[offset+8], &decomp, sizeof(float4)*12);
flag |= SD_OBJECT_MOTION;
have_motion = true;
}
else {
float4 no_motion = make_float4(FLT_MAX);
memcpy(&objects[offset+8], &no_motion, sizeof(float4));
memcpy(&objects[offset+8], &no_motion, sizeof(float4)*12);
}
}
#endif
/* dupli object coords */
objects[offset+16] = make_float4(ob->dupli_generated[0], ob->dupli_generated[1], ob->dupli_generated[2], 0.0f);
objects[offset+17] = make_float4(ob->dupli_uv[0], ob->dupli_uv[1], 0.0f, 0.0f);
objects[offset+20] = make_float4(ob->dupli_generated[0], ob->dupli_generated[1], ob->dupli_generated[2], 0.0f);
objects[offset+21] = make_float4(ob->dupli_uv[0], ob->dupli_uv[1], 0.0f, 0.0f);
/* object flag */
if(ob->use_holdout)