How to take exact screenshot of particles?

When I take screenshots of my app using ScreenShotAppState, particles don’t come out the same as I see them on screen.

Here is an example. I took each of these screen shots by pressing PrtScr (with ScreenShotAppState). One if the one that JME gave me, the other is from pasting the results into paint.

From a couple other posts in this forum I am getting the idea that it is because the alpha values in the frame buffer are not 1.0 (the particles are blended together).

How can I change this? I am thinking about adding in a filter that just reads the texture output and sets all the alphas to 1.0 before going on to the screen shot. Is this the best way?


The background is actually transparent and you see the background color of the viewport. If you have a skybox or something else like that this will not happen. Else you can just discard the alpha channel of the image in an image editor.

You can also fork and fix ScreenShotAppState to black out the alpha if you are so inclined. I didn’t do this in the real code yet as I’m not sure it’s the best way…

I’ve modified my version in other ways and so I will just provide clues rather than paste the whole thing…

Somewhere in the app state there is code like this:


renderer.readFrameBuffer(out, outBuf);

Screenshots.convertScreenShot(outBuf, awtImage);


After that, add the following to set alpha to opaque.


byte[] pixels = ((DataBufferByte)awtImage.getRaster().getDataBuffer()).getData();

for( int pos = 0; pos < pixels.length; pos += 4 ){

pixels[pos] = (byte)0xff;




Ah yes, you were totally correct about the background causing that blockyness. Changing it fixed the issue. Unfortunately I ran into another issue where it wasn’t the background causing it, but a whole bunch of different coloured particles overlapping each other.


Your alpha reset code fixed my problem of the particles coming out the wrong colour. Thank you! I am also not sure it’s the best way to do it but it works wonderfully for my purposes.

As always, the JME community support rocks!