anti-aliasing

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

anti-aliasing

Mohamed Amine Mzoughi
Hello,

I want to enable Anti-alisaing in my VTK app, so I took some parameters
from ParaView and it still doesn't work :

     m_view->GetRenderer()->UseFXAAOn(); // enable AA

     vtkFXAAOptions* const aaOpts = m_view->GetRenderer()->GetFXAAOptions();
     aaOpts->SetRelativeContrastThreshold(0.125);
     aaOpts->SetHardContrastThreshold(0.045);
     aaOpts->SetSubpixelBlendLimit(0.75);
     aaOpts->SetSubpixelContrastThreshold(0.25);
     aaOpts->SetUseHighQualityEndpoints(true);
     aaOpts->SetEndpointSearchIterations(12);

what am I missing ?

Also, m_view->GetRenderWindow()->GetMultiSamples() => returns 8.

and I called also :

m_view->GetRenderWindow()->LineSmoothingOn();
m_view->GetRenderWindow()->PolygonSmoothingOn();
m_view->GetRenderWindow()->PointSmoothingOn();

Thanks.

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://vtk.org/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: anti-aliasing

Mohamed Amine Mzoughi

Hello again,

If I do that, the chart is not visible anymore (the Qt widget is all black), if I change the renderer of the vtkContextView also  (the Qt widget is all white) !

I give up for the moment !

ParaView is a such complex software, that I can't trace the stuff related to anti-alisaing in it (reverse engineering ParaView it is tough : a complex build system, many layers, proxies, in fact, it's an oriented object mix of a lasagna and spaghetti code !).

Thanks anyway.

Le 26/12/2018 à 16:02, Paulo Carvalho a écrit :
Hi, Mohammed,

   Strange indeed.  Did you create the vtkRender object yourself or you just used the default one returned by GetRenderer()?   If the latter is your case, I recommend creating your own vtkRender:

m_renderer = vtkSmartPointer<vtkRenderer>::New();
m_renderer->UseFXAAOn();

    vtkFXAAOptions* const aaOpts = m_renderer->GetFXAAOptions();
     aaOpts->SetRelativeContrastThreshold(0.125);
     aaOpts->SetHardContrastThreshold(0.045);
     aaOpts->SetSubpixelBlendLimit(0.75);
     aaOpts->SetSubpixelContrastThreshold(0.25);
     aaOpts->SetUseHighQualityEndpoints(true);
     aaOpts->SetEndpointSearchIterations(12);

m_view->GetRenderWindow()->AddRenderer( m_renderer );

cheers,

Paulo


Em qua, 26 de dez de 2018 às 12:15, Mohamed Amine Mzoughi <[hidden email]> escreveu:

Hello Paulo,

Even without SmoothingOn* instructions, I still have a problem in my 2D charts (I use a subclass of vtkChartXY, same issue with vtkHistogramChart2D, I have rectangles in screen).

In ParaView, the line is smooth :


whereas in my VTK app, it isn't :



I don't know the issue...

I'm calling the FXAA instructions before Render() in the constructor, I tried even to call them before each call to Render().

Best regards.

Le 26/12/2018 à 14:21, Paulo Carvalho a écrit :
Hello, Mohamed!

  It seems that your last calls (*SmoothingOn()) conflict with UseFXAAOn().

Here is the output I get when I add a call to PolygonSmoothingOn().  Not only it is not antialiased, but you can notice the edges triangle strips, visually ruining the results:

image.png

This one is rendered with only UseFXAAOn() and some configuration to the vtkFXAAOptions object like you did:
image.png

kind regards,

Paulo

Em qua, 26 de dez de 2018 às 10:03, Mohamed Amine Mzoughi <[hidden email]> escreveu:
Hello,

I want to enable Anti-alisaing in my VTK app, so I took some parameters
from ParaView and it still doesn't work :

     m_view->GetRenderer()->UseFXAAOn(); // enable AA

     vtkFXAAOptions* const aaOpts = m_view->GetRenderer()->GetFXAAOptions();
     aaOpts->SetRelativeContrastThreshold(0.125);
     aaOpts->SetHardContrastThreshold(0.045);
     aaOpts->SetSubpixelBlendLimit(0.75);
     aaOpts->SetSubpixelContrastThreshold(0.25);
     aaOpts->SetUseHighQualityEndpoints(true);
     aaOpts->SetEndpointSearchIterations(12);

what am I missing ?

Also, m_view->GetRenderWindow()->GetMultiSamples() => returns 8.

and I called also :

m_view->GetRenderWindow()->LineSmoothingOn();
m_view->GetRenderWindow()->PolygonSmoothingOn();
m_view->GetRenderWindow()->PointSmoothingOn();

Thanks.

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://vtk.org/mailman/listinfo/vtkusers



_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://vtk.org/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: anti-aliasing

