Anti-aliasing on a transparent background


I am a novice in graphics processing in general and jME in particular, but so far I really like your product. However, I'm stuck with a problem now and I hope somebody can help me.

I am trying to render a 3D scene in jME and then write out some parts of it to a PNG file. My problem comes with anti-aliasing. As long as my background colour is fully opaque it just works fine. But if I set a fully transparent background to the renderer I still don't end up with a transparent background in my PNG file. This is clear because Renderer.takeScreenShot(String filename) - which I am using - is setting the BufferedImage to TYPE_INT_RGB which doesn't support transparency:

IntBuffer buff = ByteBuffer.allocateDirect(width * height * 4).order(ByteOrder.LITTLE_ENDIAN).asIntBuffer();
grabScreenContents(buff, 0, 0, width, height);
BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);

Now, if I change this to TYPE_INT_ARGB then I get the transparency that I want, but I get lots of jaggies as well, which indicates a problem with anti-aliasing.

How can I get both a transparent background and nice, smooth edges? I have played around with quite some settings, but now I am running out of ideas.

jME currently does not really support anti-aliasing, it only automatically enables it if you initialize a display with multiple samples.

Not sure what video card you have, but in a recent forceware update to nVidia cards they added new option to the 3d display settings to set transparency smoothing, you can set it to "Multisampling" or "Supersampling", you might be able to use that option to override the current setting.