<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>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).</p>
    <p>Changing the surface format's samples number messed badly the 2D
      charts with black areas. This is what I've done in constructor :<br>
    </p>
    <p>QSurfaceFormat surface = m_widget->format();<br>
      std::cout << "[debug] Qt widget samples = " <<
      surface.samples() << std::endl; // 0 by default (disabled)<br>
      surface.setSamples(8);<br>
      m_widget->setFormat(surface);</p>
    <p>Regards.<br>
    </p>
    <div class="moz-cite-prefix">Le 27/12/2018 à 22:45, Andras Lasso a
      écrit :<br>
    </div>
    <blockquote type="cite"
cite="mid:YTOPR0101MB129273C5A14D2C35D1F80CEFD8B60@YTOPR0101MB1292.CANPRD01.PROD.OUTLOOK.COM">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]-->
      <style><!--
/* Font Definitions */
@font-face
        {font-family:Courier;
        panose-1:2 7 4 9 2 2 5 2 4 4;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        color:black;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal">To activate anti-aliasing, you can enable
          FXAA in the renderer using
          <span
            style="font-size:8.0pt;font-family:Courier;color:#000096">renderer.UseFXAAOn()
          </span>or set number of samples in the render window using <span
            style="font-size:8.0pt;font-family:Courier;color:#000096">
            renderWindow.setMultiSamples(8)</span> (if you render in a
          Qt widget, adjust samples property in the window’s surface
          format -
          <a href="http://doc.qt.io/qt-5/qsurfaceformat.html#setSamples"
            moz-do-not-send="true">http://doc.qt.io/qt-5/qsurfaceformat.html#setSamples</a>).
          Anti-aliasing has impact on performance and may not be
          compatible with some rendering options.<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">Andras<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <div>
          <div style="border:none;border-top:solid #E1E1E1
            1.0pt;padding:3.0pt 0in 0in 0in">
            <p class="MsoNormal"><b>From:</b> vtkusers
              <a class="moz-txt-link-rfc2396E" href="mailto:vtkusers-bounces@vtk.org"><vtkusers-bounces@vtk.org></a> <b>On Behalf Of
              </b>Mohamed Amine Mzoughi<br>
              <b>Sent:</b> Wednesday, December 26, 2018 10:38 AM<br>
              <b>To:</b> Paulo Carvalho
              <a class="moz-txt-link-rfc2396E" href="mailto:paulo.r.m.carvalho@gmail.com"><paulo.r.m.carvalho@gmail.com></a>;
              <a class="moz-txt-link-abbreviated" href="mailto:vtkusers@public.kitware.com">vtkusers@public.kitware.com</a><br>
              <b>Subject:</b> Re: [vtkusers] anti-aliasing<o:p></o:p></p>
          </div>
        </div>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p>Hello again,<o:p></o:p></p>
        <p>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) !<o:p></o:p></p>
        <p>I give up for the moment !<o:p></o:p></p>
        <p>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 !).<o:p></o:p></p>
        <p>Thanks anyway.<o:p></o:p></p>
        <div>
          <p class="MsoNormal">Le 26/12/2018 à 16:02, Paulo Carvalho a
            écrit :<o:p></o:p></p>
        </div>
        <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
          <div>
            <div>
              <div>
                <div>
                  <div>
                    <div>
                      <p class="MsoNormal" style="margin-bottom:12.0pt">Hi,
                        Mohammed,<o:p></o:p></p>
                    </div>
                    <p class="MsoNormal">   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:<o:p></o:p></p>
                  </div>
                  <div>
                    <p class="MsoNormal"><br>
                      <span style="color:maroon">m_renderer</span><span
                        style="color:silver"> </span>=<span
                        style="color:silver">
                      </span><span style="color:purple">vtkSmartPointer</span><<span
                        style="color:purple">vtkRenderer</span>>::<span
                        style="color:#00677C">New</span>();<br>
                      <span style="color:maroon">m_renderer</span>-><i><span
                          style="color:#00677C">UseFXAAOn</span></i>();<br>
                      <br>
                          vtkFXAAOptions* const aaOpts =
                      m_renderer->GetFXAAOptions();<br>
                          
                      aaOpts->SetRelativeContrastThreshold(0.125);<br>
                           aaOpts->SetHardContrastThreshold(0.045);<br>
                           aaOpts->SetSubpixelBlendLimit(0.75);<br>
                          
                      aaOpts->SetSubpixelContrastThreshold(0.25);<br>
                           aaOpts->SetUseHighQualityEndpoints(true);<br>
                           aaOpts->SetEndpointSearchIterations(12);<br>
                      <br>
                      <span style="color:maroon">m_view</span>-><i><span
                          style="color:#00677C">GetRenderWindow</span></i>()-><i><span
                          style="color:#00677C">AddRenderer</span></i>(<span
                        style="color:maroon"> m_renderer</span> );<o:p></o:p></p>
                  </div>
                  <div>
                    <p class="MsoNormal"><o:p> </o:p></p>
                  </div>
                  <div>
                    <p class="MsoNormal" style="margin-bottom:12.0pt">cheers,<o:p></o:p></p>
                  </div>
                  <div>
                    <p class="MsoNormal">Paulo<o:p></o:p></p>
                  </div>
                  <div>
                    <p class="MsoNormal"><o:p> </o:p></p>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <p class="MsoNormal"><o:p> </o:p></p>
          <div>
            <div>
              <p class="MsoNormal">Em qua, 26 de dez de 2018 às 12:15,
                Mohamed Amine Mzoughi <<a
                  href="mailto:aminemzoughi@febus-optics.com"
                  moz-do-not-send="true">aminemzoughi@febus-optics.com</a>>
                escreveu:<o:p></o:p></p>
            </div>
            <blockquote style="border:none;border-left:solid #CCCCCC
              1.0pt;padding:0in 0in 0in
              6.0pt;margin-left:4.8pt;margin-right:0in">
              <div>
                <p>Hello Paulo,<o:p></o:p></p>
                <p>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).
                  <o:p></o:p></p>
                <p>In ParaView, the line is smooth :<o:p></o:p></p>
                <p class="MsoNormal" style="margin-bottom:12.0pt"><img
                    style="width:13.7222in;height:5.3125in"
                    id="_x0000_i1025"
                    src="cid:part3.51B7FDDF.BEE58DD0@febus-optics.com"
                    class="" width="1317" border="0" height="510"><br>
                  whereas in my VTK app, it isn't :<br>
                  <br>
                  <img style="width:11.5347in;height:2.0208in"
                    id="_x0000_i1026"
                    src="cid:part4.E40B0617.62DC3B75@febus-optics.com"
                    class="" width="1107" border="0" height="194"><br>
                  <br>
                  I don't know the issue...<br>
                  <br>
                  I'm calling the FXAA instructions before Render() in
                  the constructor, I tried even to call them before each
                  call to Render().<br>
                  <br>
                  Best regards.<o:p></o:p></p>
                <div>
                  <p class="MsoNormal">Le 26/12/2018 à 14:21, Paulo
                    Carvalho a écrit :<o:p></o:p></p>
                </div>
                <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
                  <div>
                    <div>
                      <div>
                        <div>
                          <div>
                            <div>
                              <div>
                                <div>
                                  <p class="MsoNormal"
                                    style="margin-bottom:12.0pt">Hello,
                                    Mohamed!<o:p></o:p></p>
                                </div>
                                <p class="MsoNormal"
                                  style="margin-bottom:12.0pt">  It
                                  seems that your last calls
                                  (*SmoothingOn()) conflict with
                                  UseFXAAOn().<o:p></o:p></p>
                              </div>
                              <p class="MsoNormal"
                                style="margin-bottom:12.0pt">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:<o:p></o:p></p>
                              <div>
                                <p class="MsoNormal"
                                  style="margin-bottom:12.0pt"><img
                                    style="width:5.8472in;height:3.6875in"
                                    id="_x0000_i1027"
                                    src="cid:part5.80284E93.062529A3@febus-optics.com"
                                    alt="image.png" class="" width="561"
                                    border="0" height="354"><o:p></o:p></p>
                              </div>
                              <div>
                                <p class="MsoNormal">This one is
                                  rendered with only UseFXAAOn() and
                                  some configuration to the
                                  vtkFXAAOptions object like you did:<o:p></o:p></p>
                              </div>
                              <div>
                                <div>
                                  <p class="MsoNormal"
                                    style="margin-bottom:12.0pt"><img
                                      style="width:5.8472in;height:3.8125in"
                                      id="_x0000_i1028"
                                      src="cid:part6.2EED06EE.52559569@febus-optics.com"
                                      alt="image.png" class=""
                                      width="561" border="0"
                                      height="366"><o:p></o:p></p>
                                </div>
                                <div>
                                  <p class="MsoNormal"
                                    style="margin-bottom:12.0pt">kind
                                    regards,<o:p></o:p></p>
                                </div>
                                <div>
                                  <p class="MsoNormal">Paulo<o:p></o:p></p>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                  <p class="MsoNormal"><o:p> </o:p></p>
                  <div>
                    <div>
                      <p class="MsoNormal">Em qua, 26 de dez de 2018 às
                        10:03, Mohamed Amine Mzoughi <<a
                          href="mailto:aminemzoughi@febus-optics.com"
                          target="_blank" moz-do-not-send="true">aminemzoughi@febus-optics.com</a>>
                        escreveu:<o:p></o:p></p>
                    </div>
                    <blockquote style="border:none;border-left:solid
                      #CCCCCC 1.0pt;padding:0in 0in 0in
                      6.0pt;margin-left:4.8pt;margin-right:0in">
                      <p class="MsoNormal">Hello,<br>
                        <br>
                        I want to enable Anti-alisaing in my VTK app, so
                        I took some parameters <br>
                        from ParaView and it still doesn't work :<br>
                        <br>
                             m_view->GetRenderer()->UseFXAAOn();
                        // enable AA<br>
                        <br>
                             vtkFXAAOptions* const aaOpts =
                        m_view->GetRenderer()->GetFXAAOptions();<br>
                            
                        aaOpts->SetRelativeContrastThreshold(0.125);<br>
                             aaOpts->SetHardContrastThreshold(0.045);<br>
                             aaOpts->SetSubpixelBlendLimit(0.75);<br>
                            
                        aaOpts->SetSubpixelContrastThreshold(0.25);<br>
                            
                        aaOpts->SetUseHighQualityEndpoints(true);<br>
                             aaOpts->SetEndpointSearchIterations(12);<br>
                        <br>
                        what am I missing ?<br>
                        <br>
                        Also,
                        m_view->GetRenderWindow()->GetMultiSamples()
                        => returns 8.<br>
                        <br>
                        and I called also :<br>
                        <br>
