[vtk-developers] Volume won't show on Win7/Intel HD4600 with QVTKOpenGLWidget in 8.0.0.rc1

Elvis Stansvik elvis.stansvik at orexplore.com
Wed May 24 08:18:53 EDT 2017


2017-05-23 15:41 GMT+02:00 Sankhesh Jhaveri <sankhesh.jhaveri at kitware.com>:
> Hi Elvis,
>
> Could you try downloading the ParaView nightly binary and test volume
> rendering there? You can use the wavelet source for a test dataset. ParaView
> uses the QVTKOpenGLWidget and it would be a good test before diving into the
> code.

I tried the wavelet example with Paraview 5.4.0-RC1-125-g435b603
64-bit, and the problem is the same as in my minimal test case. The
volume won't show up.

It does show up if I switch to the software based ray cast mapper (but
not with GPU or smart, which I guess both result in the GPU one being
used).

Please tell me if there's anything else I can do to help debugging.
There are no errors printed when I run my test case.

Elvis

>
> Thanks,
> Sankhesh
>
>
> On Tue, May 23, 2017 at 6:50 AM Elvis Stansvik
> <elvis.stansvik at orexplore.com> wrote:
>>
>> Hi all,
>>
>> In porting to QVTKOpenGLWidget, I can't get volumes rendered using
>> vtkGPUVolumeRayCastMapper to show up on Windows 7, Intel graphics (HD
>> 4600). They show up fine on Linux. They also show up fine on Windows 7
>> if using a plain VTK render window. I've tried turning off
>> multisampling with setSamples(0) on the default QSurfaceFormat.
>>
>> The below test case illustrates the issue. See the attached
>> screenshots from running "TestCase" (left) and "TestCase 1" (right).
>> The former uses a plain render window while the latter uses the new
>> QVTKOpenGLWidget. Notice how in the Windows 7 screenshot, the plain
>> VTK rendering works fine, but the QVTKOpenGLWidget one is not showing
>> the volume.
>>
>> Versions used:
>>
>> Kubuntu Linux 16.04
>> VTK 8.0.0.rc1, OpenGL2
>> Qt 5.5.1
>>
>> Windows 7
>> VTK 8.0.0.rc1, OpenGL2
>> Qt 5.6.2
>>
>> Any ideas what the problem might be?
>>
>> I can provide a standalone .zip distribution of my build of the test
>> case if you want.
>>
>> Note that this issue is orthogonal to the alpha issue I reported and
>> got solved in my other thread.
>>
>> Many thanks in advance,
>> Elvis
>>
>>
>> main.cpp:
>>
>> #include <algorithm>
>>
>> #include <vtkColorTransferFunction.h>
>> #include <vtkGenericOpenGLRenderWindow.h>
>> #include <vtkGPUVolumeRayCastMapper.h>
>> #include <vtkImageData.h>
>> #include <vtkNew.h>
>> #include <vtkPiecewiseFunction.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());
>>
>>     vtkNew<vtkRenderer> renderer;
>>     renderer->AddVolume(volume.Get());
>>     renderer->SetBackground(1.0, 1.0, 1.0);
>>
>>     if (argc > 1) {
>>         // Render with QVTKOpenGLWidget
>>         vtkNew<vtkGenericOpenGLRenderWindow> window;
>>         window->AddRenderer(renderer.Get());
>>
>>         auto widget = new QVTKOpenGLWidget();
>>         widget->SetRenderWindow(window.Get());
>>         widget->show();
>>
>>         return app.exec();
>>     } else {
>>         // Render with "plain" render window / interactor
>>         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 8.0 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
>> )
>> _______________________________________________
>> 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
>>
> --
>
> Sankhesh Jhaveri
>
> Sr. Research & Development Engineer | Kitware | (518) 881-4417


More information about the vtk-developers mailing list