Paulo Carvalho
Hi, Mohammed,

      Yes, I know that feeling...  Paraview is complex, yes.  It's difficult to get the hang of its code in a glimpse.  Either you invest the time to dissect the code or look into something simpler.  You may take a look at how I setup a VTK viewer: https://github.com/PauloCarvalhoRJ/gammaray/blob/master/viewer3d/view3dwidget.cpp (It's several orders of magnitude simpler than Paraview).  It's a 3D viewer in a Qt window though.  I've never tried VTK charts myself (I use the more lightweight Qwt and Qt Charts APIs for that).

regards,

Paulo

Em qua, 26 de dez de 2018 às 13:38, Mohamed Amine Mzoughi <[hidden email]> escreveu:

Hello again,

If I do that, the chart is not visible anymore (the Qt widget is all black), if I change the renderer of the vtkContextView also  (the Qt widget is all white) !

I give up for the moment !

ParaView is a such complex software, that I can't trace the stuff related to anti-alisaing in it (reverse engineering ParaView it is tough : a complex build system, many layers, proxies, in fact, it's an oriented object mix of a lasagna and spaghetti code !).

Thanks anyway.

Le 26/12/2018 à 16:02, Paulo Carvalho a écrit :
Hi, Mohammed,

   Strange indeed.  Did you create the vtkRender object yourself or you just used the default one returned by GetRenderer()?   If the latter is your case, I recommend creating your own vtkRender:

m_renderer = vtkSmartPointer<vtkRenderer>::New();
m_renderer->UseFXAAOn();

    vtkFXAAOptions* const aaOpts = m_renderer->GetFXAAOptions();
     aaOpts->SetRelativeContrastThreshold(0.125);
     aaOpts->SetHardContrastThreshold(0.045);
     aaOpts->SetSubpixelBlendLimit(0.75);
     aaOpts->SetSubpixelContrastThreshold(0.25);
     aaOpts->SetUseHighQualityEndpoints(true);
     aaOpts->SetEndpointSearchIterations(12);

m_view->GetRenderWindow()->AddRenderer( m_renderer );

cheers,

Paulo


Em qua, 26 de dez de 2018 às 12:15, Mohamed Amine Mzoughi <[hidden email]> escreveu:

Hello Paulo,

Even without SmoothingOn* instructions, I still have a problem in my 2D charts (I use a subclass of vtkChartXY, same issue with vtkHistogramChart2D, I have rectangles in screen).

In ParaView, the line is smooth :


whereas in my VTK app, it isn't :



I don't know the issue...

I'm calling the FXAA instructions before Render() in the constructor, I tried even to call them before each call to Render().

Best regards.

Le 26/12/2018 à 14:21, Paulo Carvalho a écrit :
Hello, Mohamed!

  It seems that your last calls (*SmoothingOn()) conflict with UseFXAAOn().

Here is the output I get when I add a call to PolygonSmoothingOn().  Not only it is not antialiased, but you can notice the edges triangle strips, visually ruining the results:

image.png

This one is rendered with only UseFXAAOn() and some configuration to the vtkFXAAOptions object like you did:
image.png

kind regards,

Paulo

Em qua, 26 de dez de 2018 às 10:03, Mohamed Amine Mzoughi <[hidden email]> escreveu:
Hello,

I want to enable Anti-alisaing in my VTK app, so I took some parameters
from ParaView and it still doesn't work :

     m_view->GetRenderer()->UseFXAAOn(); // enable AA

     vtkFXAAOptions* const aaOpts = m_view->GetRenderer()->GetFXAAOptions();
     aaOpts->SetRelativeContrastThreshold(0.125);
     aaOpts->SetHardContrastThreshold(0.045);
     aaOpts->SetSubpixelBlendLimit(0.75);
     aaOpts->SetSubpixelContrastThreshold(0.25);
     aaOpts->SetUseHighQualityEndpoints(true);
     aaOpts->SetEndpointSearchIterations(12);

what am I missing ?

Also, m_view->GetRenderWindow()->GetMultiSamples() => returns 8.

and I called also :

m_view->GetRenderWindow()->LineSmoothingOn();
m_view->GetRenderWindow()->PolygonSmoothingOn();
m_view->GetRenderWindow()->PointSmoothingOn();

Thanks.

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://vtk.org/mailman/listinfo/vtkusers



_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://vtk.org/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: anti-aliasing

Andras Lasso
In reply to this post by Mohamed Amine Mzoughi

