I tried to use this motion blur effect on my project but found some strange looking artifacts when setting it's alpha to low values. (Which increases the strength of the effect)

The effect works by only rendering a transparent image, so parts of the last few frames are still visible. When I set the alpha of the new image to a fairly low value (less than 0.5f) I get these strange artifacts:

Scene with effect

Without the effect, the scene looks like this:

Scene without effect

Notice that without the effect, the background is solid (minus lighting). The artifacts do not go away after any amount of time. For my implementation of the effect, I created a BufferedImage, rendered everything to it, then rendered the image to the screen with transparency. Could someone provide an explanation as to why these artifacts are occuring? Is there possibly a way that I could repair this?

image = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().createCompatibleImage(width, height, Transparency.TRANSLUCENT)

//Draw everything to image

Graphics g = bs.getDrawGraphics();
Graphics2D g2d = (Graphics2D) g;
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha));
g.drawImage(image, 0, 0, null);
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f));
  • 2
    \$\begingroup\$ This looks like quantization errors. When you render something with an alpha less than 0.5, the difference between layering full black and full white gets crunched to less than half of the available colour range (usually 8 bits at best). Subtle gradations get rounded to the closest representable colour, and when layered on themselves many times these rounding errors stack up into banding artifacts. This can be fixed by dithering your colours - explained in excellent detail in this talk on the rendering used in Inside \$\endgroup\$
    – DMGregory
    Commented Jan 17, 2017 at 5:32
  • \$\begingroup\$ Just so you know, if your game runs af 60fps, motion blur makes the experience worse \$\endgroup\$
    – Bálint
    Commented Jan 17, 2017 at 11:01

1 Answer 1


When you redraw the scene with a transparent color it always leaves a trail behind. Because of the blending mode, the screen never gets completely cleared, thus the oldest frames will be visible.

  • \$\begingroup\$ Is there a way to fix this or will I need to use a different method to achieve motion blur? \$\endgroup\$
    – CamH
    Commented Jan 17, 2017 at 22:20
  • \$\begingroup\$ @Cam Sadly, this can't be fixed. Most games use the GPU to render stuff so there are algorithms to do that there, but here you pretty much need to render everything multiple times per frame. Here I want to say again, that motionblur is usually used to make low-framerate games look more smooth by making it movie-like. If a game runs at a higher framerate, then there's no need for it \$\endgroup\$
    – Bálint
    Commented Jan 17, 2017 at 22:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .