diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-11-20 12:42:34 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-12-31 18:44:27 +0300 |
commit | ade35bac9355679f0966249b7d65992ef024eb04 (patch) | |
tree | cdf0d9aedb6d2c9d53c8000aae2b02e8b551d587 /intern/cycles/render | |
parent | c81e6ffdf942a7e8ac58ef3a48ca1bcab78f01fd (diff) |
Cycles: Implement rolling shutter effect
This is an attempt to emulate real CMOS cameras which reads sensor by scanlines
and hence different scanlines are sampled at a different moment in time, which
causes so called rolling shutter effect. This effect will, for example, make
vertical straight lines being curved when doing horizontal camera pan.
This is controlled by the Shutter Type option in the Motion Blur panel.
Additionally, since scanline sampling is not instantaneous it's possible to have
motion blur on top of rolling shutter.
This is controlled by the Rolling Shutter Time slider which controls balance
between pure rolling shutter effect and pure motion blur effect.
Reviewers: brecht, juicyfruit, dingto, keir
Differential Revision: https://developer.blender.org/D1624
Diffstat (limited to 'intern/cycles/render')
-rw-r--r-- | intern/cycles/render/camera.cpp | 8 | ||||
-rw-r--r-- | intern/cycles/render/camera.h | 16 |
2 files changed, 24 insertions, 0 deletions
diff --git a/intern/cycles/render/camera.cpp b/intern/cycles/render/camera.cpp index 33a5c004033..9c17a11e0f1 100644 --- a/intern/cycles/render/camera.cpp +++ b/intern/cycles/render/camera.cpp @@ -109,6 +109,10 @@ Camera::Camera() for(int i = 0; i < num_shutter_points; ++i) { shutter_curve[i] = 1.0f; } + + /* Initialize rolling shutter effect. */ + rolling_shutter_type = ROLLING_SHUTTER_NONE; + rolling_shutter_duration = 0.1f; } Camera::~Camera() @@ -357,6 +361,10 @@ void Camera::device_update(Device *device, DeviceScene *dscene, Scene *scene) /* Camera in volume. */ kcam->is_inside_volume = 0; + /* Rolling shutter effect */ + kcam->rolling_shutter_type = rolling_shutter_type; + kcam->rolling_shutter_duration = rolling_shutter_duration; + previous_need_motion = need_motion; } diff --git a/intern/cycles/render/camera.h b/intern/cycles/render/camera.h index 1c26afafeff..d4a66b66072 100644 --- a/intern/cycles/render/camera.h +++ b/intern/cycles/render/camera.h @@ -47,12 +47,28 @@ public: MOTION_POSITION_END, }; + /* Specifies rolling shutter effect. */ + enum RollingShutterType { + /* No rolling shutter effect. */ + ROLLING_SHUTTER_NONE = 0, + /* Sensor is being scanned vertically from top to bottom. */ + ROLLING_SHUTTER_TOP, + }; + /* motion blur */ float shuttertime; MotionPosition motion_position; float shutter_curve[RAMP_TABLE_SIZE]; size_t shutter_table_offset; + /* ** Rolling shutter effect. ** */ + /* Defines rolling shutter effect type. */ + RollingShutterType rolling_shutter_type; + /* Specifies exposure time of scanlines when using + * rolling shutter effect. + */ + float rolling_shutter_duration; + /* depth of field */ float focaldistance; float aperturesize; |