[vtkusers] Part of an actor invisible, the rest visible

David.Pont at ForestResearch.co.nz David.Pont at ForestResearch.co.nz
Tue Jun 29 17:17:17 EDT 2004





Hi Baris,
  see below for comments following source lines you could change. It looks
like you have created a new camera but not set it as active so vtk never
updates the pipeline correctly. If you simplify your pipeline as indicated
(just use the default camera created by vtk) I think it will work.

    regards
        Dave P


...
...
vtkTubeFilter tubeFilter = new vtkTubeFilter();
tubeFilter.SetInput( polyData );

vtkCamera camera = new vtkCamera();
// this will be a problem unless you set this as the active camera, eg:
vtkRenderer->SetActiveCamera
// you are probably better to drop this line, see below how to get the
camera from the renderer

vtkDepthSortPolyData depthSort = new vtkDepthSortPolyData();
depthSort.SetInput( tubeFilter.GetOutput() );
depthSort.SetDirectionToBackToFront(); )
// this is the default anyway, you could drop this

depthSort.SetDepthSortModeToParametricCenter();
// the default is probably OK for your data, try commenting this out

depthSort.SetCamera(camera);
// change this to depthSort.SetCamera(vtkRenderer->GetActiveCamera());
// otherwise be sure to give your camera to the renderer,
// but that is just a slightly more complicated way to get the same result

depthSort.SortScalarsOn();
// this might be useful to diagnose problems but you could comment it out

depthSort.Update();
// this is not necessary, you could drop it, assuming you are interacting
with the scene in the usual way.
// Mouse events will move the camera (or the actor), vtkDepthSortPolyData
will see it needs to update and
// will re-sort polygons before rendering

vtkPolyDataMapper mapper = new vtkPolyDataMapper();
mapper.SetInput( depthSort.GetOutput() );
...
...



|---------+----------------------------->
|         |           Baris Yalcin      |
|         |           <B.Yalcin at dkfz-hei|
|         |           delberg.de>       |
|         |                             |
|         |           29/06/2004 21:08  |
|         |                             |
|---------+----------------------------->
  >--------------------------------------------------------------------------------------------------------------------------------|
  |                                                                                                                                |
  |       To:       David.Pont at ForestResearch.co.nz, Baris Yalcin <B.Yalcin at dkfz-heidelberg.de>                                    |
  |       cc:       vtkusers at vtk.org                                                                                               |
  |       Subject:  Re: [vtkusers] Part of an actor invisible, the rest visible                                                    |
  >--------------------------------------------------------------------------------------------------------------------------------|




Am Montag, 28. Juni 2004 22:52 schrieb David.Pont at ForestResearch.co.nz:

Hi Dave,

thank you for this suggestion. I tried the vtkDepthSortPolyData, but it
didn't
work. Depending on the angle between the camera and the part of the
object
which should be invisible, you can see or not see the invisible part.

As attachement you find 2 screenshots: in "screenshot_invisible.jpg" the
invisible part of the object is really invisible, vtkDepthSortPolyData
works
here.
But if rotate the object a little bit, then I have the result in
"screenshot_visible.jpg": the invisible part is again visible and hides the

structure behind.

My current pipeline is:
PolyData->TubeFilter->PolyDataMapper->Actor->Renderer

The pipeline with vtkDepthSortPolyData:
PolyData->TubeFilter->DepthSortPolyData->PolyDataMapper->Actor->Renderer

And here is the code:
------------------------------------------------------------------------------------

...
...
vtkTubeFilter tubeFilter = new vtkTubeFilter();
tubeFilter.SetInput( polyData );

vtkCamera camera = new vtkCamera();
vtkDepthSortPolyData depthSort = new vtkDepthSortPolyData();
depthSort.SetInput( tubeFilter.GetOutput() );
depthSort.SetDirectionToBackToFront(); )
depthSort.SetDepthSortModeToParametricCenter();
depthSort.SetCamera(camera);
depthSort.SortScalarsOn();
depthSort.Update();

vtkPolyDataMapper mapper = new vtkPolyDataMapper();
mapper.SetInput( depthSort.GetOutput() );
...
...
------------------------------------------------------------------------------------


Maybe I make here in the code an error with vtkDepthSortPolyData. Do you
have
any idea?

Baris



> Baris,
>    try vtkDepthSortPolyData
>    Dave P
>
> |---------+----------------------------->
> |
> |         |           Baris Yalcin      |
> |         |           <B.Yalcin at dkfz-hei|
> |         |           delberg.de>       |
> |         |           Sent by:          |
> |         |           vtkusers-bounces at v|
> |         |           tk.org            |
> |         |
> |         |
> |         |           28/06/2004 23:41  |
> |
> |---------+----------------------------->
> |
>
>------------------------------------------------------------------------
>   >--------------------------------------------------------|
>   >
>   |       To:       vtkusers at vtk.org

>   |                                                        | cc:

>   |

>   |                                   | Subject:  [vtkusers] Part of an
>   | actor invisible, the rest visible

>   |                  |
>   |
>
>------------------------------------------------------------------------
>   >--------------------------------------------------------|
>
> Hi everyone,

--
MSc Informationstechnik Baris Yalcin
Deutsches Krebsforschungszentrum
Abteilung Medizinische und Biologische Informatik
Im Neuenheimer Feld 280
D-69120 Heidelberg 
Tel: (+49) 6221-42 2325
Fax: (+49) 6221-42 2345
E-Mail: B.Yalcin at dkfz.de
http://mbi.dkfz-heidelberg.de/mbi/people/baris.shtml

_





More information about the vtkusers mailing list