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.zipInventor LibrariesThere 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.
vtkActorToIVThe 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:
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. vtkOIVSourceI 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.
ExampleI have a simple example that creates an implicit model about lines forming 'VTK'. The pipeline is converted into Inventor and rendered within GLUT.
I need to put together some more comprehensive demos including an example with the CAVELib. |
|||||||||||
CSS Research Page |