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();