multisampling anti-aliasing not working

View: New views
12 Messages — Rating Filter:   Alert me  

multisampling anti-aliasing not working

by Henjo van Rees :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am trying to get multisample anti-aliasing working in my Java3D applet.
The hardware supports multisample anti-aliasing, I check the available settings by querying the canvas. I am using OpenGL rendering using nVidia's linux drivers.

    GraphicsConfigTemplate3D gCT = new GraphicsConfigTemplate3D();
    gCT.setSceneAntialiasing(GraphicsConfigTemplate.UNNECESSARY);
    // canvas says: sceneAntialiasingAvailable=true
    // canvas says: sceneAntialiasingNumPasses=8
    universe.getViewer().getView().setSceneAntialiasingEnable(true);

The above results in an anti-aliased scene, however sceneAntialiasingNumPasses=8 means that multisampling is not supported and that the accumulation buffer will be used to simulated fullscreen anti-aliasing.

When I set the scene anti-aliasing setting to PREFERRED sceneAntialiasingNumPasses changes to 1, which means that multisampling is supported.

    gCT.setSceneAntialiasing(GraphicsConfigTemplate.PREFERRED);
    // canvas says: sceneAntialiasingAvailable=true
    // canvas says: sceneAntialiasingNumPasses=1
    universe.getViewer().getView().setSceneAntialiasingEnable(true);

However, this does not result in an anti-aliased scene.
Any ideas how I can get multisample anti-aliasing working?


Re: multisampling anti-aliasing not working

by java3d-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hi!

GraphicsConfigTemplate3D template = new GraphicsConfigTemplate3D();
template.setSceneAntialiasing(template.PREFERRED);

GraphicsConfiguration config = GraphicsEnvironment.getLocalGraphicsEnvironment().
getDefaultScreenDevice().getBestConfiguration(template);

Canvas3D canvas = new Canvas3D(config);

