# Visual Artifacts from motion blur

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:

Without the effect, the scene looks like this:

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));
g.dispose();

• 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 – DMGregory Jan 17 '17 at 5:32
• Just so you know, if your game runs af 60fps, motion blur makes the experience worse – Bálint Jan 17 '17 at 11:01