Hi all,
Did anybody try to use full scene antialiasing in Java3D? I use the following code to render the antialiased scene in my view to the off-screen buffer:
// Obtain graphics configuration
GraphicsConfigTemplate3D template = new GraphicsConfigTemplate3D();
GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice device = env.getDefaultScreenDevice();
GraphicsConfiguration config = device.getBestConfiguration(template);
// Create offscreen canvas
Canvas3D canvas = new Canvas3D(config, true);
mView.addCanvas3D(canvas);
// Set the offscreen to match the onscreen
Screen3D sOn = ((Canvas3D)screenCanvas).getScreen3D();
Screen3D sOff = canvas.getScreen3D();
sOff.setSize(sOn.getSize());
sOff.setPhysicalScreenWidth(sOn.getPhysicalScreenWidth());
sOff.setPhysicalScreenHeight(sOn.getPhysicalScreenHeight());
// Set offscreen buffer
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
ImageComponent2D imComp = new ImageComponent2D(ImageComponent.FORMAT_RGB, image, true, false);
imComp.setCapability(ImageComponent2D.ALLOW_IMAGE_READ);
canvas.setOffScreenBuffer(imComp);
// Antialiasing
if (canvas.getSceneAntialiasingAvailable())
mView.setSceneAntialiasingEnable(true);
// Render to offscreen buffer
mView.startView()
canvas.renderOffScreenBuffer();
mView.stopView();
Resulting picture demonstrates some effort to be antialiased but it is not exactly what I expect it to be. Looks like the frame is jittered too far. Can anybody provide any insight on what is wrong? I use Java3D 1.2.1_03. Hardware should be irrelevant for the off-screen rendering.
Yuri.
<<antialias.jpg>>
<<attachment: antialias.jpg>>
