- Category: User Guides
- Published on 12 September 2012
- Written by openscenegraph
- Hits: 9210
osgconv is utility program for reading in 3d databases, apply basic operations to them, then saving out as a single 3d database.
Using osgconv to convert into native osg formats
osgconv can be very useful to read from standard 3d formats such as OpenFlight, 3DS, Alias Wavefront (OBJ) etc and then convert to an OSG native format supported such as the OpenSceneGraph .osg ascii format or .ive binary format. By default, optimization of the loaded scene graph will be peformed so the resulting scene graph written out will be smaller and faster to use at run-time, and the .ive file format is particular fast for loading making it ideal for database paging and large database.
Convert cow.obj to equivilant IVE format file:
osgconv cow.obj cow.ive
Convert cow.obj to equivilant IVE format file and compress and automatically generate mipmapped textures:
osgconv --compressed cow.obj cow.ive
Command line options available
For a full list of command line options supported type:
Which will print out out the following:
osgconv [options] infile1 [infile2 ...] outfile
|-O option||ReaderWriter option|
|--compressed||Enable the usage of compressed textures.|
|--compressed-arb||Enable the usage of OpenGL ARB compressed textures|
|--compressed-dxt1||Enable the usage of S3TC DXT1 compressed textures|
|--compressed-dxt3||Enable the usage of S3TC DXT3 compressed textures|
|--compressed-dxt5||Enable the usage of S3TC DXT5 compressed textures|
|-l libraryName||load plugin of name libraryName i.e. -l osgdb_pfb
Useful for loading reader/writers which can load other file formats in addition to its extension.
|-e extensionName||load reader/wrter plugin for file extension i.e. -e pfb
Useful short hand for specifying full library name as done with -l above, as it automatically expands to the full library name appropriate for each platform.
|-o orientation||Convert geometry from input files to output files.
Format of orientation argument must be the following:
where X1,Y1,Z1 represent the UP vector in the input files and X2,Y2,Z2 represent the UP vector of the output file, or degrees is the rotation angle in degrees around axis (A0,A1,A2). For example, to convert a model built in a Y-Up coordinate system to a model with a Z-up
coordinate system, the argument may look like
|-t translation||Convert spatial position of output files. Format of translation argument must be the following :
where X, Y, and Z represent the coordinates of the absolute position in world space
|-s scale||- Scale size of model. Scale argument must be the following :
where SX, SY, and SZ represent the scale factors. Caution: Scaling will be done in destination orientation
When converting from formats like .IVE which contain embedded texture image files to formats such as .OSG which do not, the resulting database may not display any texturing. The .OSG writer supports the "OutputTextureFiles" option, which instructs it to generate new external texture files.
osgconv -O OutputTextureFiles in.ive out.osg
The texture files will be generated using the original texture filename still present in the scenegraph, and will use the format suggested by the filename's extension. This is only possible if the destination directory the texture file specifies already exists.
Some combinations of formats and texture data are not compatible, for example the .RGB format is not capable of storing compressed texture data. This means that if you started with a scene using .RGB external texture images, converted to .IVE and have compressed your texture data since converting to IVE, converting back to .OSG with external .RGB texture files will not be successful. See also: http://forum.openscenegraph.org/viewtopic.php?t=3196&view=next
Compression and decompression of textures during the conversion process is done by the OpenGL implementation, not by an OSG software algorithm. This means that driver defects may manifest at this stage. Problems with corrupt textures could be caused by a faulty OpenGL driver.