[vtkusers] Advice on mitigating choppy resize with Qt 5 + VTK 7.1

Elvis Stansvik elvis.stansvik at orexplore.com
Tue Mar 7 10:20:03 EST 2017


2017-03-07 16:10 GMT+01:00 Elvis Stansvik <elvis.stansvik at orexplore.com>:
> 2017-03-07 15:58 GMT+01:00 Elvis Stansvik <elvis.stansvik at orexplore.com>:
>> 2017-03-07 15:53 GMT+01:00 David Cole <DLRdave at aol.com>:
>>> On Windows, we make resizing our windows interactive by getting the
>>> vtkInteractorStyle associated with the render window containing the
>>> volume rendering, and then calling StartState at resize begin time
>>> (OnEnterSizeMove) and StopState at resize end time (OnExitSizeMove).
>>>
>>> I suppose there may be a Qt equivalent which works on many platforms
>>> for beginning and ending a resize action. If not, there are definitely
>>> platform-specific hooks you can intercept to achieve smooth resizing
>>> with this technique.
>>>
>>> Wrapping anything in a StartState/StopState pair on the
>>> vtkInteractorStyle will cause "interactive frame rate rendering" to be
>>> in effect in between the calls. The volume rendering is not as nice
>>> looking during interactions, but it is definitely speedier.
>>
>> Ah, I was just about to reply to myself with some further information:
>>
>> I know that during interaction, the quality of the rendering is
>> decreased, and that this can account for some of the performance
>> discrepancy I'm seeing between camera movement vs window resize.
>>
>> But, I've experimented with disabling the quality degradation during
>> interactions (so that the two should be on "equal footing"), and the
>> resizing is still much more choppy than when interacting with the
>> camera. So there must be something else.
>>
>> In fact, in the screencast I showed, I wasn't using the volume
>> renderer's default built-in quality degradation during interaction.
>> I'm using my own since I've found that VTKs own is a little too
>> aggressive in degrading the quality to maintain frame rate.
>
> To illustrate, look at the attached screen recording. In this test
> case, I'm using
>
>     mapper->AutoAdjustSampleDistancesOff();
>     mapper->SetSampleDistance(0.0002);
>
> on my vtkGPUVolumeRayCastMapper, to turn off the automatic adjustment
> of sample distance during interactions, and hardcode the sample
> distance to 0.0002.
>
> Notice how the rendering is still reasonably smooth during
> interaction, but during resize, the rendering sometimes lags with 100s
> of milliseconds. During the resizing I was getting warnings like
>
> Warning: In /buildbot/vtk7-builder/build/Rendering/OpenGL2/vtkXOpenGLRenderWindow.cxx,
> line 1207
> vtkXOpenGLRenderWindow (0x2a629d0): warning window did not resize in
> the allotted time
>
> printed.

I wonder if what I'm seeing may be related to

    https://codereview.qt-project.org/?#/c/127006/

That fix was unfortunately never merged to the 5.5 branch, but it was
merged into Qt 5.6:

    https://codereview.qt-project.org/#/c/140608/

Too bad for me, since the app must work well with Qt 5.5.1 (Ubuntu
Xenial-packaged version) :(

I'd just like to hear if anyone else with Qt 5 + VTK 7 on Linux are
seeing this poor behavior during resizing, or if I'm alone.

Elvis

>
> Elvis
>
>>
>> Elvis
>>
>>>
>>>
>>> HTH,
>>> David C.
>>>
>>>
>>>
>>> On Tue, Mar 7, 2017 at 9:33 AM, Elvis Stansvik
>>> <elvis.stansvik at orexplore.com> wrote:
>>>> 2017-03-07 15:17 GMT+01:00 Elvis Stansvik <elvis.stansvik at orexplore.com>:
>>>>> Hi all,
>>>>>
>>>>> I'm using Qt 5.5.1 and VTK 7.1. The program has a couple of VTKWidget
>>>>> showing volume renderings, as well as a window with a chart.
>>>>
>>>> Actually, I'm able to reproduce this behavior when not using Qt at
>>>> all, but just a regular render window + interactor setup with a single
>>>> volume rendered. Camera interaction is nice and fast, but resizing the
>>>> window, the rendering is very choppy. I'm also getting
>>>>
>>>> Warning: In /buildbot/vtk7-builder/build/Rendering/OpenGL2/vtkXOpenGLRenderWindow.cxx,
>>>> line 1207
>>>> vtkXOpenGLRenderWindow (0x1353a10): warning window did not resize in
>>>> the allotted time
>>>>
>>>> printed to the console, so it seems VTK detects what I'm seeing
>>>> visually. I did not get this warning printed in the Qt + VTK app.
>>>>
>>>> Elvis
>>>>
>>>>>
>>>>> Have a look at the attached screen recording. Notice how camera
>>>>> interaction in both VTK render windows is nice and smooth, but when
>>>>> resizing the windows, the updating of the renderings is very
>>>>> slow/choppy.
>>>>>
>>>>> I've been trying to debug this, or at least finding a way of
>>>>> mitigating it. Could it be that Qt is delivering too many resize
>>>>> events? Has anyone else dealt with this problem?
>>>>>
>>>>> Thanks in advance for any advice,
>>>>> Elvis
>>>> _______________________________________________
>>>> 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:
>>>> http://public.kitware.com/mailman/listinfo/vtkusers


More information about the vtkusers mailing list