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

Elvis Stansvik elvis.stansvik at orexplore.com
Thu May 18 08:57:05 EDT 2017


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: linux_selection_correct.png
Type: image/png
Size: 21931 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20170518/8c712656/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: windows_nvidia_selection.png
Type: image/png
Size: 19863 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20170518/8c712656/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: macos_selection.png
Type: image/png
Size: 42982 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20170518/8c712656/attachment-0005.png>


More information about the vtk-developers mailing list