Why antialiasing does not operate?

classic Classic list List threaded Threaded
20 messages Options
Reply | Threaded
Open this post in threaded view
|

Why antialiasing does not operate?

Alexei A. Morozov
Hi,
I have found that my Java3D program does not implement antialiasing when the 1.6.0 version is used, though it does work under the 1.5.2 version. It is enough to install old Java3D 1.5.2 package to force antialiasing to work! I publish a plain test that illustrates the problem (t81.java). I have reproduced it under Windows 7 and Windows XP, JDK 1.7.0_09, Java3D 1.6.0-pre5.
Here are the figures:
Java3D 1.5.2:

Java3D 1.6.0:

Please inform me if it is a known problem or I do something in a wrong way simply. :)
A.M.
Reply | Threaded
Open this post in threaded view
|

Re: Why antialiasing does not operate?

gouessej
Administrator
Hi

The problem does not come from you, there is probably something wrong in the support of anti-aliasing in Java3D 1.6.0.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Why antialiasing does not operate?

Alexei A. Morozov
Thank you, Julien
How could I help to fix this problem?
A.M.
Reply | Threaded
Open this post in threaded view
|

Re: Why antialiasing does not operate?

Alexei A. Morozov
I could add also that the getSceneAntialiasingAvailable() function returns false and queryProperties().get("sceneAntialiasingNumPasses") returns 0 under 1.6.0, but not under 1.5.2 (true and 8 accordingly).
A.M.
Reply | Threaded
Open this post in threaded view
|

Re: Why antialiasing does not operate?

gouessej
Administrator
Alexei A. Morozov wrote
I could add also that the getSceneAntialiasingAvailable() function returns false and queryProperties().get("sceneAntialiasingNumPasses") returns 0 under 1.6.0, but not under 1.5.2 (true and 8 accordingly).
A.M.
Thank you for pointing that. Maybe it is simply not implemented in the renderer based on JOGL 2.0. I'm going to look at that now.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Why antialiasing does not operate?

gouessej
Administrator
In reply to this post by Alexei A. Morozov
Canvas3D.sceneAntialiasingAvailable is set to a wrong value.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Why antialiasing does not operate?

Alexei A. Morozov
Thank you!
Is it possible to modify it simply without updating Java3D?
A.M.
Reply | Threaded
Open this post in threaded view
|

Re: Why antialiasing does not operate?

