[vtkusers] anti-aliasing

Mohamed Amine Mzoughi aminemzoughi at febus-optics.com
Fri Dec 28 10:00:35 EST 2018


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 <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>; 
> 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 :
>
>
>         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
>             <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%7Cd59b33f462b04822b2bb08d66b4ac286%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636814366213770685&sdata=sS8BA%2FZ5H9Si5V4c90R1XjwY9sT0itroRaXSfGnnBx4%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%7Cd59b33f462b04822b2bb08d66b4ac286%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636814366213770685&sdata=PqpQ8CfjE3LqZfQXLA9l8Tm5OcCX83HbcL9V7vKx0wo%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%7Cd59b33f462b04822b2bb08d66b4ac286%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636814366213770685&sdata=VxgZVbYw8QhSn7qxaLPJgCvLUEKAeC5pNzD1xzkELwc%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%7Cd59b33f462b04822b2bb08d66b4ac286%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636814366213770685&sdata=3%2Fix16hWbHd5LDCE8iKhpgXAJ9Ild3qun947AmXTKls%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%7Cd59b33f462b04822b2bb08d66b4ac286%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636814366213770685&sdata=YYEcMFufeBBJPTWntI7le60pm8gK46aYFkALHtsJhjM%3D&reserved=0>
>

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


More information about the vtkusers mailing list