I am working on a game and would like to add motion blur to videos that I export from the engine. Right now, I play back gameplay at 1/16th the original speed, giving me 16x more frames (e.g. instead of 60 frames per second, it's 960 frames per second) and averaging the frames. I am curious though, is this the proper weight or should I give frame samples closer to the middle more alpha? Also, should the frames sampled be sampled uniformly?

  • \$\begingroup\$ Motion around the edges of the screen should blur just like motion in the middle of the screen; uniform sampling from each frame makes sense. Unless you want physically-correct motion blur (which is far from trivial to implement yourself), I would think your approach is good enough. \$\endgroup\$ – namuol May 18 '11 at 21:13

You might want to rethink motion blur and only do it for one frame, not blending between several. This will help you avoid a lot of edge cases where your frame rate is stuttering and you have to decide on which frames to blend and how much.

A common way to do this is using motion vectors, where you render your scene again, with extra data for each mesh, and render screen space velocity into a separate buffer. This buffer can then be used as a blur direction control. to compose the final blurred image.

You can also build depth of field information at the same time using this technique.

  • \$\begingroup\$ I am using a fixed framerate and not in realtime. I am thinking that it will give me a higher quality render. \$\endgroup\$ – Ryan S May 18 '11 at 6:02
  • \$\begingroup\$ Sure it can, but at what cost? If you have the power to jitter everything in time it might be good. Sorry if I did not answer your question. \$\endgroup\$ – void May 18 '11 at 6:09
  • \$\begingroup\$ You can probably look at some rayt racing papers for solutions for this. They usually blend jittered images, both in time and space. \$\endgroup\$ – void May 18 '11 at 6:23
  • \$\begingroup\$ @void I'm just not sure what weight I give each image or if I just average them. \$\endgroup\$ – Ryan S May 18 '11 at 6:29
  • 1
    \$\begingroup\$ Usually there is no "right" thing. Only what's looking good ;) Do you need physically correct blur? If not then you can probably use some heuristic to blend it. Tried using a bell curve? does it look bad if you just blend everything together with 1/16 the alpha each? \$\endgroup\$ – void May 18 '11 at 6:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.