Visualizing Unstructured Grids

I just started working with the vtkUnstructuredGrid class and have built a simple sphere using VTK_HEXAHEDRON elements.

When the sphere is rendered, only the exterior surfaces are displayed. This is evident when I press the w key to view the wire frame.

I’m not sure what to expect with this class. I’ve looked at the class description as well as the Vtk user’s guide and text book and the online unstructured grid examples for answers.

Is there at least a way to render the entire wire frame for the unstructured grid and not just for the exterior surface of the object?

I suspect that you are using a vtkDataSetMapper to render the ugrid - this internally uses vtkDataSetSurfaceFilter to extract the surface/boundary faces and produces the result you see.

If you want to see a gigantic pile of wireframe spaghetti :slight_smile: you’ll need to extract edges. Try vtkExtractEdges.

Sorry for taking so long in getting back to this.

I’m stumped on how to implement this. The online examples for vtkExtractEdges use a vtkUnstructuredGridReader to feed the edge object. For example:

vtkNew<vtkUnstructuredGridReader> reader;
vtkNew<vtkExtractEdges> extractEdges;

I’m not using the vtkUnstructuredGridReader. I have vtkUnstructuredGrid objects that I create in other ways. I’ve looked at the vtkUnstructuredGrid class documentation, but I can’t see how to extract directly from that class to the vtkExtractEdges class object.

Any ideas?

If you have the vtkUnstructuredGrid instance myUGrid, use SetInputData(), something like the following. You use ports / connections when linking filters in a pipeline.

vtkNew<vtkExtractEdges> extractEdges;

I was able to get this to work as you described.