Re: Why antialiasing does not operate?

Posted by InteractiveMesh on
URL: https://forum.jogamp.org/Why-antialiasing-does-not-operate-tp4027215p4027374.html

Before investigating into JOGL or JoglPipeline :

@Emmanuel,

if Sweet Home 3D is running in offscreen mode, the scene is rendered into a JCanvas3D. As said in its javadoc, double buffering will be disabled (UNNECESSARY) even if a double buffered GraphicsConfigTemplate3D is provided. Single buffering doesn't/can't support multisampling neither for onscreen windows nor for offscreen pbuffers. The latter is the case here. As soon as this overriding is removed in JCanvas3D antialiasing should work, assumed (1) GraphicsConfigTemplate3D requires scene antialiasing and (2) View's scene antialiasing flag is set. (antialiasing is required, View.setSceneAntialiasingEnable(true) never seems to be called in release 3.7, but j3d.implicitAntialiasing is set.)

If the system property j3d.implicitAntialiasing is set, the platform specific default multisampling state (typically enabled) remains unchanged no matter which Java 3D API method is called by the application - so antialising occurs here. Otherwise Java 3D disables multisampling while a Canvas3D is initialized (default state). Then the renderer checks for each frame if multisampling has to be en- or disabled depending on the above conditions (1) and (2).

@Alexei,

in your test case 't81.java' the 'GraphicsConfiguration gc = SimpleUniverse.getPreferredConfiguration()' doesn't provide scene antialiasing by default.

Give this a try:

// Double buffering (default) and scene antialiasing

GraphicsConfigTemplate3D gct3D = new GraphicsConfigTemplate3D();
gct3D.setSceneAntialiasing(GraphicsConfigTemplate3D.REQUIRED);

GraphicsConfiguration gc = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getBestConfiguration(gct3D);

Canvas3D cv = new Canvas3D(gc);
...
view2.setSceneAntialiasingEnable(true); // ok
...

Hope this helps, August