[vtkusers] Strange VTK Behavior...

Andrea Gavana andrea.gavana at gmail.com
Tue Apr 4 08:16:10 EDT 2006


Hello John & NG,

    I made a relatively small example (with a VTK data file) that shows the
problem. Basically, once loaded the VTK file, just zoom since the grid
occupies all the available screen space of the VTK window (more or less).
Then, if you rotate the scene you will see that the grid is corrupted in
some zones (you will see some artifacts). This may be reproduced using:

1) The script I am attaching (sorry it's Python);
2) Mayavi
3) Paraview

At this point I don't know what to do or to think... does anyone have a
suggestion? Could please someone try and see if he/she gets the same
results? The VTK Data file is here:

http://xoomer.virgilio.it/infinity77/KPO3.zip

It's 600 Kb zipped and about 5 MB unzipped... sorry for that, but it is the
only grid I have to show that problem...

Thank you very much for every suggestion/hint.

Andrea.

# Python Script

import vtk

reader = vtk.vtkUnstructuredGridReader()
reader.SetFileName("KPO3.vtk")
reader.SetScalarsName("cell_scalars")

grid = reader.GetOutput()
grid.GetCellData().SetActiveScalars("cell_scalars")
data_range = grid.GetScalarRange()

surfaceMapper = vtk.vtkDataSetMapper()
surfaceMapper.SetInput(grid)
surfaceMapper.SetScalarRange(0, 14600)
surfaceMapper.GlobalImmediateModeRenderingOn()

surfaceActor = vtk.vtkActor()
surfaceActor.SetMapper(surfaceMapper)

ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
iren.GetInteractorStyle().SetCurrentStyleToTrackballCamera()

# Add the actors to the renderer, set the background and size
ren.AddActor(surfaceActor)

ren.ResetCamera()
ren.ResetCameraClippingRange()

ren.SetBackground(0, 0, 0)
renWin.SetSize(750, 400)

iren.Initialize()
renWin.Render()
iren.Start()

# End Pythin Script


On 4/4/06, Andrea Gavana <andrea.gavana at gmail.com> wrote:
>
>  Hello John,
>
>     thank you for your answer. Well, I don't think I have coincident
> cells, and at the moment I have taken the screenshots I didn't have any
> filter. I had just an unstructured grid with a property selected. BTW, I
> noticed that the effect disappears *only* when I rotate the grid in such a
> way that its upper surface is perpendicular to my eyes' view (parallel to
> the screen... I don't know how to explain it better...). But obviously I can
> not leave it always in that position...
>
> Thank you for your suggestions.
>
> Andrea.
>
>
>  On 4/3/06, John Platt <jcplatt at dsl.pipex.com> wrote:
> >
> >  Hi Andrea,
> >
> >
> >
> > Do you have any coincident cells with different scalars (some filters
> > will merge points when they are very close).
> >
> >
> >
> > John.
> >
> >
> >
> > -----Original Message-----
> > *From:* vtkusers-bounces+jcplatt= dsl.pipex.com at vtk.org [mailto:
> > vtkusers-bounces+jcplatt=dsl.pipex.com at vtk.org] *On Behalf Of *Andrea
> > Gavana
> > *Sent:* 03 April 2006 15:06
> > *To:* vtkusers at public.kitware.com
> > *Subject:* [vtkusers] Strange VTK Behavior...
> >
> >
> >
> > Hello NG,
> >
> >
> >
> >     thanks to Amy, John, Goodwin and Prabhu I solved the problem of
> > vtkThreshold (I think :-) ). Now everything seems OK, except one small
> > thing. I have a vtkUnstructuredGrid in which I have some scalars. Now,
> > irrespective of which scalar I am visualizing, I get strange visualization
> > effects when I rotate/zoom the vtkUnstructuredGrid. For example and for
> > comparison, please see the 2 pictures here:
> >
> >
> >
> > http://xoomer.virgilio.it/infinity77/AlmostOK.JPG
> >
> >
> >
> > http://xoomer.virgilio.it/infinity77/SomethingWrong.JPG
> >
> >
> >
> >
> >
> > They are showing exactly the same grid with the same scalars, but in the
> > second one there are strokes of green that should not be there...
> >
> > Does anyone know what I am doing wrong? May it be a light problem?
> >
> >
> >
> > Thank you very much for your help and suggestions.
> >
> >
> >
> > Andrea.
> >
> > --
> > "Imagination Is The Only Weapon In The War Against Reality."
> >
> > http://xoomer.virgilio.it/infinity77/
> >
> >
>
>
>
> --
> "Imagination Is The Only Weapon In The War Against Reality."
>
> http://xoomer.virgilio.it/infinity77/
>



--
"Imagination Is The Only Weapon In The War Against Reality."

http://xoomer.virgilio.it/infinity77/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060404/de979c23/attachment.htm>


More information about the vtkusers mailing list