# Is Dynamic shutter speed in Sampled Motion Blur possible?

I have a single object spinning (at varying speeds controlled by F-curves) along two axes.

The effect I'm going for turns out best if I can vary the Shutter in Sampled Motion Blur for every frame, say, for instance, exponentially from 0.25 in Frame 30 to 4.00 in Frame 80.

Manually adjusting this value and exporting bits of the animation is tedious. Is there any way to control the Shutter using F-curves? Or could the same effect be somehow accomplished using another method?

• possible duplicate of Can we use just a script for a driver? – Jaroslav Jerryno Novotny May 13 '15 at 16:54
• You cannot attach driver or animate the property, but you can control it with script. The script can copy the value from another animateable property. If you won't find the duplicate helpful I'll post a custom script for you here. – Jaroslav Jerryno Novotny May 13 '15 at 16:57
• @Jerryno I don't really see that as a duplicate. See: meta.blender.stackexchange.com/questions/549/… – Ray Mairlot May 13 '15 at 16:59
• @Jerryno Thanks, that pointed me in the right direction. I'm still trying to get the hang of scripting, so an example would be immensely helpful. I'd want the script to function this way (pseudocode): for t in frameRange { set shutter = function(t); render frame to image; } – MuffinMan May 13 '15 at 18:23

Since this property cannot be animated or driven, the only thing left is to control it with script:

import bpy
import math

def function(frame):
# modify this function if you want
return math.pow(4.75, (frame-30)/50) - 0.75

def my_handler(scene):
# this code will be run on every frame change
scene.render.motion_blur_shutter = function(scene.frame_current)

bpy.app.handlers.frame_change_pre.append(my_handler)


Run this in the Text editor, render the animation normally. If you want to make changes after you ran the code, remove the handler first with typing this into the console: bpy.app.handlers.frame_change_pre.clear()

If you would like to animate the value, create a custom ID property for the scene which you can animate (name the property "shutter"):

And use this code (it copies the value into the shutter speed):

import bpy

def my_handler(scene):
scene.render.motion_blur_shutter = scene["shutter"]

bpy.app.handlers.frame_change_pre.append(my_handler)