/ osgPlugins



There are 45 plugins in the core OpenSceneGraph distribution, and these provide the support for reading and writing both native and 3rd party file formats, details of these are below. Other plugins are available in the Community Plugins section.

Invoking a plugin to load or save data

The OpenSceneGraph database plugin library osgDB automatically loads plugins on demand, using the extension of the file being loaded/saved to determine which plugin to load.

For example,

> osgviewer cow.osg

loads the osgdb_osg plugin to read a .osg file, while

> osgviewer model.flt

loads the osgdb_flt plugin to read a .flt file.

If the plugin supports more than one extension, it may be necessary to pre-load the plugin before loading the file by using the standard osgViewer '-e ext' option:

> osgviewer -e lwo model.lw

loads the osgdb_lwo plugin to read a .lw file.

When programming use the follow API to read a file:

#include <osgDB/ReadFile>

osg::ref_ptr<Node> node = osgDB::readNodeFile("cow.osg");
osg::ref_ptr<Image> image = osgDB::readImageFile("lz.rgb");

Or, to write a file:

#include <osgDB/WriteFile>
osgDB::writeNodeFile(*node, "saved.osg");

The loading of the necessary plugins by osgDB is transparent and in practice you shouldn't have to do anything special to load a certain file type. The only factors to keep in mind are that OSG needs to support the file format (as determined by the file's extension) and that you should have compiled the necessary plugin.

List of available 3d database plugins

Plugin name Description Extensions Read Write Notes
3dc 3DC point cloud reader .3dc .asc yes no
3ds 3D Studio .3ds yes yes
ac3d AC3D modeler .ac yes yes http://www.inivis.com/
bsp Quake3 BSP .bsp yes no
dae COLLADA 1.4.x .dae yes yes Requires Collada DOM library. See Collada plugin details
dw Design Workshop Database .dw yes no
dxf Autodesk DXF Reader .dxf yes no
fbx Autodesk FBX .fbx yes yes Requires Autodesk's FBX SDK. If using OpenSceneGraph 2.8.x you'll need version 2010.2 of the SDK. Otherwise check ReaderWriterFBX.h to see which version of the SDK is required (currently 2012.1). If you have problems loading an FBX model please check that it works in Autodesk's FBX QuickTime Viewer first to see if the model was correctly exported.
geo Geo .gem .geo yes no
Inventor Open Inventor format .iv .wrl yes yes .wrl Only VRML1.0
ive Native osg binary .ive yes yes May also read/write (internal) images
logo Logo database .logo yes no
lwo Lightwave Object .lwo .lw .geo yes no
lws Lightwave Scene .lws yes no
md2 Quake MD2 .md2 yes no
obj Alias Wavefront .obj yes yes Also writes materials to .mtl
ogr   .ogr yes no
Openflight Multigen Openflight .flt yes yes See OpenFlight plugin details
osg Native osg ascii .osg yes yes Currently the writer supports OVERRIDE/PROTECTED flags in "StateSets" only for "Modes" and not for "StateAttributes".
pfb Performer loader All extensions supported by Performer loaders yes no Requires Performer library
shp ESRI Shapefile .shp yes no
stl Stereolithography file .stl .sta yes no
vrml VRML2 .wrl yes no Requires OpenVRML library
x DirectX 3D model .x yes no

List of available movie & image plugins

Plugin name Description Extensions Read Write Notes
bmp Window bitmap .bmp yes yes
dds DirectX image format .dds yes yes
gdal GDAL image loaders All extensions supported by GDAL yes no
gif GIF Image .gif yes no
hdr High Dynamic Range image .hdr yes yes
jp2   .jps .jpc yes yes
jpeg Jpeg image .jpeg .jpg yes yes
ktx Khronos KTX texture image .ktx yes yes
Openflight Image attribute files .attr yes yes Stores additional attributes that are not stored in .rgb files
pic PIC image .pic yes no
png Portable Network Graphics .png yes yes
pnm   .pnm .ppm .pgm .pbm yes yes
rgb   .rgb .sgi .rgba .int .inta .bw yes yes
tga Targa image .tga yes no
tiff Tiff image .tiff .tif yes yes
quicktime Quicktime movie loader .mov .mpg .mpv .mp4 .m4v .dc .avi .flv .swf yes yes
  Quicktime image loader rgb. rgba .jpg .jpeg .tif .tiff .gif .png .pict .pct .tga .psd yes yes
vtf Valve Texture Format image .vtf yes yes
xine Xine image stream .mpg .mpv .db .flv .mov .avi .wmv. xine yes no

List of available archive/networking plugins

Plugin name Description Extensions Read Write Notes
curl HTTP Protocol Model .curl yes no
txp Terrapage file .txp yes no Produced by Terra Vista terrain building tools

List of available font plugins

Plugin name Description Extensions Read Write Notes
freetype Freetype font loader .ttf .ttc .pfb .pfa .cid .cff .cef .fon .fnt yes no
txf GLU texture font .txf yes no

List of available pseudo loader plugins

Plugin name Description Extensions Read Write Notes
          OSG reader plugins that insert translation, rotation, or scale transforms above geometry loaded by another plugin. These pseudo-loaders make it simple to change the position, orientation, or size of a saved model by specifying a translation, rotation, or scale factor as part of the filename.
rot Rotates to the loaded model .rot     Usage: <modelfile.ext>.<rx>,<ry>,<rz>.rot where: <modelfile.ext> = a model filename. <rx> = rotation around X axis [degrees]. <ry> = rotation around Y axis [degrees]. <rz> = rotation around Z axis [degrees].
scale Scales the loaded model .scale     Usage: <modelfile.ext>.<sx>,<sy>,<sz>.scale <modelfile.ext>.<su>.scale where: <modelfile.ext> = a model filename. <sx> = scale factor along the X axis. <sy> = scale factor along the Y axis. <sz> = scale factor along the Z axis. <su> = uniform scale factor applied to all axes.
trans Translates the loaded model .trans     Usage: <modelfile.ext>.<tx>,<ty>,<tz>.trans where: <modelfile.ext> = a model filename. <tx> = translation along the X axis. <ty> = translation along the Y axis.. <tz> = translation along the Z axis.
normals Shows normals of the loaded model .normals     Usage: [-O options] <model.ext>.normals options: "scale=<scale>" (default = 1.0) "mode=<VertexNormals|SurfaceNormals>" (default = VertexNormals)