[vtk-developers] Multisampling in VTK

Aashish Chaudhary aashish.chaudhary at kitware.com
Wed Jan 8 13:12:09 EST 2014


On Wed, Jan 8, 2014 at 12:59 PM, David E DeMarle
<dave.demarle at kitware.com>wrote:

> We explicitly turn it off in specific tests where it has to be turned off
> (depth compositing and surface selection for example).
>
> My preference is that the default is 0 on all platforms, we make it simple
> and obvious how to turn it on for apps that need higher quality images, and
> we work to turn it off automatically whenever the features that require it
> to be off are running.
>

I agree as its obvious it does not come for free. Plus having it consistent
helps. The second part where we turn it off auto-matically, I think can be
handled by a particular algorithm but that may require bit more discussion.

- Aashish



>
> David E DeMarle
> Kitware, Inc.
> R&D Engineer
> 21 Corporate Drive
> Clifton Park, NY 12065-8662
> Phone: 518-881-4909
>
>
> On Wed, Jan 8, 2014 at 12:43 PM, Aashish Chaudhary <
> aashish.chaudhary at kitware.com> wrote:
>
>> Folks,
>>
>> While looking into some failing test on Linux, we realized this code
>> below in vtkOpenGLRenderWindow
>>
>> // Initialize static member that controls global maximum number of
>> multisamples
>> // (off by default on Apple because it causes problems on some Mac
>> models).
>> #if defined(__APPLE__)
>> static int vtkOpenGLRenderWindowGlobalMaximumNumberOfMultiSamples = 0;
>> #else
>> static int vtkOpenGLRenderWindowGlobalMaximumNumberOfMultiSamples = 8;
>> #endif
>>
>>
>> and in vtkXOpenGLRenderWindow.cxx
>> if (multisamples)
>>     {
>> #ifdef GLX_SAMPLE_BUFFERS_SGIS
>>     attributes[index++] = GLX_SAMPLE_BUFFERS_SGIS;
>>     attributes[index++] = 1;
>>     attributes[index++] = GLX_SAMPLES_SGIS;
>>     attributes[index++] = multisamples;
>> #endif
>>     }
>>
>> Basically in OpenGL, we can achieve anti-aliasing for each primitive type
>> by invoking enable / disable on GL_POINT_SMOOTH, GL_LINE_SMOOTH or
>> GL_POLYGON_SMOOTH. The other route that applies anti-aliasing to all of
>> the primitives is to use mutli-sampling if available (this always wins if
>> both methods are used). Now by default, on LINUX (the code above set the
>> sample size to 0 effectively disabling anti-aliasing) we have anti-aliasing
>> ON with a sample size of 8. The anti-aliasing is an expensive operation and
>> not all of the implementation supports it (Please refer to the
>> documentation on GLX_SAMPLES_SGIS or ARB_multisample).
>>
>> I am asking if we should set the sample size to 0 default on Linux as
>> well (like Mac) and if applications needs it then they can explicitly turn
>> it ON. I can make an argument for either side but I am bit more inclined
>> towards setting it to 0 so that applications can still control it if wanted
>> but if not they won't get it by default (and will get better performance
>> overall).
>>
>> Now we don't agree on this, can we agree on setting to 0 for testing (May
>> be via environment variable like others we used in our testing?)
>>
>>
>> Thoughts?
>>
>> Helpful links:
>> http://www.opengl.org/registry/specs/ARB/multisample.txt
>> http://www.opengl.org/registry/specs/SGIS/multisample.txt
>> http://www.opengl.org/wiki/Multisampling
>>
>>
>> - Aashish
>>
>>
>>
>> --
>> | Aashish Chaudhary
>> | R&D Engineer
>> | Kitware Inc.
>> | www.kitware.com
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtk-developers
>>
>>
>>
>


-- 
| Aashish Chaudhary
| R&D Engineer
| Kitware Inc.
| www.kitware.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20140108/e3bee6dd/attachment.html>


More information about the vtk-developers mailing list