[vtkusers] Re: cracked surfaces

Goodwin Lawlor goodwin.lawlor at ucd.ie
Mon Mar 27 11:49:28 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




More information about the vtkusers mailing list