VTK-Inventor Integration

Method for converting output from the VTK pipeline into Inventor nodes


Working in the CAVE is a lot easier with the use of scene graph libraries. We've used the vtkActorToPF written by Paul Prajlich to help generate visualization with VTK for viewing within Performer. We have started to move a lot of our code toward Inventor due to the threading enhancements provided by TGS. VTK can export IV and VRML, but it's usually more helpful to directly update a visualization within the application. For this reason, I have modified the original code written by Paul to use Inventor. Rather than pfGeodes, the new code creates a SoSeparator containing all the geometry from VTK pipeline.

The code configures using CMake. I found CMake to be tremendously useful for compiling across multiple platforms. I can easily change build settings in a single place and move effortlessly between MacOS X, Windows, IRIX, and whatever else I'm using at the moment. The resulting libvtkoiv file can be used from other applications.

This code is currently used only as I have needed it. It's not polished or really even something 'release-ready,' but enough people have asked about a better method of converting between Inventor and VTK that I am posting what I have so far.

Download: vtkoiv.zip

Inventor Libraries

There are several different implementations available. The original library from SGI has now become open source. TGS has a commercial implementation that has numerous improvements, but it's not cheap. Coin3d is an open-source library that has a very active development.

  • SGI Open Inventor - the original code is now an SGI open source project. It can run with Apple's X11. I have created a MacOS X patch. The changes within this patch are making their way into the main cvs source tree.
  • TGS Open Inventor - commercial implementation with numerous improvements including thread safety, visualization nodes, and other new features.
  • Coin3D - open source implementation available for all platforms. Highly recommended.

vtkActorToIV

The first thing I examined was the problem of converting the output from VTK into the Inventor scene graph. I used shape kits since they provide easy ways to access particular members. It's not the best solution, but for an initial implementation it works. Each of the primitive types is converted:

VTK primitive
Resulting Inventor shape
vtkVerts
SoPointSet
vtkLines
SoIndexedLineSet
vtkPolys
SoIndexedFaceSet
vtkStrips
SoIndexedTriangleStripSet

 


Conversion from VTK to Inventor.

The resulting SoSeparator contains a ShapeKit for each of the primitive types mentioned above. The SoShapeKit output is mainly a convenience. It makes certain that particular nodes are available for output. This approach also made the code a lot easier to port since the behavior is similar to using pfGeoSets in Performer. Eventually this will just be a regular scene with children.

vtkOIVSource

I needed to provide input to VTK for worker processing. Rather than trying to manually parse through a model file, I just use the Inventor library to convert everything at run-time. The input must be a SoVertexShape, if it's not is should be simplified with ivfix. The shape node is passed into vtkOIVSource and then becomes available as output.


Conversion from Inventor to VTK.

 

Example

I have a simple example that creates an implicit model about lines forming 'VTK'. The pipeline is converted into Inventor and rendered within GLUT.


oivVtkLogo example on MacOS X


oivVtkLogo example on Windows

I need to put together some more comprehensive demos including an example with the CAVELib.


CSS Research Page