try, and correct the syntax errors(i've no IDE right now).

best wishes
[Message sent by forum member 'optimusprime1982' (optimusprime1982)]

http://forums.java.net/jive/thread.jspa?messageID=276355

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@...
For additional commands, e-mail: interest-help@...


Re: multisampling anti-aliasing not working

by Henjo van Rees :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

java3d-interest@... schreef:

> hi!
>
> GraphicsConfigTemplate3D template = new GraphicsConfigTemplate3D();
> template.setSceneAntialiasing(template.PREFERRED);
>
> GraphicsConfiguration config = GraphicsEnvironment.getLocalGraphicsEnvironment().
> getDefaultScreenDevice().getBestConfiguration(template);
>
> Canvas3D canvas = new Canvas3D(config);
>
> try, and correct the syntax errors(i've no IDE right now).
>
> best wishes
> [Message sent by forum member 'optimusprime1982' (optimusprime1982)]
>
> http://forums.java.net/jive/thread.jspa?messageID=276355
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@...
> For additional commands, e-mail: interest-help@...
>
>  
I'm basically doing the same, except that I'm using JCanvas3D and get my
Canvas3D from there:

        GraphicsConfigTemplate3D gCT = new GraphicsConfigTemplate3D();
        gCT.setSceneAntialiasing(GraphicsConfigTemplate.PREFERRED);
        GraphicsConfiguration config =
            GraphicsEnvironment.getLocalGraphicsEnvironment().
             getDefaultScreenDevice().getBestConfiguration(gCT);
       
        jcanvas = new BodyCanvas3D(gCT);
        jcanvas.setResizeMode(JCanvas3D.RESIZE_IMMEDIATELY);
     
        Canvas3D canvas = jcanvas.getOffscreenCanvas3D();
        view.addCanvas3D(canvas);
        view.setSceneAntialiasingEnable(true);

However, this does not give me any anti-aliasing at all :/


---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@...
For additional commands, e-mail: interest-help@...


Re: multisampling anti-aliasing not working

by Henjo van Rees :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Henjo schreef:

> java3d-interest@... schreef:
>> hi!
>> GraphicsConfigTemplate3D template = new GraphicsConfigTemplate3D();
>> template.setSceneAntialiasing(template.PREFERRED);
>>
>> GraphicsConfiguration config =
>> GraphicsEnvironment.getLocalGraphicsEnvironment().
>> getDefaultScreenDevice().getBestConfiguration(template);
>>
>> Canvas3D canvas = new Canvas3D(config);
>>
>> try, and correct the syntax errors(i've no IDE right now).
>>
>> best wishes
>> [Message sent by forum member 'optimusprime1982' (optimusprime1982)]
>>
>> http://forums.java.net/jive/thread.jspa?messageID=276355
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: interest-unsubscribe@...
>> For additional commands, e-mail: interest-help@...
>>
>>  
> I'm basically doing the same, except that I'm using JCanvas3D and get
> my Canvas3D from there:
>
>        GraphicsConfigTemplate3D gCT = new GraphicsConfigTemplate3D();
>        gCT.setSceneAntialiasing(GraphicsConfigTemplate.PREFERRED);
>        GraphicsConfiguration config =
>            GraphicsEnvironment.getLocalGraphicsEnvironment().
>             getDefaultScreenDevice().getBestConfiguration(gCT);
>              jcanvas = new BodyCanvas3D(gCT);
>        jcanvas.setResizeMode(JCanvas3D.RESIZE_IMMEDIATELY);
>             Canvas3D canvas = jcanvas.getOffscreenCanvas3D();
>        view.addCanvas3D(canvas);
>        view.setSceneAntialiasingEnable(true);
>
> However, this does not give me any anti-aliasing at all :/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@...
> For additional commands, e-mail: interest-help@...
>
*bump*
Does anyone know why the code above does not result in working
anti-aliasing?
My card supports it (GF 7600).

sceneAntialiasingNumPasses=1 which means that anti-aliasing is supported
and will not be done in the accumulation buffer (which is exactly what I
want, the AB is slow).




---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@...
For additional commands, e-mail: interest-help@...


Re: multisampling anti-aliasing not working

by Henjo van Rees :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Henjo schreef:

> java3d-interest@... schreef:
>> hi!
>> GraphicsConfigTemplate3D template = new GraphicsConfigTemplate3D();
>> template.setSceneAntialiasing(template.PREFERRED);
>>
>> GraphicsConfiguration config =
>> GraphicsEnvironment.getLocalGraphicsEnvironment().
>> getDefaultScreenDevice().getBestConfiguration(template);
>>
>> Canvas3D canvas = new Canvas3D(config);
>>
>> try, and correct the syntax errors(i've no IDE right now).
>>
>> best wishes
>> [Message sent by forum member 'optimusprime1982' (optimusprime1982)]
>>
>> http://forums.java.net/jive/thread.jspa?messageID=276355
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: interest-unsubscribe@...
>> For additional commands, e-mail: interest-help@...
>>
>>  
> I'm basically doing the same, except that I'm using JCanvas3D and get
> my Canvas3D from there:
>
>        GraphicsConfigTemplate3D gCT = new GraphicsConfigTemplate3D();
>        gCT.setSceneAntialiasing(GraphicsConfigTemplate.PREFERRED);
>        GraphicsConfiguration config =
>            GraphicsEnvironment.getLocalGraphicsEnvironment().
>             getDefaultScreenDevice().getBestConfiguration(gCT);
>              jcanvas = new BodyCanvas3D(gCT);
>        jcanvas.setResizeMode(JCanvas3D.RESIZE_IMMEDIATELY);
>             Canvas3D canvas = jcanvas.getOffscreenCanvas3D();
>        view.addCanvas3D(canvas);
>        view.setSceneAntialiasingEnable(true);
>
> However, this does not give me any anti-aliasing at all :/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@...
> For additional commands, e-mail: interest-help@...
>
*bump*
Does anyone know why the code above does not result in working
anti-aliasing?
My card supports it (GF 7600).

sceneAntialiasingNumPasses=1 which means that anti-aliasing is supported
and will not be done in the accumulation buffer (which is exactly what I
want, the AB is slow).


---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@...
For additional commands, e-mail: interest-help@...


Re: multisampling anti-aliasing not working

by java3d-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I'm not sure if this is the case, but afaik AA doesn't work on off-screen rendering. And JCanvas3D does use off-screen rendering.

Please,correct me if I'm wrong.

A.
[Message sent by forum member 'aces' (aces)]

http://forums.java.net/jive/thread.jspa?messageID=280410

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@...
For additional commands, e-mail: interest-help@...


Re: multisampling anti-aliasing not working

by java3d-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I'm not sure if this is the case, but afaik AA doesn't work on off-screen rendering. And JCanvas3D does use off-screen rendering.

Please,correct me if I'm wrong.

A.
[Message sent by forum member 'aces' (aces)]

http://forums.java.net/jive/thread.jspa?messageID=280411

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@...
For additional commands, e-mail: interest-help@...


Re: multisampling anti-aliasing not working

by Henjo van Rees :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

java3d-interest@... schreef:

> Hi,
>
> I'm not sure if this is the case, but afaik AA doesn't work on off-screen rendering. And JCanvas3D does use off-screen rendering.
>
> Please,correct me if I'm wrong.
>
> A.
> [Message sent by forum member 'aces' (aces)]
>
> http://forums.java.net/jive/thread.jspa?messageID=280410
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@...
> For additional commands, e-mail: interest-help@...
>
>  
Well, that would explain why I can't get AA working at all using
JCanvas3D (which indeed uses offscreen rendering).
It also explains why AA using the accumulation buffer does work with the
offscreen rendering, right?

Using the nVidia control panel to force AA does not work either, does
that also require onscreen rendering?

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@...
For additional commands, e-mail: interest-help@...


Re: multisampling anti-aliasing not working

by Henjo van Rees :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

java3d-interest@... schreef:

> Hi,
>
> I'm not sure if this is the case, but afaik AA doesn't work on off-screen rendering. And JCanvas3D does use off-screen rendering.
>
> Please,correct me if I'm wrong.
>
> A.
> [Message sent by forum member 'aces' (aces)]
>
> http://forums.java.net/jive/thread.jspa?messageID=280411
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@...
> For additional commands, e-mail: interest-help@...
>
>  
I have changed my JCanvas3D drawing to Canvas3D drawing, as follows.
AA still isn't working in Java3D. However, when I force AA with the
nVidia X Server Settings utility, hardware anti-aliasing suddenly works
(max settings).

So, why does the following Java3D code not result in AA?

       GraphicsConfigTemplate3D gCT = new GraphicsConfigTemplate3D();
       gCT.setSceneAntialiasing(GraphicsConfigTemplate.PREFERRED);
       GraphicsConfiguration config =
           GraphicsEnvironment.getLocalGraphicsEnvironment().
            getDefaultScreenDevice().getBestConfiguration(gCT);
       canvas = new Canvas3D(config);
       canvas.setResizeMode(JCanvas3D.RESIZE_IMMEDIATELY);
       add(canvas, BorderLayout.CENTER);
       view.addCanvas3D(canvas);
       view.setSceneAntialiasingEnable(true);
        // canvas says: sceneAntialiasingAvailable=true
        // canvas says: sceneAntialiasingNumPasses=1



---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@...
For additional commands, e-mail: interest-help@...


Re: multisampling anti-aliasing not working

by Henjo van Rees :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am still trying to get anti-aliasing working (on hardware, not using the accumulation buffer).
After digging through the sources and many posts, and websites I've found the following relevant information:

* sceneAntialiasingNumPasses:
"An Integer indicating the number of passes scene antialiasing requires to render a single frame for this Canvas3D. If this value is zero, scene antialiasing is not supported. If this value is one, multisampling antialiasing is used. Otherwise, the number indicates the number of rendering passes needed."  (Canvas3D.java)

* sceneAntialiasingNumPasses:
"An Integer indicating the number of passes scene antialiasing requires to render a single frame for this Canvas3D. If this value is zero, scene antialiasing is not supported. If this value is one, multisampling antialiasing is used. Otherwise, the number indicates the number of rendering passes needed."  (Canvas3D.java)

* "I'm not sure if this is the case, but afaik AA doesn't work on off-screen rendering. And JCanvas3D does use off-screen rendering."
(mailing list user 'aces')

* "Scene antialiasing is ignored in pure immediate mode,  but is supported in mixed-immediate mode." (View.java)

*
There are 3 rendering modes: immediate, retained and compile-retained. Compile-retained mode is the default mode.
(http://forum.java.sun.com/thread.jspa?threadID=407169&messageID=1787186)

* When I query my Canvas3D I am getting the following variables:
sceneAntialiasingAvailable=true
sceneAntialiasingNumPasses=1
Which means that hardware anti-aliasing is supported.


So, I am not giving up, I really want AA to work, so I'm left with some questions which I hope someone can answer:

1. How can I find out what rendering mode I am using currently?
2. Does AA not work in compile-retained mode?
3. How can I change rendering mode from compile-retained mode to mixed-immediate mode?
4. Once AA is working, can I specify how many passes must be used for it? 8x or 16x perhaps?


I haven't had a lot of responses yet to my previous questions. Even if you don't have the answers, responding and thinking out loud may be helpful.
Thanks for your time!



Re: multisampling anti-aliasing not working

by java3d-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Unfortunately the original poster wasn't as lucky as I was, but I used your method and it worked. Thanks
[Message sent by forum member 'javirosa' (javirosa)]

http://forums.java.net/jive/thread.jspa?messageID=289982

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@...
For additional commands, e-mail: interest-help@...


Re: multisampling anti-aliasing not working

by java3d-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Have you tried using LineAttributes to enable Anti-Aliasing for lines? Then add some lines to scene based on the above LineAttributes as appearance and see if the lines are drawn anti-aliased?
[Message sent by forum member 'runiter' (runiter)]

http://forums.java.net/jive/thread.jspa?messageID=295036

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@...
For additional commands, e-mail: interest-help@...

LightInTheBox - Buy quality products at wholesale price