Quantcast

Strange renderering with mixed polydata/volume with QVTKOpenGLWidget

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Strange renderering with mixed polydata/volume with QVTKOpenGLWidget

Elvis Stansvik
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


linux_selection_correct.png (29K) Download Attachment
windows_nvidia_selection.png (26K) Download Attachment
macos_selection.png (57K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange renderering with mixed polydata/volume with QVTKOpenGLWidget

Utkarsh Ayachit
For now, try doing this:
  auto surfaceFormat = QVTKOpenGLWidget::defaultFormat()
  surfaceFormat.setSamples(0);
  surfaceFormat.setAlphaBufferSIze(0);
  QSurfaceFormat::setDefaultFormat(surfaceFormat);


Utkarsh

On Thu, May 18, 2017 at 8:57 AM, Elvis Stansvik <[hidden email]> 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




_______________________________________________
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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange renderering with mixed polydata/volume with QVTKOpenGLWidget

Elvis Stansvik
2017-05-18 15:59 GMT+02:00 Utkarsh Ayachit <[hidden email]>:
> 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 :/

Elvis

>
>
> Utkarsh
>
> On Thu, May 18, 2017 at 8:57 AM, Elvis Stansvik
> <[hidden email]> 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
>>
>>
>
_______________________________________________
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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange renderering with mixed polydata/volume with QVTKOpenGLWidget

Utkarsh Ayachit
Okay. In that case, it may be best if you can put together a small example to reproduce the issue so we can debug it here.

Utkarsh

On Thu, May 18, 2017 at 10:14 AM, Elvis Stansvik <[hidden email]> wrote:
2017-05-18 15:59 GMT+02:00 Utkarsh Ayachit <[hidden email]>:
> 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 :/

Elvis

>
>
> Utkarsh
>
> On Thu, May 18, 2017 at 8:57 AM, Elvis Stansvik
> <[hidden email]> 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
>>
>>
>


_______________________________________________
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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange renderering with mixed polydata/volume with QVTKOpenGLWidget

Elvis Stansvik
2017-05-18 16:16 GMT+02:00 Utkarsh Ayachit <[hidden email]>:
> Okay. In that case, it may be best if you can put together a small example
> to reproduce the issue so we can debug it here.

Yep, will do.

Elvis

>
> Utkarsh
>
> On Thu, May 18, 2017 at 10:14 AM, Elvis Stansvik
> <[hidden email]> wrote:
>>
>> 2017-05-18 15:59 GMT+02:00 Utkarsh Ayachit <[hidden email]>:
>> > 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 :/
>>
>> Elvis
>>
>> >
>> >
>> > Utkarsh
>> >
>> > On Thu, May 18, 2017 at 8:57 AM, Elvis Stansvik
>> > <[hidden email]> 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
>> >>
>> >>
>> >
>
>
_______________________________________________
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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange renderering with mixed polydata/volume with QVTKOpenGLWidget

Elvis Stansvik
2017-05-18 16:47 GMT+02:00 Elvis Stansvik <[hidden email]>:
> 2017-05-18 16:16 GMT+02:00 Utkarsh Ayachit <[hidden email]>:
>> Okay. In that case, it may be best if you can put together a small example
>> to reproduce the issue so we can debug it here.
>
> Yep, will do.

I've not been able to reproduce exactly the issue I was seeing with a
small test case, and now I've annoyingly enough lost access to the
Windows machine I was testing on (may regain access to it later).

However, the following test case shows an issue (even on my Linux main
dev machine) which I suspect may be related. When running with a
"plain" vtkRenderWindow, the rendering looks normal, but when running
with QVTKOpenGLWidget, I can see through to the window behind the
application.

See the attached screenshot showing what I mean. Run the test case
with just "./TestCase" for "plain" VTK rendering, and with "./TestCase
blah" to use QVTKOpenGLWidget. You'll have to rotate the camera a
little for the problem to appear.

Any idea why this is happening? It looks similar to the issue I was
having on macOS / Windows (nvidia) in that the windows behind the
application become visible, but apart from that, the color of the poly
data is correct (as opposed to the issue I was having on macOS /
Windows (nvidia)).

Elvis

main.cpp:

#include <algorithm>

#include <vtkActor.h>
#include <vtkCamera.h>
#include <vtkColorTransferFunction.h>
#include <vtkCubeSource.h>
#include <vtkGenericOpenGLRenderWindow.h>
#include <vtkGPUVolumeRayCastMapper.h>
#include <vtkImageData.h>
#include <vtkNew.h>
#include <vtkPiecewiseFunction.h>
#include <vtkPolyDataMapper.h>
#include <vtkProperty.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkVolume.h>
#include <vtkVolumeProperty.h>

#include <QVTKOpenGLWidget.h>

#include <QApplication>

int main(int argc, char *argv[])
{
    auto defaultFormat = QVTKOpenGLWidget::defaultFormat();
    defaultFormat.setSamples(0);
    QSurfaceFormat::setDefaultFormat(defaultFormat);

    QApplication app(argc, argv);

    // Set up volume rendering
    vtkNew<vtkColorTransferFunction> colorFunction;
    colorFunction->AddRGBPoint(0.0, 0.0, 0.0, 0.0);
    colorFunction->AddRGBPoint(1.0, 0.0, 0.0, 0.0);

    vtkNew<vtkPiecewiseFunction> opacityFunction;
    opacityFunction->AddPoint(0.0, 0.0);
    opacityFunction->AddPoint(1.0, 1.0);

    vtkNew<vtkImageData> imageData;
    imageData->SetExtent(0, 200, 0, 200, 0, 200);
    imageData->AllocateScalars(VTK_FLOAT, 1);
    std::fill_n(static_cast<float *>(imageData->GetScalarPointer()),
8000000, 0.01);

    vtkNew<vtkGPUVolumeRayCastMapper> volumeMapper;
    volumeMapper->SetInputData(imageData.Get());

    vtkNew<vtkVolumeProperty> volumeProperty;
    volumeProperty->SetScalarOpacity(opacityFunction.Get());
    volumeProperty->SetColor(colorFunction.Get());
    volumeProperty->ShadeOff();

    vtkNew<vtkVolume> volume;
    volume->SetMapper(volumeMapper.Get());
    volume->SetProperty(volumeProperty.Get());

    // Set up poly cube rendering
    vtkNew<vtkCubeSource> cubeSource;
    cubeSource->SetBounds(-20, 220, 100, 150, -20, 220);

    vtkNew<vtkPolyDataMapper> cubeMapper;
    cubeMapper->SetInputConnection(cubeSource->GetOutputPort());

    vtkNew<vtkActor> cubeActor;
    cubeActor->SetMapper(cubeMapper.Get());
    cubeActor->GetProperty()->SetColor(0.0, 0.0, 1.0);
    cubeActor->GetProperty()->SetOpacity(0.1);
    cubeActor->GetProperty()->SetAmbient(1.0);
    cubeActor->GetProperty()->SetDiffuse(0.0);
    cubeActor->GetProperty()->SetSpecular(0.0);

    // Set up renderer
    vtkNew<vtkRenderer> renderer;
    renderer->AddActor(cubeActor.Get());
    renderer->AddVolume(volume.Get());
    renderer->SetBackground(1.0, 1.0, 1.0);

    if (argc > 1) {
        // Show with QVTKOpenGLWidget
        vtkNew<vtkGenericOpenGLRenderWindow> window;
        window->AddRenderer(renderer.Get());

        auto widget = new QVTKOpenGLWidget();
        widget->SetRenderWindow(window.Get());
        widget->show();

        return app.exec();
    } else {
        // Show with plain VTK
        vtkNew<vtkRenderWindow> window;
        window->AddRenderer(renderer.Get());

        vtkNew<vtkRenderWindowInteractor> interactor;
        interactor->SetRenderWindow(window.Get());
        interactor->Start();

        return 0;
    }
}


CMakeLists.txt:

cmake_minimum_required(VERSION 3.1)

project(TestCase)

find_package(VTK 7.1 COMPONENTS
    vtkCommonCore
    vtkCommonDataModel
    vtkCommonExecutionModel
    vtkCommonMath
    vtkFiltersSources
    vtkGUISupportQt
    vtkInteractionStyle
    vtkRenderingCore
    vtkRenderingOpenGL2
    vtkRenderingVolume
    vtkRenderingVolumeOpenGL2
    REQUIRED
)

find_package(Qt5Widgets REQUIRED)

add_executable(TestCase main.cpp)

target_link_libraries(TestCase PUBLIC
    vtkCommonCore
    vtkCommonDataModel
    vtkCommonExecutionModel
    vtkCommonMath
    vtkFiltersSources
    vtkGUISupportQt
    vtkInteractionStyle
    vtkRenderingCore
    vtkRenderingOpenGL2
    vtkRenderingVolume
    vtkRenderingVolumeOpenGL2
    Qt5::Widgets
)

target_include_directories(TestCase PUBLIC
    ${VTK_INCLUDE_DIRS}
)

target_compile_definitions(TestCase PUBLIC
    ${VTK_DEFINITIONS}
)

set_target_properties(TestCase PROPERTIES
    CXX_STANDARD 14
    CXX_STANDARD_REQUIRED ON
)


>
> Elvis
>
>>
>> Utkarsh
>>
>> On Thu, May 18, 2017 at 10:14 AM, Elvis Stansvik
>> <[hidden email]> wrote:
>>>
>>> 2017-05-18 15:59 GMT+02:00 Utkarsh Ayachit <[hidden email]>:
>>> > 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 :/
>>>
>>> Elvis
>>>
>>> >
>>> >
>>> > Utkarsh
>>> >
>>> > On Thu, May 18, 2017 at 8:57 AM, Elvis Stansvik
>>> > <[hidden email]> 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
>>> >>
>>> >>
>>> >
>>
>>

_______________________________________________
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


testcase-plain.png (37K) Download Attachment
testcase-qvtkopenglwidget.png (38K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange renderering with mixed polydata/volume with QVTKOpenGLWidget

Elvis Stansvik
In reply to this post by Elvis Stansvik
2017-05-18 16:14 GMT+02:00 Elvis Stansvik <[hidden email]>:
> 2017-05-18 15:59 GMT+02:00 Utkarsh Ayachit <[hidden email]>:
>> 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
>> <[hidden email]> 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
>>>
>>>
>>
_______________________________________________
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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange renderering with mixed polydata/volume with QVTKOpenGLWidget

Elvis Stansvik
2017-05-22 13:39 GMT+02:00 Elvis Stansvik <[hidden email]>:

> 2017-05-18 16:14 GMT+02:00 Elvis Stansvik <[hidden email]>:
>> 2017-05-18 15:59 GMT+02:00 Utkarsh Ayachit <[hidden email]>:
>>> 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.

As a side note: I found this in the source code for ITK-SNAP [1]:

// Starting with Qt 5.6, the OpenGL implementation uses OpenGL 2.0
// In this version of OpenGL, transparency is handled differently and
// looks wrong.
QSurfaceFormat gl_fmt;
gl_fmt.setMajorVersion(argdata.opengl_major);
gl_fmt.setMinorVersion(argdata.opengl_minor);
/*
gl_fmt.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
gl_fmt.setRedBufferSize(1);
gl_fmt.setGreenBufferSize(1);
gl_fmt.setBlueBufferSize(1);
gl_fmt.setDepthBufferSize(1);
gl_fmt.setStencilBufferSize(0);
gl_fmt.setAlphaBufferSize(0);
*/

I'm guessing the comment is referring to the same issue I saw. Note
the commented setAlphaBufferSize(0). So is setting the GL version
explicitly like this the proper workaround?

Elvis

[1] https://github.com/pyushkevich/itksnap/blob/master/GUI/Qt/main.cxx#L572-L574

>
> Elvis
>
>>
>> Elvis
>>
>>>
>>>
>>> Utkarsh
>>>
>>> On Thu, May 18, 2017 at 8:57 AM, Elvis Stansvik
>>> <[hidden email]> 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
>>>>
>>>>
>>>
_______________________________________________
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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange renderering with mixed polydata/volume with QVTKOpenGLWidget

Utkarsh Ayachit
Elvis,

I am not sure what the ITK-SNAP thing is. No, I don't think setting required opengl version is the way to go.

If I am following all your emails correctly, then the latest state is that my suggestion works on mac and you're going to confirm on Windows next.

If problems persist, it would be immensely helpful if you have an example that does the "highlight" e.g. modify TestQVTKOpenGLWidget.cxx[1] to add an actor for the "thing". That way I have a easy test case to reproduce your issue and then debug it. 

Utkarsh



On Mon, May 22, 2017 at 8:47 AM, Elvis Stansvik <[hidden email]> wrote:
2017-05-22 13:39 GMT+02:00 Elvis Stansvik <[hidden email]>:
> 2017-05-18 16:14 GMT+02:00 Elvis Stansvik <[hidden email]>:
>> 2017-05-18 15:59 GMT+02:00 Utkarsh Ayachit <[hidden email]>:
>>> 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.

As a side note: I found this in the source code for ITK-SNAP [1]:

// Starting with Qt 5.6, the OpenGL implementation uses OpenGL 2.0
// In this version of OpenGL, transparency is handled differently and
// looks wrong.
QSurfaceFormat gl_fmt;
gl_fmt.setMajorVersion(argdata.opengl_major);
gl_fmt.setMinorVersion(argdata.opengl_minor);
/*
gl_fmt.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
gl_fmt.setRedBufferSize(1);
gl_fmt.setGreenBufferSize(1);
gl_fmt.setBlueBufferSize(1);
gl_fmt.setDepthBufferSize(1);
gl_fmt.setStencilBufferSize(0);
gl_fmt.setAlphaBufferSize(0);
*/

I'm guessing the comment is referring to the same issue I saw. Note
the commented setAlphaBufferSize(0). So is setting the GL version
explicitly like this the proper workaround?

Elvis

[1] https://github.com/pyushkevich/itksnap/blob/master/GUI/Qt/main.cxx#L572-L574

>
> Elvis
>
>>
>> Elvis
>>
>>>
>>>
>>> Utkarsh
>>>
>>> On Thu, May 18, 2017 at 8:57 AM, Elvis Stansvik
>>> <[hidden email]> 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
>>>>
>>>>
>>>


_______________________________________________
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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange renderering with mixed polydata/volume with QVTKOpenGLWidget

Elvis Stansvik
2017-05-22 16:25 GMT+02:00 Utkarsh Ayachit <[hidden email]>:
> Elvis,
>
> I am not sure what the ITK-SNAP thing is. No, I don't think setting required
> opengl version is the way to go.
>
> If I am following all your emails correctly, then the latest state is that
> my suggestion works on mac and you're going to confirm on Windows next.

Yes, that's correct. Sorry that my e-mails got a bit disorganized!

>
> If problems persist, it would be immensely helpful if you have an example
> that does the "highlight" e.g. modify TestQVTKOpenGLWidget.cxx[1] to add an
> actor for the "thing". That way I have a easy test case to reproduce your
> issue and then debug it.

The test case I sent was just that. The
vtkCubeSource/vtkPolyDataMapper in the test case was meant to mimic
the highlight/selection I have in our real application.

Right now I'm debugging some rendering problems on Windows 7 (intel)
that seems to have come from applying your setAlphaBufferSize(0)
solution (not sure yet).

As soon as I get access to the Windows 8.1 machine with nVidia
graphics again, I'll try to confirm that the workaround works there
(like it did on macOS).

Elvis

>
> Utkarsh
>
> [1]
> https://gitlab.kitware.com/vtk/vtk/blob/master/GUISupport/Qt/Testing/Cxx/TestQVTKOpenGLWidget.cxx
>
>
> On Mon, May 22, 2017 at 8:47 AM, Elvis Stansvik
> <[hidden email]> wrote:
>>
>> 2017-05-22 13:39 GMT+02:00 Elvis Stansvik <[hidden email]>:
>> > 2017-05-18 16:14 GMT+02:00 Elvis Stansvik
>> > <[hidden email]>:
>> >> 2017-05-18 15:59 GMT+02:00 Utkarsh Ayachit
>> >> <[hidden email]>:
>> >>> 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.
>>
>> As a side note: I found this in the source code for ITK-SNAP [1]:
>>
>> // Starting with Qt 5.6, the OpenGL implementation uses OpenGL 2.0
>> // In this version of OpenGL, transparency is handled differently and
>> // looks wrong.
>> QSurfaceFormat gl_fmt;
>> gl_fmt.setMajorVersion(argdata.opengl_major);
>> gl_fmt.setMinorVersion(argdata.opengl_minor);
>> /*
>> gl_fmt.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
>> gl_fmt.setRedBufferSize(1);
>> gl_fmt.setGreenBufferSize(1);
>> gl_fmt.setBlueBufferSize(1);
>> gl_fmt.setDepthBufferSize(1);
>> gl_fmt.setStencilBufferSize(0);
>> gl_fmt.setAlphaBufferSize(0);
>> */
>>
>> I'm guessing the comment is referring to the same issue I saw. Note
>> the commented setAlphaBufferSize(0). So is setting the GL version
>> explicitly like this the proper workaround?
>>
>> Elvis
>>
>> [1]
>> https://github.com/pyushkevich/itksnap/blob/master/GUI/Qt/main.cxx#L572-L574
>>
>> >
>> > Elvis
>> >
>> >>
>> >> Elvis
>> >>
>> >>>
>> >>>
>> >>> Utkarsh
>> >>>
>> >>> On Thu, May 18, 2017 at 8:57 AM, Elvis Stansvik
>> >>> <[hidden email]> 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
>> >>>>
>> >>>>
>> >>>
>
>
_______________________________________________
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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange renderering with mixed polydata/volume with QVTKOpenGLWidget

Utkarsh Ayachit
The test case I sent was just that. 

Sorry, it got lost in my inbox. found it :).
 
Attached is another patch. This tries a different approach to addressing the alpha issue. Leaving the QSurfaceFormat unchanged, can you try the attached patch and tell me how it goes? It's a patch for VTK.

Thanks,
Utkarsh

_______________________________________________
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


patch.patch (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange renderering with mixed polydata/volume with QVTKOpenGLWidget

Elvis Stansvik
2017-05-22 16:43 GMT+02:00 Utkarsh Ayachit <[hidden email]>:
>> The test case I sent was just that.
>
>
> Sorry, it got lost in my inbox. found it :).
>
> Attached is another patch. This tries a different approach to addressing the
> alpha issue. Leaving the QSurfaceFormat unchanged, can you try the attached
> patch and tell me how it goes? It's a patch for VTK.

Ah, thanks. I'll give it a go tomorrow. I'm just about to leave the office.

(Just to be clear: I'm not 100% sure that the setAlphaBufferSize(0)
thing is what is causing me trouble on Win 7 at the moment, since I've
made other changes as well. The problem I'm having on Win 7 now is
that our volume rendering is not showing up, but it may be caused by
other things.)

Elvis

>
> Thanks,
> Utkarsh
_______________________________________________
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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange renderering with mixed polydata/volume with QVTKOpenGLWidget

Elvis Stansvik
In reply to this post by Utkarsh Ayachit
2017-05-22 16:43 GMT+02:00 Utkarsh Ayachit <[hidden email]>:
>> The test case I sent was just that.
>
>
> Sorry, it got lost in my inbox. found it :).
>
> Attached is another patch. This tries a different approach to addressing the
> alpha issue. Leaving the QSurfaceFormat unchanged, can you try the attached
> patch and tell me how it goes? It's a patch for VTK.

I applied the patch to the VTK 8.0.0.rc1 I'm using on the Mac, and can
confirm that this fixes the problem: I no longer have to use
setAlphaBufferSize(0) on the QSurfaceFormat to avoid the alpha
problem. Thanks!

I still haven't gotten back the Win 8.1/nVidia machine, so I haven't
been able to verify the setAlphaBufferSize(0) fix nor this patch there
yet. But I feel confident that the issue I saw there (shown in the
screenshots in my first main) was the same as on the Mac, so is
probably solved.

The issue I'm having on Windows 7/intel now (volumes not showing) is
orthogonal to this alpha issue, and I made a separate post about that.

Thanks a lot for the assistance Utkarsh!

Elvis

>
> Thanks,
> Utkarsh
_______________________________________________
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

Loading...