Wednesday, May 16, 2012
In my last post I talked a bit about frame blending, and how you can render videos with it. Today I added it as a post processing effect. I kind of want to explain more about how it works so that people don't get confused as to why they get massive frame rate loss.
So frame blending is about simulating a camera shutter. When you take a picture the camera mechanically opens the shutter, then closes it. There's a short period where light gets in. So obviously the longer the shutter is open the more light will get in - and the more things will blur - because they're moving while it's being exposed.
So what we do is instead of rendering one frame per frame, we render a frame, collect 16 frames, then render another frame. So we're practically rendering 1 frame every 16 frames. With those 16 frames we ignore the first 4, and the last 4. This is to simulate 180 degree shutter (the shutter is closed half the time). Then with the 8 frames in the middle of the block of 16 we blend them together to make one, with the intensity of the frame curved towards the middle (so the nearer the shutter is to fully open the more apparent the frame is).
This sounds like it'd be slow - and it kind of is. But the weird thing is that I can run around fine with it on 16 - and it feels great. It obviously knocks my fps down to about 30 - but you really don't notice because it feels so smooth.
But to be honest I never really expected to run around with it on in real time - I implemented it for the video system - and I implemented it as a post process so that you can take screenshots with motion blur. Like this!
The technique has two options. The number of frames to blend (default 16) and the length to keep the shutter open (default 0.5 for 180 degrees). Obviously the longer you keep the shutter open the blurrier the image becomes.. and I've found that 0.5 looks the most natural.