Hi Sophonet,<div><br></div><div>Glad that you could solve the problem.</div><div><br></div><div>I agree that the documentation is missing to mention that the volume mapper does not support multisampling. There is also a bug report for this on the VTK issue tracker -Â <a href="https://gitlab.kitware.com/vtk/vtk/issues/17095">https://gitlab.kitware.com/vtk/vtk/issues/17095</a></div><div><br></div><div>Best,</div><div>Sankhesh</div><div><br><div class="gmail_quote"><div dir="ltr">On Wed, Feb 21, 2018, 7:31 AM Sophonet <<a href="mailto:vtk12af6bc42@kant.sophonet.de">vtk12af6bc42@kant.sophonet.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Sankhesh and all, that<br>
<br>
just found a related problem in the developer-list:<br>
<br>
<a href="https://www.vtk.org/pipermail/vtk-developers/2017-May/035107.html" rel="noreferrer" target="_blank">https://www.vtk.org/pipermail/vtk-developers/2017-May/035107.html</a><br>
<br>
Indeed, when doing both, setting defaultFormat.setSamples(0) when<br>
setting the surface format as well as<br>
vtkRenderWindow->SetMultiSamples(0), the volume appears as intended. I a<br>
bit puzzled there seems to be little documentation about it, and that no<br>
error message occurs pointing the developer to the right direction...<br>
Nevertheless, good that things work again here.<br>
<br>
Thanks,<br>
<br>
   Sophonet<br>