To activate anti-aliasing, you can enable FXAA in the renderer using renderer.UseFXAAOn() or set number of samples in the render window using renderWindow.setMultiSamples(8) (if you render in a Qt widget, adjust samples property in the window’s surface format - http://doc.qt.io/qt-5/qsurfaceformat.html#setSamples). Anti-aliasing has impact on performance and may not be compatible with some rendering options.

 

Andras

 

From: vtkusers <[hidden email]> On Behalf Of Mohamed Amine Mzoughi
Sent: Wednesday, December 26, 2018 10:38 AM
To: Paulo Carvalho <[hidden email]>; [hidden email]
Subject: Re: [vtkusers] anti-aliasing

 

Hello again,

If I do that, the chart is not visible anymore (the Qt widget is all black), if I change the renderer of the vtkContextView also  (the Qt widget is all white) !

I give up for the moment !

ParaView is a such complex software, that I can't trace the stuff related to anti-alisaing in it (reverse engineering ParaView it is tough : a complex build system, many layers, proxies, in fact, it's an oriented object mix of a lasagna and spaghetti code !).

Thanks anyway.

Le 26/12/2018 à 16:02, Paulo Carvalho a écrit :

Hi, Mohammed,

   Strange indeed.  Did you create the vtkRender object yourself or you just used the default one returned by GetRenderer()?   If the latter is your case, I recommend creating your own vtkRender:


m_renderer = vtkSmartPointer<vtkRenderer>::New();
m_renderer->UseFXAAOn();

    vtkFXAAOptions* const aaOpts = m_renderer->GetFXAAOptions();
     aaOpts->SetRelativeContrastThreshold(0.125);
     aaOpts->SetHardContrastThreshold(0.045);
     aaOpts->SetSubpixelBlendLimit(0.75);
     aaOpts->SetSubpixelContrastThreshold(0.25);
     aaOpts->SetUseHighQualityEndpoints(true);
     aaOpts->SetEndpointSearchIterations(12);

m_view->GetRenderWindow()->AddRenderer( m_renderer );

 

cheers,

Paulo

 

 

Em qua, 26 de dez de 2018 às 12:15, Mohamed Amine Mzoughi <[hidden email]> escreveu:

Hello Paulo,

Even without SmoothingOn* instructions, I still have a problem in my 2D charts (I use a subclass of vtkChartXY, same issue with vtkHistogramChart2D, I have rectangles in screen).

In ParaView, the line is smooth :


whereas in my VTK app, it isn't :



I don't know the issue...

I'm calling the FXAA instructions before Render() in the constructor, I tried even to call them before each call to Render().

Best regards.

Le 26/12/2018 à 14:21, Paulo Carvalho a écrit :

Hello, Mohamed!

  It seems that your last calls (*SmoothingOn()) conflict with UseFXAAOn().

Here is the output I get when I add a call to PolygonSmoothingOn().  Not only it is not antialiased, but you can notice the edges triangle strips, visually ruining the results:

image.png

This one is rendered with only UseFXAAOn() and some configuration to the vtkFXAAOptions object like you did:

image.png

kind regards,

Paulo

 

Em qua, 26 de dez de 2018 às 10:03, Mohamed Amine Mzoughi <[hidden email]> escreveu:

Hello,

I want to enable Anti-alisaing in my VTK app, so I took some parameters
from ParaView and it still doesn't work :

     m_view->GetRenderer()->UseFXAAOn(); // enable AA

     vtkFXAAOptions* const aaOpts = m_view->GetRenderer()->GetFXAAOptions();
     aaOpts->SetRelativeContrastThreshold(0.125);
     aaOpts->SetHardContrastThreshold(0.045);
     aaOpts->SetSubpixelBlendLimit(0.75);
     aaOpts->SetSubpixelContrastThreshold(0.25);
     aaOpts->SetUseHighQualityEndpoints(true);
     aaOpts->SetEndpointSearchIterations(12);

what am I missing ?

Also, m_view->GetRenderWindow()->GetMultiSamples() => returns 8.

and I called also :

m_view->GetRenderWindow()->LineSmoothingOn();
m_view->GetRenderWindow()->PolygonSmoothingOn();
m_view->GetRenderWindow()->PointSmoothingOn();

Thanks.

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://vtk.org/mailman/listinfo/vtkusers

 

 


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://vtk.org/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: anti-aliasing

Mohamed Amine Mzoughi

As you can see in the screenshots below, I was unable to smooth vtkChartXY's plot line (displayed on a QVTKOpenGLWidget) plot with UseFXAAOn and setMultiSamples(8) (multi samples is defaulted to 8 anyway).

Changing the surface format's samples number messed badly the 2D charts with black areas. This is what I've done in constructor :

QSurfaceFormat surface = m_widget->format();
std::cout << "[debug] Qt widget samples = " << surface.samples() << std::endl; // 0 by default (disabled)
surface.setSamples(8);
m_widget->setFormat(surface);

Regards.

Le 27/12/2018 à 22:45, Andras Lasso a écrit :