m_view->GetRenderWindow()->LineSmoothingOn();<br>
m_view->GetRenderWindow()->PolygonSmoothingOn(); <br>
m_view->GetRenderWindow()->PointSmoothingOn();<br>
                        <br>
                        Thanks.<br>
                        <br>
                        _______________________________________________<br>
                        Powered by <a
href="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"
                          target="_blank" moz-do-not-send="true">
                          www.kitware.com</a><br>
                        <br>
                        Visit other Kitware open-source projects at <a
href="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"
                          target="_blank" moz-do-not-send="true">
http://www.kitware.com/opensource/opensource.html</a><br>
                        <br>
                        Please keep messages on-topic and check the VTK
                        FAQ at: <a
href="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"
                          target="_blank" moz-do-not-send="true">
                          http://www.vtk.org/Wiki/VTK_FAQ</a><br>
                        <br>
                        Search the list archives at: <a
href="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"
                          target="_blank" moz-do-not-send="true">
                          http://markmail.org/search/?q=vtkusers</a><br>
                        <br>
                        Follow this link to subscribe/unsubscribe:<br>
                        <a
href="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"
                          target="_blank" moz-do-not-send="true">https://vtk.org/mailman/listinfo/vtkusers</a><o:p></o:p></p>
                    </blockquote>
                  </div>
                </blockquote>
                <p class="MsoNormal"><o:p> </o:p></p>
              </div>
            </blockquote>
          </div>
        </blockquote>
        <p class="MsoNormal"><o:p> </o:p></p>
      </div>
    </blockquote>
    <br>
  </body>
</html>