[vtk-developers] Strange renderering with mixed polydata/volume with QVTKOpenGLWidget

Elvis Stansvik elvis.stansvik at orexplore.com
Mon May 22 07:39:26 EDT 2017


2017-05-18 16:14 GMT+02:00 Elvis Stansvik <elvis.stansvik at orexplore.com>:
> 2017-05-18 15:59 GMT+02:00 Utkarsh Ayachit <utkarsh.ayachit at kitware.com>:
>> For now, try doing this:
>>   auto surfaceFormat = QVTKOpenGLWidget::defaultFormat()
>>   surfaceFormat.setSamples(0);
>>   surfaceFormat.setAlphaBufferSIze(0);
>>   QSurfaceFormat::setDefaultFormat(surfaceFormat);
>
> Thanks for the suggestion. I tried it out on the Mac, but it looks
> like it made no difference :/

I'm really sorry, this must have been a PEBKAC from me, because now
that I tried it again, it actually does solve the problem (!). I must
have made some mistake first time I tried it.

Rendering on the Mac is now correct. I will have to wait until I get
access to the Windows/nVidia machine again to confirm that it solves
it there too, but I'm hopeful that it does.

(Note: I sent off a couple of e-mails earlier today with some
screenshots from the Mac, that ended up in the moderation queue due to
the screenshots being > 1000 KB).

Many thanks for this tip Utkarsh.

Elvis

>
> Elvis
>
>>
>>
>> Utkarsh
>>
>> On Thu, May 18, 2017 at 8:57 AM, Elvis Stansvik
>> <elvis.stansvik at orexplore.com> wrote:
>>>
>>> I'm porting our program to the new QVTKOpenGLWidget.
>>>
>>> In one place, we're using a semi-transparent polygonal cube to show
>>> the selection of an area. We're doing volume rendering using
>>> vtkGPUVolumeRayCastMapper in the same renderer, and the polygonal
>>> selection marker is enclosing the volume in the X/Y dimensions.
>>>
>>> See the attached linux_selection_correct.png for how this is supposed
>>> to look, and you'll understand what I mean. The light blue area is the
>>> selection marker.
>>>
>>> This has always worked fine, but after porting from QVTKWidget to
>>> QVTKOpenGLWidget, the rendering looks strange on Windows (nvidia) and
>>> macOS (2013 MBP, intel iris). See the attached
>>> windows_nvidia_selection.png and macos_selection.png.
>>>
>>> The selection is visualized using
>>>
>>>   vtkCubeSource -> vtkPolyDataMapper
>>>
>>> and a vtkActor configured like this:
>>>
>>>     auto selectionColor = palette().color(QPalette::Highlight);
>>>
>>>     m_selectionMarkerActor->SetMapper(selectionMarkerMapper);
>>>     m_selectionMarkerActor->GetProperty()->SetColor(selectionColor.redF(),
>>>
>>> selectionColor.greenF(),
>>>
>>> selectionColor.blueF());
>>>     m_selectionMarkerActor->GetProperty()->SetOpacity(0.1);
>>>     m_selectionMarkerActor->GetProperty()->SetAmbient(1.0);
>>>     m_selectionMarkerActor->GetProperty()->SetDiffuse(0.0);
>>>     m_selectionMarkerActor->GetProperty()->SetSpecular(0.0);
>>>
>>> Any idea why the rendering looks so strange on Windows/nvidia and
>>> macOS/iris, respectively, when using the new widget class?
>>>
>>> We're using a recent VTK from Git master.
>>>
>>> We're doing the recommended
>>>
>>>     QSurfaceFormat::setDefaultFormat(QVTKOpenGLWidget::defaultFormat());
>>>
>>> to set the default surface format before QApplication construction.
>>>
>>> In the particular QVTKOpenGLWidget used here, we modify the format with
>>>
>>>     auto surfaceFormat = format();
>>>     surfaceFormat.setSamples(0);
>>>     setFormat(surfaceFormat);
>>>
>>> to disable multisampling.
>>>
>>> Very grateful for any advise on how to solve this.
>>>
>>> Cheers,
>>> Elvis
>>>
>>> _______________________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Search the list archives at: http://markmail.org/search/?q=vtk-developers
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://public.kitware.com/mailman/listinfo/vtk-developers
>>>
>>>
>>


More information about the vtk-developers mailing list