[vtkusers] Mesh visualization

Patrick Lagace plagace at giref.ulaval.ca
Wed Jul 5 09:05:05 EDT 2000


>  I have an unstructured grid composed of triangles only.
> If  i try to see the mesh using this tcl program the lines of the
> triangles overlap and i don't see a clear mesh. :o(
>  I converted the dataset from an avs input file. The
> rapresentation with points only is ok.

We've had a similar problem displaying our meshes...  we found two solutions (each one with
it's own drawbacks)

- Apply a "vtkShrinkFilter" on the unstructured grid  (shrink by only 1%) and all your
triangles & lines should look fine.  But...  in certain cases, this method is not really
visually perfect.

- Personnaly, I prefer using the openGL command  "glPolygonOffset" that exists just for this
kind of   polygon/wireframe interaction (it "bends" the polygon into the z-buffer so that the
polygon doesn't instersect the line when it is drawn... this is tricky to explain but the
result is visually flawless.)

The drawbacks of this latter method is that it is... openGL only and is not currently
supported by VTK.  I've managed to trick VTK into using this openGL call by subclassing a
vtkDataSetMapper and using this modified mapper for my vtkUnstructuredGrid.  This is a C++
only hack and wont help in tcl.

(the openGL calls into the ::Render(...) method are of the form:
    glEnable(GL_POLYGON_OFFSET_FILL);
    glPolygonOffset(1,1);

    vtkDataSetMapper::Render(ren,act);

    glDisable(GL_POLYGON_OFFSET_FILL);
)

good luck!

>>>>note to the vtk team:  Is there any better way to do this?  This "glPolygonOffset" call,
is there any way that you could integrate it into the vtk package?  in vtkOpenGLProperty
maybe?


Patrick Lagacé
plagace at giref.ulaval.ca
GIREF





More information about the vtkusers mailing list