[vtkusers] How to get silhouette/mask of rendered polydata?

marice at knology.net marice at knology.net
Mon May 8 17:12:08 EDT 2006


I looked at the vtkPolyDataToImageStencil and vtkImageStencil classes and
they are almost what I need. Maybe I'm not understanding them, but I don't
see how to take into account the perspective rendering and the pixel aspect
ratio, which should change the mask.

The on-line documentation for vtkPolyDataToImageStencil doesn't specify how
the vtkPolyData is mapped into image space and I didn't see any of the image
stencil classes documented in the VTK books. My confusion is how to specify
the "look vector" (e.g., a camera location and orientation) so the filter
knows how to do the mapping. Is it always along a fixed vector?

Michael

On Mon, 08 May 2006 10:43:16 -0400, David Gobbi <dgobbi at atamai.com> wrote :

> Hi Michael,
> 
> There is a filter that does this in 3D, it is called 
> vtkPolyDataToImageStencil.  There is not yet a VTK filter that does it 
> for 2D polydata.
> 
> However, if you look at 
> VTK/Widgets/Testing/Cxx/TestImageTracerWidget.cxx (look in Hybrid if you 
> have VTK 4) there is an example of converting a 2D polydata to a 3D 
> polydata with extrusion.  Not quite ideal, but it should work.
> 
>  - David
> 
> 
> Michael Rice wrote:
> > I am rendering a vtkImageData as the background image and a 
> > vtkPolyData on top of it. What I need to do is get the elements from 
> > the vtkImageData that are beneath the rendered vtkPolyData. Basically 
> > I'm trying to use the vtkPolyData to generate a mask for the image.
> >
> > I thought of using a clip plane on the poly data, but I don't think 
> > that will take into account the perspective rendering and the pixel 
> > aspect ratio. Is that correct?
> >
> > Does anyone have any hints or examples on how I can do this?
> >
> > Thanks.
> > Michael
> > _______________________________________________
> > This is the private VTK discussion list.Please keep messages on-topic. 
> > Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtkusers
> >
> 
> 
> 
> 



More information about the vtkusers mailing list