Cycles: Support user-defined shutter curve
ClosedPublic

Authored by Sergey Sharybin (sergey) on Oct 27 2015, 3:27 PM.

Details

Summary

Previously shutter was instantly opening, staying opened for the shutter time
period of time and then instantly closing. This isn't quite how real cameras
are working, where shutter is opening with some curve. Now it is possible to
define user curve for how much shutter is opened across the sampling period
of time.

This could be used for example to make motion blur trails softer.

Shutter curve now can be controlled using curve mapping widget in the motion
blur panel in Render buttons. Only mapping from 0..1 by x axis are allowed,
Y values will be normalized to fill in 0..1 space as well automatically.

Y values of 0 means fully closed shutter, Y values of 1 means fully opened
shutter.

Default mapping is set to old behavior when shutter opens and closes instantly.

This shutter mapping curve could easily be used by any other render engine by
accessing scene.render.motion_blur_shutter_curve.

Diff Detail

Repository
rB Blender

Generally fine, some minor points.

source/blender/blenkernel/BKE_colortools.h
57

Would call CURVEMAP_SLOPE_POS_NEG since we're already using those terms here.

source/blender/makesrna/intern/rna_scene.c
5373

Typo, also could be changed to:

"Curve defining the shutters openness over time"

Though no string opinion here.

This revision is now accepted and ready to land.Oct 27 2015, 3:44 PM

@Campbell Barton (campbellbarton), thanks for the review.

Here're some images of the results;

Rendering with default shutter time and curve:

Rendering with triangle shaped shutter curve:

Rendering with default shutter curve but lower shutter time (for trails comparison):

On OS X I'm seeing random crashes, not single backtrace, but it's always crashing in memory freeing something. For example: start with factory settings, switch to cycles, enable motion blur and expand panel to show curves, F12 render.

Valgrind can probably find the cause.

intern/cycles/render/camera.cpp
42 ↗(On Diff #5311)

This should be return shutter_curve[RAMP_TABLE_SIZE - 1].

Updates with feedback from Campbell and fixes for Brecht

Sergey Sharybin (sergey) marked 3 inline comments as done.Oct 27 2015, 6:30 PM

@Brecht Van Lommel (brecht), think i've nailed all bad memory access now, mind checking it again?

Looks good to me now, no crashes anymore.

Both looks good and works for me.

This revision was automatically updated to reflect the committed changes.