使用osgconv将多个osgb转为obj
在百度上搜索.osgb格式转.obj格式,往往需要使用付费软件;而OSG库自带的osgconv.exe
其实就具备三维模型格式转换的功能,以多个osgb文件合并为一个obj文件为例,仅需要运行下面格式的命令:
osgconv -O OutputTextureFiles OSGB文件1 OSGB文件2 OSGB文件3 输出的OBJ文件
即,假如用户有scene1.osgb scene2.osgb两个模型,想合并成一个obj格式的模型,运行下面的命令即可:
osgconv -O OutputTextureFiles scene1.osgb scene2.osgb test.obj
osgconv的其他用法
使用 OSGCONV 将模型转为 OSG 的专属文件格式 IVE
将 cow.obj 转成 ive:
osgconv cow.obj cow.ive
压缩并自动将纹理生成 mipmap:
osgconv --compressed cow.obj cow.ive
查看帮助
查看 osgconv 支持的操作:
osgconv --help
会出如下打印
usage:
osgconv [options] infile1 [infile2 ...] outfile
options:
-O option | ReaderWriter option |
--compressed | Compress textures. |
--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 |
-e extensionName | load reader/wrter plugin for file extension i.e. -e pfb |
-o orientation | Convert geometry from input files to output files. X1,Y1,Z1-X2,Y2,Z2 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 0,1,0-0,0,1 |
-t translation | Convert spatial position of output files. Format of translation argument must be the following : X,Y,Z 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 : SX,SY,SZ where SX, SY, and SZ represent the scale factors. Caution: Scaling will be done in destination orientation |
小知识
纹理转换
如果将 ive 转成 osg 会有一个问题就是 ive 内部是包含纹理的,就在 ive 文件中,而 osg 是 ASCII 文件,是不包含纹理的,这样就会产生 OSG 没有纹理的问题,可以通过指定 - O OutputTextureFiles 来把纹理也进行导出。
Example:
osgconv -O OutputTextureFiles in.ive out.osg
纹理的压缩与解压其实是使用 OPENGL 来完成的,因此如果出现问题不要怀疑是 OSG 的代码,有可能是显卡驱动的原因等。
标签:ive,OpenSceneGraph,obj,osgb,osgconv,compressed,usage,OSG From: https://blog.csdn.net/qq_42679415/article/details/140419065