<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Thank you Aashish,<div class=""><br class=""></div><div class="">I tried to use the “vtkOpenGLGPUVolumeRayCastMapper” as following:</div><div class=""><br class=""></div><div class="">—————————————</div><div class=""><br class=""></div><div class="">vtkSmartPointer<vtkOpenGLGPUVolumeRayCastMapper> mapper = vtkSmartPointer<vtkOpenGLGPUVolumeRayCastMapper>::New();<br class=""><br class="">mapper->RenderToImageOn();<br class="">mapper->SetBlendModeToComposite();</div><div class=""><br class=""></div><div class=""><div class="">vtkSmartPointer<vtkVolume> volumep = vtkSmartPointer<vtkVolume>::New();</div><div class="">volumep->SetMapper(mapper);</div><div class=""><br class=""></div><div class="">renderer->AddVolume(volumep);</div></div><div class=""><br class=""></div><div class="">// rendering and camera settings…</div><div class=""><br class=""></div><div class=""><div class=""> renderWindow->SetOffScreenRendering( 1 );</div><div class=""> renderWindow->Render();</div><div class=""><br class=""></div><div class=""><div class="">vtkSmartPointer<vtkImageData> depthImage = vtkSmartPointer<vtkImageData>::New();</div><div class="">vtkSmartPointer<vtkImageData> colorImage = vtkSmartPointer<vtkImageData>::New();</div><div class=""> </div></div><div class=""> mapper->GetDepthImage(depthImage);</div><div class=""> mapper->GetColorImage(colorImage);</div></div><div class=""><br class=""></div><div class="">—————————————</div><div class=""><br class=""></div><div class="">The depthImage has type unsigned char, and I noticed that it contains only values 255 or 0 (for the background), nothing in between.</div><div class="">I was expecting a gradient of values, generally floats or even normalized to char. </div><div class=""><br class=""></div><div class="">What am I missing?</div><div class=""><br class=""></div><div class="">Thank you,</div><div class="">Steve</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 04 Oct 2016, at 19:48, Aashish Chaudhary <<a href="mailto:aashish.chaudhary@kitware.com" class="">aashish.chaudhary@kitware.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi Steve, <div class=""><br class=""></div><div class="">If you intend to get the depth values from volume (and not just geometry), then not clearing the depth buffer will not help either since we don't write to depth buffer (the defaults won't make sense anyways). If you are looking for depth values from both volume and geometry, then you may want to look into this option RenderToImage in the base class (<a href="https://github.com/Kitware/VTK/blob/master/Rendering/Volume/vtkGPUVolumeRayCastMapper.h" class="">https://github.com/Kitware/VTK/blob/master/Rendering/Volume/vtkGPUVolumeRayCastMapper.h</a>). Give it a try and let us know if that works for you. If you enable this option then you can call GetColorImage and GetDepthImage for the depth values. </div><div class=""><br class=""></div><div class="">Thanks,</div><div class=""><br class=""><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Tue, Oct 4, 2016 at 12:34 PM Aashish Chaudhary <<a href="mailto:aashish.chaudhary@kitware.com" class="">aashish.chaudhary@kitware.com</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="gmail_msg">That is because we make a call to clear the depth buffer bit that is: glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT). I have to think all of the use-cases but I think we don't need to clear the depth buffer. We can push a simple fix for it on the master branch. </div><div dir="ltr" class="gmail_msg"><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">- Aashish<br class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><br class="gmail_msg"><div class="gmail_msg"><br class="gmail_msg"></div></div></div></div></div><br class="gmail_msg"><div class="gmail_quote gmail_msg"><div dir="ltr" class="gmail_msg">On Tue, Oct 4, 2016 at 12:12 PM stevep <<a href="mailto:steve.petruzza@gmail.com" class="gmail_msg" target="_blank">steve.petruzza@gmail.com</a>> wrote:<br class="gmail_msg"></div><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br class="gmail_msg">
<br class="gmail_msg">
I used the vtkPolyDataMapper to render a surface and then with the<br class="gmail_msg">
vtkRenderWindow I can get correctly the ZBuffer using GetZbufferData and the<br class="gmail_msg">
RGB data via vtkWindowToImageFilter.<br class="gmail_msg">
<br class="gmail_msg">
When I use, starting from the same vtkImageData, a volume rendering like the<br class="gmail_msg">
SmartVolumeMapper (as in the following):<br class="gmail_msg">
<a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/VolumeRendering/SmartVolumeMapper" rel="noreferrer" class="gmail_msg" target="_blank">http://www.vtk.org/Wiki/VTK/Examples/Cxx/VolumeRendering/SmartVolumeMapper</a><br class="gmail_msg">
<br class="gmail_msg">
The RGB data are correct but the ZBuffer contains all values == 1 (checked<br class="gmail_msg">
dumping the float array to disk).<br class="gmail_msg">
<br class="gmail_msg">
I get the same result changing blend mode and using a<br class="gmail_msg">
vtkFixedPointVolumeRayCastMapper.<br class="gmail_msg">
<br class="gmail_msg">
What am I missing?<br class="gmail_msg">
<br class="gmail_msg">
Thank you<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
--<br class="gmail_msg">
View this message in context: <a href="http://vtk.1045678.n5.nabble.com/Volume-Rendering-and-zbuffer-tp5740662.html" rel="noreferrer" class="gmail_msg" target="_blank">http://vtk.1045678.n5.nabble.com/Volume-Rendering-and-zbuffer-tp5740662.html</a><br class="gmail_msg">
Sent from the VTK - Users mailing list archive at <a href="http://nabble.com" class="">Nabble.com</a>.<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
Powered by <a href="http://www.kitware.com/" rel="noreferrer" class="gmail_msg" target="_blank">www.kitware.com</a><br class="gmail_msg">
<br class="gmail_msg">
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" class="gmail_msg" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br class="gmail_msg">
<br class="gmail_msg">
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" class="gmail_msg" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br class="gmail_msg">
<br class="gmail_msg">
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" class="gmail_msg" target="_blank">http://markmail.org/search/?q=vtkusers</a><br class="gmail_msg">
<br class="gmail_msg">
Follow this link to subscribe/unsubscribe:<br class="gmail_msg">
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" class="gmail_msg" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br class="gmail_msg">
</blockquote></div></blockquote></div></div></div>
</div></blockquote></div><br class=""></div></body></html>