From b909dfdae140ba0cc71003ad30dc612b059732d6 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 27 Oct 2015 19:00:51 +0500 Subject: Cycles: Expose user-defined shutter curve to the interface 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. Reviewers: #cycles, brecht, juicyfruit, campbellbarton Differential Revision: https://developer.blender.org/D1585 --- intern/cycles/blender/blender_util.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'intern/cycles/blender/blender_util.h') diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h index bd1c37a7560..2e9e9266404 100644 --- a/intern/cycles/blender/blender_util.h +++ b/intern/cycles/blender/blender_util.h @@ -62,6 +62,16 @@ static inline void colorramp_to_array(BL::ColorRamp ramp, float4 *data, int size } } +static inline void curvemapping_to_array(BL::CurveMapping cumap, float *data, int size) +{ + cumap.update(); + BL::CurveMap curve = cumap.curves[0]; + for(int i = 0; i < size; i++) { + float t = (float)i/(float)(size-1); + data[i] = curve.evaluate(t); + } +} + static inline void curvemapping_color_to_array(BL::CurveMapping cumap, float4 *data, int size, bool rgb_curve) { cumap.update(); -- cgit v1.2.3