[vtkusers] anti-aliasing

Andras Lasso lasso at queensu.ca
Fri Dec 28 13:03:38 EST 2018


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' <aminemzoughi at febus-optics.com>; Paulo Carvalho <paulo.r.m.carvalho at gmail.com>; vtkusers at public.kitware.com
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 <aminemzoughi at febus-optics.com<mailto:aminemzoughi at febus-optics.com>>
Sent: Friday, December 28, 2018 10:01 AM
To: Andras Lasso <lasso at queensu.ca<mailto:lasso at queensu.ca>>; Paulo Carvalho <paulo.r.m.carvalho at gmail.com<mailto:paulo.r.m.carvalho at gmail.com>>; vtkusers at public.kitware.com<mailto:vtkusers at public.kitware.com>
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<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fdoc.qt.io%2Fqt-5%2Fqsurfaceformat.html%23setSamples&data=02%7C01%7Classo%40queensu.ca%7C753aca6286994b17a15d08d66cd53b4f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636816060432571103&sdata=kKNCZ2h%2FT81oqw77gwhW4lT%2BcLqeLtxOlvFuHOciieY%3D&reserved=0>). Anti-aliasing has impact on performance and may not be compatible with some rendering options.

Andras

From: vtkusers <vtkusers-bounces at vtk.org><mailto:vtkusers-bounces at vtk.org> On Behalf Of Mohamed Amine Mzoughi
Sent: Wednesday, December 26, 2018 10:38 AM
To: Paulo Carvalho <paulo.r.m.carvalho at gmail.com><mailto:paulo.r.m.carvalho at gmail.com>; vtkusers at public.kitware.com<mailto:vtkusers at public.kitware.com>
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 <aminemzoughi at febus-optics.com<mailto:aminemzoughi at febus-optics.com>> 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 :
[cid:image001.png at 01D49EAD.6AE04340]
whereas in my VTK app, it isn't :

[cid:image002.png at 01D49EAD.6AE04340]

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 <aminemzoughi at febus-optics.com<mailto:aminemzoughi at febus-optics.com>> 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<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com&data=02%7C01%7Classo%40queensu.ca%7C753aca6286994b17a15d08d66cd53b4f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636816060432571103&sdata=jBV4IH%2BQQc1bpyuRtZOlM%2Bowogpb4Cy8A4jmUkU4C48%3D&reserved=0>

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html&data=02%7C01%7Classo%40queensu.ca%7C753aca6286994b17a15d08d66cd53b4f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636816060432581112&sdata=52HKzi9ShkYag67JeS8ouv4wis13CIIL6GvioUNBtJk%3D&reserved=0>

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.vtk.org%2FWiki%2FVTK_FAQ&data=02%7C01%7Classo%40queensu.ca%7C753aca6286994b17a15d08d66cd53b4f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636816060432591117&sdata=lGcYuj%2F57RWY8xjUFrMIJ0ltK7Xasp1ZJV5kvozqE74%3D&reserved=0>

Search the list archives at: http://markmail.org/search/?q=vtkusers<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkmail.org%2Fsearch%2F%3Fq%3Dvtkusers&data=02%7C01%7Classo%40queensu.ca%7C753aca6286994b17a15d08d66cd53b4f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636816060432591117&sdata=ccWnZ3Z0SdmnP532RYbNvZOLUzp%2Bio8VdnO%2Bb%2B%2BTzUk%3D&reserved=0>

Follow this link to subscribe/unsubscribe:
https://vtk.org/mailman/listinfo/vtkusers<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fvtk.org%2Fmailman%2Flistinfo%2Fvtkusers&data=02%7C01%7Classo%40queensu.ca%7C753aca6286994b17a15d08d66cd53b4f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636816060432601126&sdata=VOmUEluRAQurEKfCKg3wAo4KlQwDo4PUiruMWUzuM6I%3D&reserved=0>



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20181228/4f6ee5e0/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 35038 bytes
Desc: image001.png
URL: <https://vtk.org/pipermail/vtkusers/attachments/20181228/4f6ee5e0/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 14787 bytes
Desc: image002.png
URL: <https://vtk.org/pipermail/vtkusers/attachments/20181228/4f6ee5e0/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image004.jpg
Type: image/jpeg
Size: 54111 bytes
Desc: image004.jpg
URL: <https://vtk.org/pipermail/vtkusers/attachments/20181228/4f6ee5e0/attachment-0002.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image006.jpg
Type: image/jpeg
Size: 48918 bytes
Desc: image006.jpg
URL: <https://vtk.org/pipermail/vtkusers/attachments/20181228/4f6ee5e0/attachment-0003.jpg>


More information about the vtkusers mailing list