views:

62

answers:

1

Does anyone have experience to fairly compare VTK and OpenSceneGraph? I'm more familiar with VTK, but I'm curious as to whether anyone has tried both extensively.

I have both built, 5.6 vtk and 2.9.9 osg, can run the examples... at first glance OSG seems more 'rough', but maybe that's OK. In particular I worry about being able to fiddle with low level openGL in VTK; e.g. I bet glReadPixels would behave more nicely with OSG. Comments?

(or is there a nice 'other' that I'm missing? I know others exist, but please take a look at the massive scope of OSG and VTK...)

+3  A: 

VTK and OSG really solve different problems, so which you should use depends on what you are trying to accomplish! VTK is primarily intended for scientific visualization, and as such is more geared towards data visualization algorithms. It might have some ability to work in a scene graph mode, but mainly that is so that different datasets can be registered (overlaid) on top of each other. It's not really intended for representing arbitrary scenes (though it could be shoehorned into it). And you're right, it is not intended that you mix OpenGL calls with VTK. Again, it can be done, but it's not necessarily easy.

OSG on the other hand, is the spiritual successor to SGI's Performer, and is intended more for arbitrary graphical scenes. It is very dependent on the scene-graph metaphor, which I would encourage you to read about (wikipedia has a decent article). I don't have much experience with it (being more on the sci-vis side of things).

In short, if you want to view isosurfaces of volumetric data, flow field visualizations, or other visualizations derived from scientific data, go with VTK. If you are trying to implement a virtual world of some sort, go with OSG (or something similar). If you are trying to accomplish something else, let us know, and perhaps someone can recommend a more apt tool for your needs.

Matthew Hall
Well I'm really in a gray area, hence I need to decide carefully. I do need a 'vritual world' but it can be extremely simple, I think a few vtkPolyData buildings and a big rectangle for ground with textures pasted on would do it. What I really need to be able to do is read the image data that's rendered, do some computations elsewhere on the image feed, then possibly update the geometry as a result. So I really need a way to 'screengrab' efficiently; e.g. glReadPixels() would be great if VTK can do it, I just don't know where to put that call.
peter karasev
I see there's a 'vtkOpenGLStateCache', but I'm going to just pipe everything to OpenCV anyway so I would rather avoid more vtk OO-wrapping than necessary.
peter karasev
I see. First off, if you have vtkRenderWindow, you can call vtkRenderWindow::Get[RGBA]PixelData on it, and it will return a block of pixels - either as a raw pointer, or into a vtkArray type. To be frank, both OSG and VTK sound like a bit of overkill - have you considered using plain OpenGL? Or, depending on your programming language, there are probably some light-weight scene rendering libraries you could use.
Matthew Hall
Yes I have a version that runs in raw openGL already. It just gets a bit tricky to scale up if I want a more complicated scene and user interaction. e.g. vtkRenderWindowInteractor is a heck of a lot nicer than glut callbacks!
peter karasev