gouessej
Administrator
Unfortunately it is not possible (because it's package protected) but it gives us a very accurate explanation to investigate and fix this regression.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Why antialiasing does not operate?

Manu
By the way, antialiasing never worked for me in offscreen mode either with Java 3D 1.5.2 or 1.6.
Julien, if you could find how to fix both problems, that would be great!
Emmanuel Puybaret
Reply | Threaded
Open this post in threaded view
|

Re: Why antialiasing does not operate?

gouessej
Administrator
Ok Emmanuel but keep in mind I took several weeks off because I needed a real rest

I will try to fix that bug this week. If I fail, you will have to open a new issue on Github.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Why antialiasing does not operate?

hharrison
This is an existing bug I think in the JOGL1 backend (I think), it didn't set all the scene information, likely just needs further
porting of the old native-opengl backend.  I'm off for vacation really soon, don't expect me to get to it until post-Christmas.

Harvey
Reply | Threaded
Open this post in threaded view
|

Re: Why antialiasing does not operate?

Manu
Harvey,
Don't worry there's no emergency, and have some nice holidays.
At worst, if ever Apple decides to drop Java 6 support under Mac OS X in the coming months, I'll distribute current Java 3D 1.6 version with off screen 3D canvases under Java 7 / Mac OS X, since it seems to work correctly (even if antialiasing would be better).
Please, just don't give up!
Emmanuel Puybaret
Reply | Threaded
Open this post in threaded view
|

Re: Why antialiasing does not operate?

gouessej
Administrator
Emmanuel, please can you report it as a bug on github so that we don't forget it?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Why antialiasing does not operate?

Sven Gothel
Administrator
On 11/29/2012 11:14 PM, gouessej [via jogamp] wrote:
> Emmanuel, please can you report it as a bug on github so that we don't forget it?

How about start using our bugzilla ?

I just added the Java3D product in bugzilla.

~Sven



signature.asc (909 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Why antialiasing does not operate?

hharrison
That would be my preference as well, please report on the jogamp bugzilla.

Harvey
Reply | Threaded
Open this post in threaded view
|

Re: Why antialiasing does not operate?

gouessej
Administrator
In reply to this post by Sven Gothel
Sven Gothel wrote
How about start using our bugzilla ?

I just added the Java3D product in bugzilla.
Thanks. Good idea. A real bug tracker is better for that purpose.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Why antialiasing does not operate?

Manu
Done 
Hope it won't be hard to implement...
Emmanuel Puybaret
Reply | Threaded
Open this post in threaded view
|

Re: Why antialiasing does not operate?

InteractiveMesh
In reply to this post by Manu
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
Reply | Threaded
Open this post in threaded view
|

Re: Why antialiasing does not operate?

Alexei A. Morozov
Thank you a lot, InteractiveMesh!

Well, it seems your idea does work. Here are results of my investigation:

Java3D 1.6.0-pre5:

GraphicsConfigTemplate3D gct3D= new GraphicsConfigTemplate3D();
gct3D.setSceneAntialiasing(GraphicsConfigTemplate3D.REQUIRED);
GraphicsConfiguration gc= java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getBestConfiguration(gct3D);



GraphicsConfiguration gc= SimpleUniverse.getPreferredConfiguration(); // old version



Java3D 1.5.2:

GraphicsConfigTemplate3D gct3D= new GraphicsConfigTemplate3D();
gct3D.setSceneAntialiasing(GraphicsConfigTemplate3D.REQUIRED);
GraphicsConfiguration gc= java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getBestConfiguration(gct3D);



GraphicsConfiguration gc= SimpleUniverse.getPreferredConfiguration(); // old version



There are interesting details:

The cv.queryProperties().get("sceneAntialiasingNumPasses") function returns 1 when GraphicsConfigTemplate3D is used both in Java3D 1.6.0.pre5 and Java3D 1.5.2 cases. However, this function returns 0 and 8 correspondingly when SimpleUniverse.getPreferredConfiguration() is used. The results of antialiasing are different a bit. One can see on the figures that 1.5.2 + SimpleUniverse.getPreferredConfiguration() gives the best result still. The GraphicsConfigTemplate3D method gives different results for Java3D 1.6.0.pre5 and Java3D 1.5.2 too. The best result gives Java3D 1.5.2 still IMHO.

Here is improved test program: t82.java. All tests were performed under Windows XP, JDK 1.7.0_09-b05.

I would very much appreciate your further comments on how to improve the results of antialiasing under Java3D 1.6.0.

Thank you once again,

A.M.
Reply | Threaded
Open this post in threaded view
|

Re: Why antialiasing does not operate?

InteractiveMesh
The reason why the multisampled image rendered with release 1.5.2 appears smoother than the one with 1.6.0-pre5 is: the maximum number of samples is internally set to 8 on the 1.5.2-native-ogl-pipeline and to 4 on the jogl-pipelines (1.5.2, 1.6.0-pre5). If you run release 1.5.2 contrary to my assumption on the jogl-pipeline, then I'm out of ideas.

Non of these releases allow to set the number of samples by the application.

"sceneAntialiasingAvailable" is true if scene antialiasing is available based on mulitsampling or on accumulation buffer.

"sceneAntialiasingNumPasses" returns the number of accumulation passes and not the number of samples in case of multisampling! More precisely:
 - 0, if neither multisampling nor accumulation buffer is available
 - 1, if multisampling is available
 - 8, if 8 pass accumulation is available

".. how to improve the results of antialiasing under 1.6.0 ?"
  - next pre-release : default number of samples = 8
  - in future : API to set the number

August