<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="">When I remove the offscreen rendering it changes the dimensions of the output image.<div class="">In my case the render window has size 2048x2048 but the output ImageData for both color and depth are 1440x785 (that is the resolution of my screen).</div><div class=""><br class=""></div><div class="">Anyway the result in the buffer is the same: I get only 2 values, background 0 and volume 255.</div><div class="">Alternatively is there a renderer for volume on CPU instead?</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Steve</div><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 07 Oct 2016, at 17:35, 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 style="white-space:pre-wrap" class="">Can you tru it without offscreen rendering turned on? <br class=""><br class="">Thanks </div><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Thu, Oct 6, 2016 at 12:49 PM Steve Petruzza <<a href="mailto:steve.petruzza@gmail.com" class="">steve.petruzza@gmail.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 style="word-wrap:break-word" class="gmail_msg">Thank you Aashish,<div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">I tried to use the “vtkOpenGLGPUVolumeRayCastMapper” as following:</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">—————————————</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">vtkSmartPointer<vtkOpenGLGPUVolumeRayCastMapper> mapper =  vtkSmartPointer<vtkOpenGLGPUVolumeRayCastMapper>::New();<br class="gmail_msg"><br class="gmail_msg">mapper->RenderToImageOn();<br class="gmail_msg">mapper->SetBlendModeToComposite();</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><div class="gmail_msg">vtkSmartPointer<vtkVolume> volumep =  vtkSmartPointer<vtkVolume>::New();</div><div class="gmail_msg">volumep->SetMapper(mapper);</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">renderer->AddVolume(volumep);</div></div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">// rendering and camera settings…</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><div class="gmail_msg">  renderWindow->SetOffScreenRendering( 1 );</div><div class="gmail_msg">  renderWindow->Render();</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><div class="gmail_msg">vtkSmartPointer<vtkImageData> depthImage = vtkSmartPointer<vtkImageData>::New();</div><div class="gmail_msg">vtkSmartPointer<vtkImageData> colorImage = vtkSmartPointer<vtkImageData>::New();</div><div class="gmail_msg"> </div></div><div class="gmail_msg">  mapper->GetDepthImage(depthImage);</div><div class="gmail_msg">  mapper->GetColorImage(colorImage);</div></div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">—————————————</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">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="gmail_msg">I was expecting a gradient of values, generally floats or even normalized to char. </div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">What am I missing?</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Thank you,</div><div class="gmail_msg">Steve</div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><br class="gmail_msg"><div class="gmail_msg"><blockquote type="cite" class="gmail_msg"><div class="gmail_msg">On 04 Oct 2016, at 19:48, Aashish Chaudhary <<a href="mailto:aashish.chaudhary@kitware.com" class="gmail_msg" target="_blank">aashish.chaudhary@kitware.com</a>> wrote:</div><br class="gmail_msg m_4180132831118229043Apple-interchange-newline"><div class="gmail_msg"><div dir="ltr" class="gmail_msg">Hi Steve, <div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">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="gmail_msg" target="_blank">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="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Thanks,</div><div class="gmail_msg"><br class="gmail_msg"><br class="gmail_msg"><div class="gmail_quote gmail_msg"><div dir="ltr" class="gmail_msg">On Tue, Oct 4, 2016 at 12:34 PM Aashish Chaudhary <<a href="mailto:aashish.chaudhary@kitware.com" class="gmail_msg" target="_blank">aashish.chaudhary@kitware.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"><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="gmail_msg" target="_blank">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="gmail_msg"></div></div></blockquote></div>
</div></blockquote></div><br class=""></div></body></html>