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:
authorSergey Sharybin <sergey.vfx@gmail.com>2015-07-21 16:36:35 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-07-21 18:40:03 +0300
commitdc3563ff4801907ec8cd21a1589f0cb56d021a8f (patch)
tree88743d23f009deb1d3a3cc379ba1d67f5116a91e /intern/cycles/kernel/kernel_camera.h
parent1df42798d46d031c7666a75b47faa0d20fc965ef (diff)
Cycles: Implement camera zoom motion blur
Works totally similar to camera motion blur and majority of the changes are related on just passing extra arguments to sync() functions. Couple of things still to look into: - Motion pass will not include motion caused by the zoom. - Only perspective cameras are supported currently. - Motion is being interpolated on projected coordinates, which might give different results from constructing projection matrix from interpolated field of view. This could be good enough for us, but we need to consider improving this at some point. Reviewers: juicyfruit, dingto Reviewed By: dingto Differential Revision: https://developer.blender.org/D1383
Diffstat (limited to 'intern/cycles/kernel/kernel_camera.h')
-rw-r--r--intern/cycles/kernel/kernel_camera.h25
1 files changed, 24 insertions, 1 deletions
diff --git a/intern/cycles/kernel/kernel_camera.h b/intern/cycles/kernel/kernel_camera.h
index 3ce5134181a..67651f96544 100644
--- a/intern/cycles/kernel/kernel_camera.h
+++ b/intern/cycles/kernel/kernel_camera.h
@@ -43,7 +43,30 @@ ccl_device void camera_sample_perspective(KernelGlobals *kg, float raster_x, flo
{
/* create ray form raster position */
Transform rastertocamera = kernel_data.cam.rastertocamera;
- float3 Pcamera = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y, 0.0f));
+ float3 raster = make_float3(raster_x, raster_y, 0.0f);
+ float3 Pcamera = transform_perspective(&rastertocamera, raster);
+
+#ifdef __CAMERA_MOTION__
+ if(kernel_data.cam.have_perspective_motion) {
+ /* TODO(sergey): Currently we interpolate projected coordinate which
+ * gives nice looking result and which is simple, but is in fact a bit
+ * different comparing to constructing projective matrix from an
+ * interpolated field of view.
+ */
+ if(ray->time < 0.5f) {
+ Transform rastertocamera_pre = kernel_data.cam.perspective_motion.pre;
+ float3 Pcamera_pre =
+ transform_perspective(&rastertocamera_pre, raster);
+ Pcamera = interp(Pcamera_pre, Pcamera, ray->time * 2.0f);
+ }
+ else {
+ Transform rastertocamera_post = kernel_data.cam.perspective_motion.post;
+ float3 Pcamera_post =
+ transform_perspective(&rastertocamera_post, raster);
+ Pcamera = interp(Pcamera, Pcamera_post, (ray->time - 0.5f) * 2.0f);
+ }
+ }
+#endif
ray->P = make_float3(0.0f, 0.0f, 0.0f);
ray->D = Pcamera;