Jump to content
  • Advertisement
Sign in to follow this  
fastcall22

Simulating a slow shutter speed in 2D

This topic is 3790 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello gamedev.net, I'm working on a 2D game project dealing with fast-paced action, and I would like apply a type of motion blur for effect -- without blurring out objects moving with the camera. I'm not quite sure how to create this effect... 1. Render the scene onto a render target, then alpha-blend onto the final image the render target multiple (five, ten or twenty) times with decreasing alpha and offsetting in small displacements relative to the negative direction of camera movement. 2. Render static geometry/objects onto the final image, blur in the negative direction of camera movement (by setting alpha then redrawing over itself several times, with small a displacement each step), then for each moving object, blur the object depending on the relative speed with the camera, alpha blend result onto final image. 3. Same as 1, but moving objects are redrawn with an alpha inversely proportional to relative speed to camera speed. (No relative speed results in full alpha) (I'm unable to produce sample images at the moment.) My question is, is there any other method either more efficient methods? Please tell me what you think. Regards, _fastcall

Share this post


Link to post
Share on other sites
Advertisement
The simplest blur method I've used (which BTW won't blur objects that aren't moving relative to the camera) is just to keep a buffer containing the result of the previous frame, and alpha blend it with the current frame, then copy the current frame into the 'blur buffer'.

Share this post


Link to post
Share on other sites
A slightly more correct way would be to render multiple blur frames per presented frame and present them together with additive blending after being scaled down by the number of blur frames that will be presented. The number of frames to be combined is determined by the shutter speed and the number of blur frames generated per real frame.

So, if you generate 4 blur frames per real frame, and the shutter speed is, say 0.25 seconds and a real frame-rate of 60fps, then you should blend 15 * 4 = 60 frames. Granted, these numbers are pretty inflated and you may not need that many blur frames, depending on how fast the action really is.

The general gist is that you keep the previous frames which have been rendered within the time span of the shutter speed, divide each by the number of frames within that time, then add them all together. For the next frame, you pop those that fall out of the time-period from one end and push the new frames onto the other, its your basic FIFO (aka queue) structure.

For very fast motion, the results will be more accurate the more blur-frames you have available, but for very slow motion you need much less.

you could come up with an adaptive method dependent on the speed of each object relative to the camera, but that's much more involved and much less straight-forward.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!