[vtkusers] Drawing custom image with depth buffer and a translucent plane

Sankhesh Jhaveri sankhesh.jhaveri at kitware.com
Tue Oct 23 14:14:58 EDT 2018


Hi Pato,

You need to use vtkRenderer::SetUseDepthPeeling(true) along with
vtkRenderer::SetUseDepthPeelingForVolumes(true).

We have a test for this sort of thing - TestGPURayCastDepthPeelingTransVol
that renders two translucent spheres (polydata) and a volume (vase). See
the image below:

[image: TestGPURayCastDepthPeelingTransVol]
​

On Tue, Oct 23, 2018 at 2:05 PM Pato Sandana <patricio.sandana at synopsys.com>
wrote:

> Hi Elvis and Ken,
>
>
>
> Thanks for the help. What it seems to start to work for me, is to use
> layered renderers: using two renderers, and using the first for my volume
> and the second for the plane. Currently I’m dealing with the depth buffer
> definition as I couldn’t find its definition yet in VTK code, but so far, I
> could draw some extent of the translucent plane in front and the other back.
>
>
>
> I think that by fixing the depth buffer definition in my code, I would be
> able to mimic this behavior. I will poke you again if I succeed.
>
>
>
> Cheers,
>
> Pato
>
>
>
> *From:* Ken Martin <ken.martin at kitware.com>
> *Sent:* Tuesday, October 23, 2018 2:41 PM
> *To:* Elvis Stansvik <elvis.stansvik at orexplore.com>
> *Cc:* patricio.sandana at synopsys.com; vtkusers at public.kitware.com
> *Subject:* Re: [vtkusers] Drawing custom image with depth buffer and a
> translucent plane
>
>
>
> Maybe from vtkRenderer.h
>
>
>
> /**
>    * This flag is on and the GPU supports it, depth-peel volumes along with
>    * the translucent geometry. Only supported on OpenGL2 with dual-depth
>    * peeling. Default is false.
>    */
>   vtkSetMacro(UseDepthPeelingForVolumes, bool)
>   vtkGetMacro(UseDepthPeelingForVolumes, bool)
>   vtkBooleanMacro(UseDepthPeelingForVolumes, bool)
>
>
>
>
>
>
>
> On Tue, Oct 23, 2018 at 1:32 PM, Elvis Stansvik <
> elvis.stansvik at orexplore.com> wrote:
>
> I believe this is a limitation of VTK. Translucent polygonal geometry with
> opacity != 1.0 can't be rendered intersected with a volume other than in a
> back-to-front or front-to-back manner.
>
>
>
> Someone correct me if I'm wrong (we'd also very much like to be able to do
> this).
>
>
>
> Elvis
>
>
>
> Den fre 12 okt. 2018 kl 22:20 skrev Pato Sandana <
> patricio.sandana at synopsys.com>:
>
> Hi Everyone,
>
>
>
> I’m trying to draw a vtkVolume and a vtkPlaneWidget both intersecting and
> the vtkPlaneWidget is translucent. I cannot achieve that, either the plane
> is totally behind or front.
>
>
>
> For a vtkActor with the same box extent this works.
>
>
>
> I tried to get the z-buffer from the context using
> vtkRenderer::GetZbufferData() method, but I only get 1s. (Is this correct?)
>
> I also tried to write the z-buffer data I got with
> vtkRenderer::SetZbuferData() method, but the plane is still behind.
>
>
>
> Any hints how to achieve this? Thanks in advance.
>
>
>
> Regards,
>
>
>
> *Pato Sandaña*
>
> TCAD Senior R&D Engineer
>
> Synopsys Inc. – Santiago, Chile
>
>
>
>
>
> _______________________________________________
>
>
> Powered by www.kitware.com
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.kitware.com&d=DwMFaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=RTHchWjhlQtHtkpaYSjNSag78sFhFdYa6LnDJBrNgcw&m=PCPOgau_FL4YOvrfw9MA94gcF8Jg95G0zsQctmjiS-E&s=XFmKip7WnJXNfMt0qWXfHTPW3KqefkWdTfPDs3YY46c&e=>
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.kitware.com_opensource_opensource.html&d=DwMFaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=RTHchWjhlQtHtkpaYSjNSag78sFhFdYa6LnDJBrNgcw&m=PCPOgau_FL4YOvrfw9MA94gcF8Jg95G0zsQctmjiS-E&s=LC5-bdzymVGJcfcZ8AmBvZV23ae97y-hm6Pct12_zxg&e=>
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.vtk.org_Wiki_VTK-5FFAQ&d=DwMFaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=RTHchWjhlQtHtkpaYSjNSag78sFhFdYa6LnDJBrNgcw&m=PCPOgau_FL4YOvrfw9MA94gcF8Jg95G0zsQctmjiS-E&s=hpcCAyecmkOzC4d70a2q6Y_FYXreBDtqbJQnC5NHkXM&e=>
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__markmail.org_search_-3Fq-3Dvtkusers&d=DwMFaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=RTHchWjhlQtHtkpaYSjNSag78sFhFdYa6LnDJBrNgcw&m=PCPOgau_FL4YOvrfw9MA94gcF8Jg95G0zsQctmjiS-E&s=Amad8dQw8EgKfNC8jg3toPrkaQO4ZgKeMUE77DzqQLY&e=>
>
> Follow this link to subscribe/unsubscribe:
> https://public.kitware.com/mailman/listinfo/vtkusers
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__public.kitware.com_mailman_listinfo_vtkusers&d=DwMFaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=RTHchWjhlQtHtkpaYSjNSag78sFhFdYa6LnDJBrNgcw&m=PCPOgau_FL4YOvrfw9MA94gcF8Jg95G0zsQctmjiS-E&s=9m6365GhhGzxeN9vGEvPYTs58SJ60Il03Px2STQIVx0&e=>
>
>
> _______________________________________________
> Powered by www.kitware.com
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.kitware.com&d=DwMFaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=RTHchWjhlQtHtkpaYSjNSag78sFhFdYa6LnDJBrNgcw&m=PCPOgau_FL4YOvrfw9MA94gcF8Jg95G0zsQctmjiS-E&s=XFmKip7WnJXNfMt0qWXfHTPW3KqefkWdTfPDs3YY46c&e=>
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.kitware.com_opensource_opensource.html&d=DwMFaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=RTHchWjhlQtHtkpaYSjNSag78sFhFdYa6LnDJBrNgcw&m=PCPOgau_FL4YOvrfw9MA94gcF8Jg95G0zsQctmjiS-E&s=LC5-bdzymVGJcfcZ8AmBvZV23ae97y-hm6Pct12_zxg&e=>
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.vtk.org_Wiki_VTK-5FFAQ&d=DwMFaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=RTHchWjhlQtHtkpaYSjNSag78sFhFdYa6LnDJBrNgcw&m=PCPOgau_FL4YOvrfw9MA94gcF8Jg95G0zsQctmjiS-E&s=hpcCAyecmkOzC4d70a2q6Y_FYXreBDtqbJQnC5NHkXM&e=>
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__markmail.org_search_-3Fq-3Dvtkusers&d=DwMFaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=RTHchWjhlQtHtkpaYSjNSag78sFhFdYa6LnDJBrNgcw&m=PCPOgau_FL4YOvrfw9MA94gcF8Jg95G0zsQctmjiS-E&s=Amad8dQw8EgKfNC8jg3toPrkaQO4ZgKeMUE77DzqQLY&e=>
>
> Follow this link to subscribe/unsubscribe:
> https://public.kitware.com/mailman/listinfo/vtkusers
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__public.kitware.com_mailman_listinfo_vtkusers&d=DwMFaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=RTHchWjhlQtHtkpaYSjNSag78sFhFdYa6LnDJBrNgcw&m=PCPOgau_FL4YOvrfw9MA94gcF8Jg95G0zsQctmjiS-E&s=9m6365GhhGzxeN9vGEvPYTs58SJ60Il03Px2STQIVx0&e=>
>
>
>
>
> --
>
> Ken Martin PhD
>
> Distinguished Engineer
> Kitware Inc.
>
> 101 East Weaver Street
> Carrboro, North Carolina
> 27510 USA
>
> This communication, including all attachments, contains confidential and
> legally privileged information, and it is intended only for the use of the
> addressee.  Access to this email by anyone else is unauthorized. If you are
> not the intended recipient, any disclosure, copying, distribution or any
> action taken in reliance on it is prohibited and may be unlawful. If you
> received this communication in error please notify us immediately and
> destroy the original message.  Thank you.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> https://public.kitware.com/mailman/listinfo/vtkusers
>
-- 
Sankhesh Jhaveri *Sr. Research & Development Engineer* | Kitware
<http://www.kitware.com/> | (518) 881-4417
​
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/vtkusers/attachments/20181023/523d274d/attachment.html>


More information about the vtkusers mailing list