To activate anti-aliasing, you can enable FXAA in the renderer using renderer.UseFXAAOn() or set number of samples in the render window using renderWindow.setMultiSamples(8) (if you render in a Qt widget, adjust samples property in the window’s surface format - http://doc.qt.io/qt-5/qsurfaceformat.html#setSamples). Anti-aliasing has impact on performance and may not be compatible with some rendering options.

 

Andras

 

From: vtkusers [hidden email] On Behalf Of Mohamed Amine Mzoughi
Sent: Wednesday, December 26, 2018 10:38 AM
To: Paulo Carvalho [hidden email]; [hidden email]
Subject: Re: [vtkusers] anti-aliasing

 

Hello again,

If I do that, the chart is not visible anymore (the Qt widget is all black), if I change the renderer of the vtkContextView also  (the Qt widget is all white) !

I give up for the moment !

ParaView is a such complex software, that I can't trace the stuff related to anti-alisaing in it (reverse engineering ParaView it is tough : a complex build system, many layers, proxies, in fact, it's an oriented object mix of a lasagna and spaghetti code !).

Thanks anyway.

Le 26/12/2018 à 16:02, Paulo Carvalho a écrit :

Hi, Mohammed,

   Strange indeed.  Did you create the vtkRender object yourself or you just used the default one returned by GetRenderer()?   If the latter is your case, I recommend creating your own vtkRender:


m_renderer = vtkSmartPointer<vtkRenderer>::New();
m_renderer->UseFXAAOn();

    vtkFXAAOptions* const aaOpts = m_renderer->GetFXAAOptions();
     aaOpts->SetRelativeContrastThreshold(0.125);
     aaOpts->SetHardContrastThreshold(0.045);
     aaOpts->SetSubpixelBlendLimit(0.75);
     aaOpts->SetSubpixelContrastThreshold(0.25);
     aaOpts->SetUseHighQualityEndpoints(true);
     aaOpts->SetEndpointSearchIterations(12);

m_view->GetRenderWindow()->AddRenderer( m_renderer );

 

cheers,

Paulo

 

 

Em qua, 26 de dez de 2018 às 12:15, Mohamed Amine Mzoughi <[hidden email]> escreveu:

Hello Paulo,

Even without SmoothingOn* instructions, I still have a problem in my 2D charts (I use a subclass of vtkChartXY, same issue with vtkHistogramChart2D, I have rectangles in screen).

In ParaView, the line is smooth :


whereas in my VTK app, it isn't :



I don't know the issue...

I'm calling the FXAA instructions before Render() in the constructor, I tried even to call them before each call to Render().

Best regards.

Le 26/12/2018 à 14:21, Paulo Carvalho a écrit :

Hello, Mohamed!

  It seems that your last calls (*SmoothingOn()) conflict with UseFXAAOn().

Here is the output I get when I add a call to PolygonSmoothingOn().  Not only it is not antialiased, but you can notice the edges triangle strips, visually ruining the results:

image.png

This one is rendered with only UseFXAAOn() and some configuration to the vtkFXAAOptions object like you did:

image.png

kind regards,

Paulo

 

Em qua, 26 de dez de 2018 às 10:03, Mohamed Amine Mzoughi <[hidden email]> escreveu:

Hello,

I want to enable Anti-alisaing in my VTK app, so I took some parameters
from ParaView and it still doesn't work :

     m_view->GetRenderer()->UseFXAAOn(); // enable AA

     vtkFXAAOptions* const aaOpts = m_view->GetRenderer()->GetFXAAOptions();
     aaOpts->SetRelativeContrastThreshold(0.125);
     aaOpts->SetHardContrastThreshold(0.045);
     aaOpts->SetSubpixelBlendLimit(0.75);
     aaOpts->SetSubpixelContrastThreshold(0.25);
     aaOpts->SetUseHighQualityEndpoints(true);
     aaOpts->SetEndpointSearchIterations(12);

what am I missing ?

Also, m_view->GetRenderWindow()->GetMultiSamples() => returns 8.

and I called also :

m_view->GetRenderWindow()->LineSmoothingOn();
m_view->GetRenderWindow()->PolygonSmoothingOn();
m_view->GetRenderWindow()->PointSmoothingOn();

Thanks.

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://vtk.org/mailman/listinfo/vtkusers

 

 



_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://vtk.org/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: anti-aliasing

Andras Lasso

Multi-sampling works well for me (it smoothes lines, etc.) except axes areas appear black. This is probably a VTK bug that should be fixed, but maybe I just have not configured everything correctly.

 

