[vtkusers] Re: cracked surfaces
henrikw at hgu.mrc.ac.uk
henrikw at hgu.mrc.ac.uk
Wed Mar 29 06:50:39 EST 2006
> henrikw at hgu.mrc.ac.uk wrote:
> > Hello vtkusers,
> >
> > I am having a problem with VTK 4.2/Python2.3.4 which involves viewing
> surfaces
> > when some opacity is used.
> >
> > I create a surface using vtkMarchingCubes from some SLC data. The data is
> first
> > smoothed with VtkImageGaussianSmooth(). vtkMarchingCubes is run using the
> > following code.
> >
> > mcSurf = vtkMarchingCubes()
> > mcSurf.SetInput(smImg.GetOutput())
> > mcSurf.ComputeScalarsOff()
> > mcSurf.ComputeGradientsOff()
> > mcSurf.ComputeNormalsOn()
> > mcSurf.GetOutput().ReleaseDataFlagOn
> >
> > I then change the opacity using vtkActor.GetProperty().SetOpacity(). When
> the
> > opacity goes below 1.0 then the cracks/holes appear on the surface.
> >
> > I believe the cracking has something to do with normals pointing in the
> opposite
> > direction to the rest of the triangles. I have tried using
> vtkPolyDataNormals to
> > recalculate the normals using different options but I always get the same
> result.
> >
> > There is a sample image at http://homepages.inf.ed.ac.uk/s9638800/img.jpeg
> >
> > Any help would be appreciated,
> >
> > Henrik
>
> Hi Henrik,
>
> Try:
>
> actor->GetProperty()->BackfaceCullingOn()
>
> and put the vtkDepthSortPolyData class into the pipleline, just before
> the mapper.
>
> hth
>
> Goodwin
>
Hi Goodwin and vtkusers,
Thanks for the help. I created vtkDepthSortPolyData filters preceeding my
mappers using the following options:
sorts.SetDirectionToSpecifiedVector()
sorts.SetVector(0,0,-1)
Then turned on BackfaceCulling for all the actors.
This has definitely helped, but I have a slightly complicated surface in that
the surface wraps in on itself at the back. This presents a problem as the polys
in between the exterior surface shine through the surface in front of it at
certain camera angles.
e.g.
---> |\ /| / is the surface being displayed rather than | at the front.
Any ideas on how to get to round this?
thanks,
Henrik
More information about the vtkusers
mailing list