<br>
<br>
On 2018-02-20 16:33, Sophonet wrote:<br>
> Hi Sankhesh,<br>
><br>
> thanks for pushing me towards the next step of testing. Indeed, the<br>
> VTK test which I have mentioned below works. After having spent some<br>
> time on trying to localize the problem, it seems that this is related<br>
> to the fact that my application is using Qt (5.10 - with desktop<br>
> OpenGL backend, which works for all my other VTK-based<br>
> visualizations).<br>
><br>
> I have followed all the suggestions for setting up a QVTKOpenGLWidget,<br>
> but using the same code as in the test, the four viewers remain empty<br>
> (which is what I am observing in my application as well). Code<br>
> snippets are below...<br>
><br>
> Any hints on how to use vtkGPUVolumeRayCastMapper in a Qt 5<br>
> application with the OpenGL2 backend?<br>
><br>
> Thanks,<br>
><br>
>Â Â Â Sophonet<br>
><br>
> ---<br>
> void TestGPURayCastBlendModes(vtkRenderWindow *renwin)<br>
> {<br>
>Â Â // The code from the corresponding function in<br>
>Â Â //<br>
> <a href="https://github.com/Kitware/VTK/blob/master/Rendering/Volume/Testing/Cxx/TestGPURayCastFourComponentsMIP.cxx" rel="noreferrer" target="_blank">https://github.com/Kitware/VTK/blob/master/Rendering/Volume/Testing/Cxx/TestGPURayCastFourComponentsMIP.cxx</a><br>
>Â Â // with minor modifications to use the given renderwindow, and after<br>
> removing<br>
>Â Â // the few testing-statements<br>
> }<br>
><br>
> int main(int argc, char *argv[])<br>
> {<br>
>Â Â Â Â QSurfaceFormat::setDefaultFormat(QVTKOpenGLWidget::defaultFormat());<br>
>Â Â Â Â QApplication app(argc, argv);<br>
><br>
>Â Â Â Â QMainWindow *mainWindow = new QMainWindow();<br>
><br>
>Â Â Â Â QVTKOpenGLWidget *widget = new QVTKOpenGLWidget(mainWindow);<br>
><br>
>Â Â Â Â auto *renwin = vtkGenericOpenGLRenderWindow::New();<br>
>Â Â Â Â widget->SetRenderWindow(renwin);<br>
>Â Â Â Â mainWindow->setCentralWidget(widget);<br>
><br>
>Â Â Â Â mainWindow->show();<br>
>Â Â Â Â TestGPURayCastBlendModes(renwin);<br>
>Â Â Â Â Â return app.exec();<br>
> }<br>
><br>
><br>
><br>
> On 2018-02-19 13:38, Sankhesh Jhaveri wrote:<br>
>> Hi,<br>
>><br>
>> Well the difference between in my suggestion was that the minimum<br>
>> scalar value was also getting an opacity weighing ensuring that you<br>
>> should at least see a white cube if the volume has all the same<br>
>> values. However, it that also doesn't show you anything, perhaps<br>
>> there's something else going on.<br>
>><br>
>> Could you try running the VTK tests to see if the volume rendering<br>
>> ones run and pass?<br>
>><br>
>> Thanks,<br>
>> Sankhesh<br>
>><br>
>> On Mon, Feb 19, 2018, 4:05 AM Sophonet <<a href="mailto:vtk12af6bc42@kant.sophonet.de" target="_blank">vtk12af6bc42@kant.sophonet.de</a>><br>
>> wrote:<br>
>><br>
>>> Hi Sankhesh,<br>
>>><br>
>>> thanks for your message - just tried your suggestion, which is<br>
>>> basically<br>
>>> what I have already tried in the commented part of the code below.<br>
>>> As<br>
>>> expected, it did not change the result, my renderwindow is still<br>
>>> black.<br>
>>><br>
>>> Any other hint?<br>
>>><br>
>>> Best regards,<br>
>>><br>
>>> Sophonet<br>
>>><br>
>>> On 2018-02-09 17:57, Sankhesh Jhaveri wrote:<br>
>>>> Hi Sophonet,<br>
>>>><br>
>>>> Try setting the scalar opacity function over the whole range of<br>
>>> scalar<br>
>>>> values.<br>
>>>><br>
>>>> Something like:<br>
>>>><br>
>>>> double * range = data->GetScalarRange();<br>
>>>> vtkNew<vtkPiecewiseFunction> f;<br>
>>>> f->AddPoint(range[0], 0.1);<br>
>>>> f->AddPoint(range[1], 1.0);<br>
>>>> property->SetScalarOpacity(f);<br>
>>>><br>
>>>> Hope that helps,<br>
>>>> Sankhesh<br>
>>>><br>
>>>> ​<br>
>>>><br>
>>>> On Sat, Feb 3, 2018 at 5:37 AM Sophonet<br>
>>>> <<a href="mailto:vtk12af6bc42@kant.sophonet.de" target="_blank">vtk12af6bc42@kant.sophonet.de</a>> wrote:<br>
>>>><br>
>>>>> Hi list,<br>
>>>>><br>
>>>>> in an earlier version of my software using VTK7.x and the OpenGL<br>
>>>>> backend, MIP rendering was working using<br>
>>> vtkGPUVolumeRayCastMapper<br>
>>>>> and<br>
>>>>> MaximumIntensityProjection.<br>
>>>>><br>
>>>>> However, in VTK 8.x (e.g. VTK 8.1.0), using the OpenGL2 backend,<br>
>>> the<br>
>>>>> renderwindow stays black/empty - VTK does not show an error<br>
>>> message,<br>
>>>>> and<br>
>>>>> the IsRenderSupported (see below) does not seem to fail.<br>
>>>>><br>
>>>>> Any hints what is wrong with the code below? By the way: I have<br>
>>>>> added<br>
>>>>> the volumeProperty (and the piecewise function) after following a<br>
>>>>> current VTK test program<br>
>>>>><br>
>>>><br>
>>><br>
>> (<a href="https://github.com/Kitware/VTK/blob/master/Rendering/Volume/Testing/Cxx/TestGPURayCastFourComponentsMIP.cxx" rel="noreferrer" target="_blank">https://github.com/Kitware/VTK/blob/master/Rendering/Volume/Testing/Cxx/TestGPURayCastFourComponentsMIP.cxx</a>).<br>
>>>>><br>
>>>>> vtkimagedata is a scalar medical image (unsigned short), so<br>
>>> nothing<br>
>>>>> special.<br>
>>>>><br>
>>>>> Thanks,<br>
>>>>><br>
>>>>> Sophonet<br>
>>>>><br>
>>>>> vtkNew<vtkGPUVolumeRayCastMapper> mapper;<br>
>>>>> mapper->SetInputData(vtkimagedata);<br>
>>>>> mapper->SetBlendModeToMaximumIntensity();<br>
>>>>><br>
>>>>> vtkNew<vtkVolume> volume;<br>
>>>>> volume->SetMapper(mapper);<br>
>>>>> // ... connect to renderer etc.<br>
>>>>><br>
>>>>> //NOTE: The following lines from VTK's<br>
>>>>> TestGPURayCastFourComponentsMIP.cxx did not solve the problem<br>
>>>>> //vtkNew<vtkVolumeProperty> volumeProperty;<br>
>>>>> //volumeProperty->IndependentComponentsOn();<br>
>>>>><br>
>>>>> //volumeProperty->SetInterpolationType(VTK_LINEAR_INTERPOLATION);<br>
>>>>> //volumeProperty->SetShade(1);<br>
>>>>><br>
>>>>> //vtkNew<vtkPiecewiseFunction> f;<br>
>>>>> //f->AddPoint(0, 0.0);<br>
>>>>> //f->AddPoint(255, 1.0);<br>
>>>>> //volumeProperty->SetScalarOpacity(f);<br>
>>>>><br>
>>>>> //int valid =<br>
>>>>> mapper->IsRenderSupported(vtkrenderer_->GetRenderWindow(),<br>
>>>>> volumeProperty);<br>
>>>>><br>
>>>>> // NOTE: No exception was thrown on my system<br>
>>>>> //if (valid == 0)<br>
>>>>> //Â throw std::runtime_error("MIP rendering is not supported");<br>
>>>>> //volume->SetProperty(volumeProperty);<br>
>>>>> _______________________________________________<br>
>>>>> Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a> [1] [1]<br>
>>>>><br>
>>>>> Visit other Kitware open-source projects at<br>
>>>>> <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>>>>><br>
>>>>> Please keep messages on-topic and check the VTK FAQ at:<br>
>>>>> <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
>>>>><br>
>>>>> Search the list archives at:<br>
>>> <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
>>>>><br>
>>>>> Follow this link to subscribe/unsubscribe:<br>
>>>>> <a href="https://vtk.org/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">https://vtk.org/mailman/listinfo/vtkusers</a><br>
>>>> --<br>
>>>><br>
>>>> SANKHESH JHAVERI<br>
>>>><br>
>>>> _SR. RESEARCH & DEVELOPMENT ENGINEER_ | KITWARE [2] | (518)<br>
>>> 881-4417<br>
>>>><br>
>>>> ​<br>
>>>><br>
>>>> Links:<br>
>>>> ------<br>
>>>> [1] <a href="http://www.kitware.com" rel="noreferrer" target="_blank">http://www.kitware.com</a><br>
>>>> [2] <a href="http://www.kitware.com/" rel="noreferrer" target="_blank">http://www.kitware.com/</a><br>
>>Â --<br>
>><br>
>> SANKHESH JHAVERI<br>
>><br>
>> _SR. RESEARCH & DEVELOPMENT ENGINEER_ | KITWARE [2] | (518) 881-4417<br>
>><br>
>> ​<br>
>><br>
>> Links:<br>
>> ------<br>
>> [1] <a href="http://www.kitware.com" rel="noreferrer" target="_blank">http://www.kitware.com</a><br>
>> [2] <a href="http://www.kitware.com/" rel="noreferrer" target="_blank">http://www.kitware.com/</a><br>
> _______________________________________________<br>
> Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Please keep messages on-topic and check the VTK FAQ at:<br>
> <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
><br>
> Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="https://vtk.org/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">https://vtk.org/mailman/listinfo/vtkusers</a><br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://vtk.org/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">https://vtk.org/mailman/listinfo/vtkusers</a><br>
</blockquote></div></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div class="inbox-inbox-inbox-inbox-inbox-inbox-inbox-markdown-here-wrapper" style="font-family:"proza libre",sans-serif;color:rgb(0,56,107)"><h5 id="inbox-inbox-inbox-inbox-inbox-inbox-inbox-sankhesh-jhaveri" style="margin:1.3em 0px 1em;padding:0px;font-size:1.1em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(238,238,238);font-weight:bold;color:rgb(11,65,148)">Sankhesh Jhaveri</h5>
<h6 id="inbox-inbox-inbox-inbox-inbox-inbox-inbox--sr-research-development-engineer-kitware-http-www-kitware-com-518-881-4417" style="margin:1.3em 0px 1em;padding:0px;font-size:1em;color:rgb(11,83,148);font-family:"open sans",sans-serif;font-weight:normal"><em>Sr. Research & Development Engineer</em> | <a href="http://www.kitware.com/">Kitware</a> | (518) 881-4417</h6>
<div title="MDH:PGIgc3R5bGU9ImZvbnQtZmFtaWx5OiB2ZXJkYW5hLCBzYW5zLXNlcmlmOyBjb2xvcjogcmdiKDEx
LCA4MywgMTQ4KTsiPjxmb250IHNpemU9IjIiPiMjIyMjU2Fua2hlc2ggSmhhdmVyaTwvZm9udD48
L2I+PGRpdj48Zm9udCBjb2xvcj0iIzBiNTM5NCIgZmFjZT0idmVyZGFuYSwgc2Fucy1zZXJpZiIg
c2l6ZT0iMiI+PGI+PGJyPjwvYj48L2ZvbnQ+PGRpdj48c3BhbiBzdHlsZT0iZm9udC1mYW1pbHk6
IGFyaWFsLCBzYW5zLXNlcmlmOyBjb2xvcjogcmdiKDExLCA4MywgMTQ4KTsiPjxzcGFuIHN0eWxl
PSJmb250LWZhbWlseTogdmVyZGFuYSwgc2Fucy1zZXJpZjsiPjxpPiMjIyMjIypTci4gUmVzZWFy
Y2ggJmFtcDsgRGV2ZWxvcG1lbnQgRW5naW5lZXIqPC9pPiZuYnNwO3wmbmJzcDs8L3NwYW4+PC9z
cGFuPjxzcGFuIHN0eWxlPSJmb250LWZhbWlseTogdmVyZGFuYSwgc2Fucy1zZXJpZjsgY29sb3I6
IHJnYigxMSwgODMsIDE0OCk7Ij48YSBocmVmPSJodHRwOi8vd3d3LmtpdHdhcmUuY29tLyIgdGFy
Z2V0PSJfYmxhbmsiIHN0eWxlPSJjb2xvcjogcmdiKDE3LCA4NSwgMjA0KTsiPktpdHdhcmU8L2E+
Jm5ic3A7fCZuYnNwOzwvc3Bhbj48c3BhbiBzdHlsZT0iZm9udC1mYW1pbHk6IHZlcmRhbmEsIHNh
bnMtc2VyaWY7IGNvbG9yOiByZ2IoMTEsIDgzLCAxNDgpOyI+KDUxOCkgODgxLTQ0MTc8L3NwYW4+
PGJyPjwvZGl2PjxkaXY+PGRpdj48ZGl2PjxzcGFuIHN0eWxlPSJmb250LWZhbWlseTogdmVyZGFu
YSwgc2Fucy1zZXJpZjsgY29sb3I6IHJnYigxMSwgODMsIDE0OCk7Ij48L3NwYW4+PC9kaXY+PC9k
aXY+PC9kaXY+PC9kaXY+" style="height:0px;width:0px;max-height:0px;max-width:0px;overflow:hidden;font-size:0em;padding:0px;margin:0px">​</div></div></div></div>