ParaView uses multi-sampling for anti-aliasing in plots and not FXAA (https://github.com/Kitware/ParaView/blob/master/Qt/Core/pqContextView.cxx#L143, https://gitlab.kitware.com/paraview/paraview/issues/17202). Anti-aliasing in plots works well in Paraview 5.5.2 (smooth lines, properly rendered axes). There is no antialiasing in plots in ParaView 5.6.0 (lines are jagged), so there may be some multi-sampling related issues in recent VTK version.

 

Andras

 

From: Mohamed Amine Mzoughi <[hidden email]>
Sent: Friday, December 28, 2018 10:01 AM
To: Andras Lasso <[hidden email]>; Paulo Carvalho <[hidden email]>; [hidden email]
Subject: Re: [vtkusers] anti-aliasing

 

As you can see in the screenshots below, I was unable to smooth vtkChartXY's plot line (displayed on a QVTKOpenGLWidget) plot with UseFXAAOn and setMultiSamples(8) (multi samples is defaulted to 8 anyway).

Changing the surface format's samples number messed badly the 2D charts with black areas. This is what I've done in constructor :

QSurfaceFormat surface = m_widget->format();
std::cout << "[debug] Qt widget samples = " << surface.samples() << std::endl; // 0 by default (disabled)
surface.setSamples(8);
m_widget->setFormat(surface);

Regards.

Le 27/12/2018 à 22:45, Andras Lasso a écrit :

To activate anti-aliasing, you can enable FXAA in the renderer using renderer.UseFXAAOn() or set number of samples in the render window using renderWindow.setMultiSamples(8) (if you render in a Qt widget, adjust samples property in the window’s surface format - http://doc.qt.io/qt-5/qsurfaceformat.html#setSamples). Anti-aliasing has impact on performance and may not be compatible with some rendering options.

 

Andras

 

From: vtkusers [hidden email] On Behalf Of Mohamed Amine Mzoughi
Sent: Wednesday, December 26, 2018 10:38 AM
To: Paulo Carvalho [hidden email]; [hidden email]
Subject: Re: [vtkusers] anti-aliasing

 

Hello again,

If I do that, the chart is not visible anymore (the Qt widget is all black), if I change the renderer of the vtkContextView also  (the Qt widget is all white) !

I give up for the moment !

ParaView is a such complex software, that I can't trace the stuff related to anti-alisaing in it (reverse engineering ParaView it is tough : a complex build system, many layers, proxies, in fact, it's an oriented object mix of a lasagna and spaghetti code !).

Thanks anyway.

Le 26/12/2018 à 16:02, Paulo Carvalho a écrit :

Hi, Mohammed,

   Strange indeed.  Did you create the vtkRender object yourself or you just used the default one returned by GetRenderer()?   If the latter is your case, I recommend creating your own vtkRender:


m_renderer = vtkSmartPointer<vtkRenderer>::New();
m_renderer->UseFXAAOn();

    vtkFXAAOptions* const aaOpts = m_renderer->GetFXAAOptions();
     aaOpts->SetRelativeContrastThreshold(0.125);
     aaOpts->SetHardContrastThreshold(0.045);
     aaOpts->SetSubpixelBlendLimit(0.75);
     aaOpts->SetSubpixelContrastThreshold(0.25);
     aaOpts->SetUseHighQualityEndpoints(true);
     aaOpts->SetEndpointSearchIterations(12);

m_view->GetRenderWindow()->AddRenderer( m_renderer );

 

cheers,

Paulo

 

 

Em qua, 26 de dez de 2018 às 12:15, Mohamed Amine Mzoughi <[hidden email]> escreveu:

Hello Paulo,

Even without SmoothingOn* instructions, I still have a problem in my 2D charts (I use a subclass of vtkChartXY, same issue with vtkHistogramChart2D, I have rectangles in screen).

In ParaView, the line is smooth :


whereas in my VTK app, it isn't :



I don't know the issue...

I'm calling the FXAA instructions before Render() in the constructor, I tried even to call them before each call to Render().

Best regards.

Le 26/12/2018 à 14:21, Paulo Carvalho a écrit :

Hello, Mohamed!

  It seems that your last calls (*SmoothingOn()) conflict with UseFXAAOn().

Here is the output I get when I add a call to PolygonSmoothingOn().  Not only it is not antialiased, but you can notice the edges triangle strips, visually ruining the results:

image.png

This one is rendered with only UseFXAAOn() and some configuration to the vtkFXAAOptions object like you did:

image.png

kind regards,

Paulo

 

Em qua, 26 de dez de 2018 às 10:03, Mohamed Amine Mzoughi <[hidden email]> escreveu:

Hello,

I want to enable Anti-alisaing in my VTK app, so I took some parameters
from ParaView and it still doesn't work :

     m_view->GetRenderer()->UseFXAAOn(); // enable AA

     vtkFXAAOptions* const aaOpts = m_view->GetRenderer()->GetFXAAOptions();
     aaOpts->SetRelativeContrastThreshold(0.125);
     aaOpts->SetHardContrastThreshold(0.045);
     aaOpts->SetSubpixelBlendLimit(0.75);
     aaOpts->SetSubpixelContrastThreshold(0.25);
     aaOpts->SetUseHighQualityEndpoints(true);
     aaOpts->SetEndpointSearchIterations(12);

what am I missing ?

Also, m_view->GetRenderWindow()->GetMultiSamples() => returns 8.

and I called also :

m_view->GetRenderWindow()->LineSmoothingOn();
m_view->GetRenderWindow()->PolygonSmoothingOn();
m_view->GetRenderWindow()->PointSmoothingOn();

Thanks.

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://vtk.org/mailman/listinfo/vtkusers

 

 

 


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://vtk.org/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: anti-aliasing

Andras Lasso

Plot axes are not painted correctly when multi-sampling is enabled due to an OpenGL error in vtkTextureObject::CopyFromFrameBuffer, which seems to be related to copying data from the frame buffer.

 

[ERROR][VTK] 28.12.2018 12:51:01 [vtkTextureObject (0000026457878B60)] (C:\D\S4D\VTK\Rendering\OpenGL2\vtkTextureObject.cxx:1990) - failed at glCopyTexImage2D 32856 1 OpenGL errors detected

0 : (1282) Invalid operation

 

Andras

 

 

From: Andras Lasso
Sent: Friday, December 28, 2018 12:52 PM
To: 'Mohamed Amine Mzoughi' <[hidden email]>; Paulo Carvalho <[hidden email]>; [hidden email]
Subject: RE: [vtkusers] anti-aliasing

 

Multi-sampling works well for me (it smoothes lines, etc.) except axes areas appear black. This is probably a VTK bug that should be fixed, but maybe I just have not configured everything correctly.

 

ParaView uses multi-sampling for anti-aliasing in plots and not FXAA (https://github.com/Kitware/ParaView/blob/master/Qt/Core/pqContextView.cxx#L143, https://gitlab.kitware.com/paraview/paraview/issues/17202). Anti-aliasing in plots works well in Paraview 5.5.2 (smooth lines, properly rendered axes). There is no antialiasing in plots in ParaView 5.6.0 (lines are jagged), so there may be some multi-sampling related issues in recent VTK version.

 

Andras

 

From: Mohamed Amine Mzoughi <[hidden email]>
Sent: Friday, December 28, 2018 10:01 AM
To: Andras Lasso <[hidden email]>; Paulo Carvalho <[hidden email]>; [hidden email]
Subject: Re: [vtkusers] anti-aliasing

 

As you can see in the screenshots below, I was unable to smooth vtkChartXY's plot line (displayed on a QVTKOpenGLWidget) plot with UseFXAAOn and setMultiSamples(8) (multi samples is defaulted to 8 anyway).

Changing the surface format's samples number messed badly the 2D charts with black areas. This is what I've done in constructor :

QSurfaceFormat surface = m_widget->format();
std::cout << "[debug] Qt widget samples = " << surface.samples() << std::endl; // 0 by default (disabled)
surface.setSamples(8);
m_widget->setFormat(surface);

Regards.

Le 27/12/2018 à 22:45, Andras Lasso a écrit :

To activate anti-aliasing, you can enable FXAA in the renderer using renderer.UseFXAAOn() or set number of samples in the render window using renderWindow.setMultiSamples(8) (if you render in a Qt widget, adjust samples property in the window’s surface format - http://doc.qt.io/qt-5/qsurfaceformat.html#setSamples). Anti-aliasing has impact on performance and may not be compatible with some rendering options.

 

Andras

 

From: vtkusers [hidden email] On Behalf Of Mohamed Amine Mzoughi
Sent: Wednesday, December 26, 2018 10:38 AM
To: Paulo Carvalho [hidden email]; [hidden email]
Subject: Re: [vtkusers] anti-aliasing

 

Hello again,

If I do that, the chart is not visible anymore (the Qt widget is all black), if I change the renderer of the vtkContextView also  (the Qt widget is all white) !

I give up for the moment !

ParaView is a such complex software, that I can't trace the stuff related to anti-alisaing in it (reverse engineering ParaView it is tough : a complex build system, many layers, proxies, in fact, it's an oriented object mix of a lasagna and spaghetti code !).

Thanks anyway.

Le 26/12/2018 à 16:02, Paulo Carvalho a écrit :

Hi, Mohammed,

   Strange indeed.  Did you create the vtkRender object yourself or you just used the default one returned by GetRenderer()?   If the latter is your case, I recommend creating your own vtkRender:


m_renderer = vtkSmartPointer<vtkRenderer>::New();
m_renderer->UseFXAAOn();

    vtkFXAAOptions* const aaOpts = m_renderer->GetFXAAOptions();
     aaOpts->SetRelativeContrastThreshold(0.125);
     aaOpts->SetHardContrastThreshold(0.045);
     aaOpts->SetSubpixelBlendLimit(0.75);
     aaOpts->SetSubpixelContrastThreshold(0.25);
     aaOpts->SetUseHighQualityEndpoints(true);
     aaOpts->SetEndpointSearchIterations(12);

m_view->GetRenderWindow()->AddRenderer( m_renderer );

 

cheers,

Paulo

 

 

Em qua, 26 de dez de 2018 às 12:15, Mohamed Amine Mzoughi <[hidden email]> escreveu:

Hello Paulo,

Even without SmoothingOn* instructions, I still have a problem in my 2D charts (I use a subclass of vtkChartXY, same issue with vtkHistogramChart2D, I have rectangles in screen).

In ParaView, the line is smooth :


whereas in my VTK app, it isn't :



I don't know the issue...

I'm calling the FXAA instructions before Render() in the constructor, I tried even to call them before each call to Render().

Best regards.

Le 26/12/2018 à 14:21, Paulo Carvalho a écrit :

Hello, Mohamed!

  It seems that your last calls (*SmoothingOn()) conflict with UseFXAAOn().

Here is the output I get when I add a call to PolygonSmoothingOn().  Not only it is not antialiased, but you can notice the edges triangle strips, visually ruining the results:

image.png

This one is rendered with only UseFXAAOn() and some configuration to the vtkFXAAOptions object like you did:

image.png

kind regards,

Paulo

 

Em qua, 26 de dez de 2018 às 10:03, Mohamed Amine Mzoughi <[hidden email]> escreveu:

Hello,

I want to enable Anti-alisaing in my VTK app, so I took some parameters
from ParaView and it still doesn't work :

     m_view->GetRenderer()->UseFXAAOn(); // enable AA

     vtkFXAAOptions* const aaOpts = m_view->GetRenderer()->GetFXAAOptions();
     aaOpts->SetRelativeContrastThreshold(0.125);
     aaOpts->SetHardContrastThreshold(0.045);
     aaOpts->SetSubpixelBlendLimit(0.75);
     aaOpts->SetSubpixelContrastThreshold(0.25);
     aaOpts->SetUseHighQualityEndpoints(true);
     aaOpts->SetEndpointSearchIterations(12);

what am I missing ?

Also, m_view->GetRenderWindow()->GetMultiSamples() => returns 8.

and I called also :

m_view->GetRenderWindow()->LineSmoothingOn();
m_view->GetRenderWindow()->PolygonSmoothingOn();
m_view->GetRenderWindow()->PointSmoothingOn();

Thanks.

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://vtk.org/mailman/listinfo/vtkusers

 

 

 


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://vtk.org/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: anti-aliasing

Mohamed Amine Mzoughi

Hello Andras,

Thank you very much, in fact, calling the antialisaing code of pqContextView::createWidget() after creating a QVTKOpenGLWidget fixed my aliasing problem (https://github.com/Kitware/ParaView/blob/master/Qt/Core/pqContextView.cxx#L143)

BTW, I am using an old version of ParaView (and also VTK) as I'm working under Centos 7 (but I will update VTK/Paraview when the version 8 is released).

Happy New Year 2019.

Amine.

Le 28/12/2018 à 19:03, Andras Lasso a écrit :

Plot axes are not painted correctly when multi-sampling is enabled due to an OpenGL error in vtkTextureObject::CopyFromFrameBuffer, which seems to be related to copying data from the frame buffer.

 

[ERROR][VTK] 28.12.2018 12:51:01 [vtkTextureObject (0000026457878B60)] (C:\D\S4D\VTK\Rendering\OpenGL2\vtkTextureObject.cxx:1990) - failed at glCopyTexImage2D 32856 1 OpenGL errors detected

0 : (1282) Invalid operation

 

Andras

 

 

From: Andras Lasso
Sent: Friday, December 28, 2018 12:52 PM
To: 'Mohamed Amine Mzoughi' [hidden email]; Paulo Carvalho [hidden email]; [hidden email]
Subject: RE: [vtkusers] anti-aliasing

 

Multi-sampling works well for me (it smoothes lines, etc.) except axes areas appear black. This is probably a VTK bug that should be fixed, but maybe I just have not configured everything correctly.

 

ParaView uses multi-sampling for anti-aliasing in plots and not FXAA (https://github.com/Kitware/ParaView/blob/master/Qt/Core/pqContextView.cxx#L143, https://gitlab.kitware.com/paraview/paraview/issues/17202). Anti-aliasing in plots works well in Paraview 5.5.2 (smooth lines, properly rendered axes). There is no antialiasing in plots in ParaView 5.6.0 (lines are jagged), so there may be some multi-sampling related issues in recent VTK version.

 

Andras

 

From: Mohamed Amine Mzoughi <[hidden email]>
Sent: Friday, December 28, 2018 10:01 AM
To: Andras Lasso <[hidden email]>; Paulo Carvalho <[hidden email]>; [hidden email]
Subject: Re: [vtkusers] anti-aliasing

 

As you can see in the screenshots below, I was unable to smooth vtkChartXY's plot line (displayed on a QVTKOpenGLWidget) plot with UseFXAAOn and setMultiSamples(8) (multi samples is defaulted to 8 anyway).

Changing the surface format's samples number messed badly the 2D charts with black areas. This is what I've done in constructor :

QSurfaceFormat surface = m_widget->format();
std::cout << "[debug] Qt widget samples = " << surface.samples() << std::endl; // 0 by default (disabled)
surface.setSamples(8);
m_widget->setFormat(surface);

Regards.

Le 27/12/2018 à 22:45, Andras Lasso a écrit :

To activate anti-aliasing, you can enable FXAA in the renderer using renderer.UseFXAAOn() or set number of samples in the render window using renderWindow.setMultiSamples(8) (if you render in a Qt widget, adjust samples property in the window’s surface format - http://doc.qt.io/qt-5/qsurfaceformat.html#setSamples). Anti-aliasing has impact on performance and may not be compatible with some rendering options.

 

Andras

 

From: vtkusers [hidden email] On Behalf Of Mohamed Amine Mzoughi
Sent: Wednesday, December 26, 2018 10:38 AM
To: Paulo Carvalho [hidden email]; [hidden email]
Subject: Re: [vtkusers] anti-aliasing

 

Hello again,

If I do that, the chart is not visible anymore (the Qt widget is all black), if I change the renderer of the vtkContextView also  (the Qt widget is all white) !

I give up for the moment !

ParaView is a such complex software, that I can't trace the stuff related to anti-alisaing in it (reverse engineering ParaView it is tough : a complex build system, many layers, proxies, in fact, it's an oriented object mix of a lasagna and spaghetti code !).

Thanks anyway.

Le 26/12/2018 à 16:02, Paulo Carvalho a écrit :

Hi, Mohammed,

   Strange indeed.  Did you create the vtkRender object yourself or you just used the default one returned by GetRenderer()?   If the latter is your case, I recommend creating your own vtkRender:


m_renderer = vtkSmartPointer<vtkRenderer>::New();
m_renderer->UseFXAAOn();

    vtkFXAAOptions* const aaOpts = m_renderer->GetFXAAOptions();
     aaOpts->SetRelativeContrastThreshold(0.125);
     aaOpts->SetHardContrastThreshold(0.045);
     aaOpts->SetSubpixelBlendLimit(0.75);
     aaOpts->SetSubpixelContrastThreshold(0.25);
     aaOpts->SetUseHighQualityEndpoints(true);
     aaOpts->SetEndpointSearchIterations(12);

m_view->GetRenderWindow()->AddRenderer( m_renderer );

 

cheers,

Paulo

 

 

Em qua, 26 de dez de 2018 às 12:15, Mohamed Amine Mzoughi <[hidden email]> escreveu:

Hello Paulo,

Even without SmoothingOn* instructions, I still have a problem in my 2D charts (I use a subclass of vtkChartXY, same issue with vtkHistogramChart2D, I have rectangles in screen).

In ParaView, the line is smooth :


whereas in my VTK app, it isn't :



I don't know the issue...

I'm calling the FXAA instructions before Render() in the constructor, I tried even to call them before each call to Render().

Best regards.

Le 26/12/2018 à 14:21, Paulo Carvalho a écrit :

Hello, Mohamed!

  It seems that your last calls (*SmoothingOn()) conflict with UseFXAAOn().

Here is the output I get when I add a call to PolygonSmoothingOn().  Not only it is not antialiased, but you can notice the edges triangle strips, visually ruining the results:

image.png

This one is rendered with only UseFXAAOn() and some configuration to the vtkFXAAOptions object like you did:

image.png

kind regards,

Paulo

 

Em qua, 26 de dez de 2018 às 10:03, Mohamed Amine Mzoughi <[hidden email]> escreveu:

Hello,

I want to enable Anti-alisaing in my VTK app, so I took some parameters
from ParaView and it still doesn't work :

     m_view->GetRenderer()->UseFXAAOn(); // enable AA

     vtkFXAAOptions* const aaOpts = m_view->GetRenderer()->GetFXAAOptions();
     aaOpts->SetRelativeContrastThreshold(0.125);
     aaOpts->SetHardContrastThreshold(0.045);
     aaOpts->SetSubpixelBlendLimit(0.75);
     aaOpts->SetSubpixelContrastThreshold(0.25);
     aaOpts->SetUseHighQualityEndpoints(true);
     aaOpts->SetEndpointSearchIterations(12);

what am I missing ?

Also, m_view->GetRenderWindow()->GetMultiSamples() => returns 8.

and I called also :

m_view->GetRenderWindow()->LineSmoothingOn();
m_view->GetRenderWindow()->PolygonSmoothingOn();
m_view->GetRenderWindow()->PointSmoothingOn();

Thanks.

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://vtk.org/mailman/listinfo/vtkusers

 

 

 



_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://vtk.org/mailman/listinfo/vtkusers