![]() |
http://www.sim.no http://www.coin3d.org |
SIM Voleon is an add-on library to Systems in Motion's visualization platform technology, known as "Coin". Coin is a high-level 3D graphics library with a C++ Application Programming Interface. Its target audience is developers of 3D graphics applications worldwide.
The library has the following major features:
EXT_paletted_texture
or the ARB_fragment_program
OpenGL extensions.
Here's a simple usage example, which sets up a complete environment for voxel visualization with the SIM Voleon library:
#include <Inventor/Qt/SoQt.h> #include <Inventor/Qt/viewers/SoQtExaminerViewer.h> #include <Inventor/nodes/SoSeparator.h> #include <VolumeViz/nodes/SoTransferFunction.h> #include <VolumeViz/nodes/SoVolumeData.h> #include <VolumeViz/nodes/SoVolumeRender.h> #include <VolumeViz/nodes/SoVolumeRendering.h> static uint8_t * generate8bitVoxelSet(SbVec3s & dim) { const size_t blocksize = dim[0] * dim[1] * dim[2]; uint8_t * voxels = new uint8_t[blocksize]; (void)memset(voxels, 0, blocksize); float t = 0; while (t < 50) { SbVec3f v(sin((t + 1.4234) * 1.9) * sin(t) * 0.45 + 0.5, cos((t * 2.5) - 10) * 0.45 + 0.5, cos((t - 0.23123) * 3) * sin(t + 0.5) * cos(t) * 0.45 + 0.5); assert(v[0] < 1.0f && v[1] < 1.0f && v[2] < 1.0f); const int nx = int(dim[0] * v[0]); const int ny = int(dim[1] * v[1]); const int nz = int(dim[2] * v[2]); const int memposition = nz*dim[0]*dim[1] + ny*dim[0] + nx; voxels[memposition] = (uint8_t)(255.0 * cos(t)); t += 0.001; } return voxels; } int main(int argc, char ** argv) { QWidget * window = SoQt::init(argv[0]); SoVolumeRendering::init(); SoSeparator * root = new SoSeparator; root->ref(); SbVec3s dim = SbVec3s(64, 64, 64); uint8_t * voxeldata = generate8bitVoxelSet(dim); // Add SoVolumeData to scene graph SoVolumeData * volumedata = new SoVolumeData(); volumedata->setVolumeData(dim, voxeldata, SoVolumeData::UNSIGNED_BYTE); root->addChild(volumedata); // Add TransferFunction (color map) to scene graph SoTransferFunction * transfunc = new SoTransferFunction(); root->addChild(transfunc); // Add VolumeRender to scene graph SoVolumeRender * volrend = new SoVolumeRender(); root->addChild(volrend); SoQtExaminerViewer * viewer = new SoQtExaminerViewer(window); viewer->setBackgroundColor(SbColor(0.1f, 0.3f, 0.5f)); viewer->setSceneGraph(root); viewer->show(); SoQt::show(window); SoQt::mainLoop(); delete viewer; root->unref(); delete[] voxeldata; return 0; }
Hardware requirements:
SIM Voleon will do a performance test of the host system's graphics card at startup to determine whether the 3D texture support, if present, is hardware accelerated or not. If the support is not hardware accelerated (which is the case with many older cards), SIM Voleon will fall back to regular 2D texture rendering.
Beware that certain nodes requires 3D texture support in the OpenGL driver to function properly (e.g. SoObliqueSlice), but does not demand hardware-acceleration of 3D-texturing to be present. Required 3D-texture support was included in the OpenGL specification starting with version 1.2, and it had additionally been present in the form of vendor and ARB extensions for some time before that. At the present day, the chances of running on a system without 3D texture support should therefore be small.
EXT_paletted_texture
or the ARB_fragment_program
OpenGL extension if available for paletted rendering. If neither of these extensions are present, all data sets will be converted into RGBA textures before uploaded by OpenGL, multiplying the memory usage by four.
SIM Voleon does currently support loading of VOL files, which is a format introduced by the book "Introduction To Volume Rendering", by Lichtenbelt, Crane and Naqvi (Hewlett-Packard / Prentice Hall), ISBN 0-13-861683-3. (See the SoVRVolFileReader class doc for info). Support for more file-formats can be added by extending the SoVolumeReader class.
Beware that large voxel sets are divided into sub cubes. The largest default sub cube size is by default set to 128x128x128, to match the TGS VolumeViz API. Current graphics cards can do much larger textures than this, achieving a higher framerate due to the reduced overhead of sub cube switching and slicing. A graphics card with 128+ MB and true hardware 3D texture support can easily handle voxel sets of size 256x256x256. Increasing the maximum sub cube size can really boost the performance if your graphics card can handle it. Call SoVolumeData::setPageSize(const SbVec3s & size) to adjust the maximum sub cube size. Keep in mind that allowing really large 3D textures might cause other textures to be swapped out of graphics memory, leading to reduced performance.
The documentation for the SoQt library: <http://doc.coin3d.org/SoQt>.
Copyright © 1998-2004 by Systems in Motion AS. All rights reserved.
Generated on Mon Jul 27 22:01:15 2009 for SIMVoleon by Doxygen. 1.5.7.1