同步操作将从 起床困难户/osgGISPlugins 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
简体中文 | English
osg的gis插件,能够读取、显示3dmax导出的具有Pbr材质的fbx文件、导出gltf/glb文件、导出b3dm文件、读取/导出ktx2格式图片、读取/导出webp格式图片。
同时提供了如下子工具:
b3dm转gltf/glb
3D模型转3dtiles
...
在osg的fbx的插件的基础上,参考了FBX2glTF项目,使得能够读取3dmax导出的带有Pbr材质的FBX文件,并能在osg中加载。
支持导出gltf/glb,暂不支持读取。在osgEarth的gltf的插件基础上,增加了纹理压缩和顶点压缩功能,支持webp、ktx2格式纹理;支持使用draco/meshopt对顶点、法线、纹理坐标进行压缩;同时支持对顶点绑定batchId。
支持导出b3dm,暂不支持读取。b3dm插件具有gltf插件的所有功能,同时能够导出UserData中的属性到b3dm中。支持纹理图集优化。
和osgEarth的webp插件一样。
在王锐大神的osgVerse的ktx插件基础上进行了小改动,支持导出ktx2格式的纹理图片。
将b3dm文件转换为gltf/glb文件。
b3dm2gltf.exe -i <path> -o <path>
b3dm2gltf.exe -i D:\test.b3dm -o D:\output.glb
1、将3D模型转换为3dtiles; 2、支持四叉树和八叉树结构的3dtiles; 3、支持webp/ktx2纹理压缩; 4、支持draco和meshoptimizer压缩; 5、支持纹理合并(减少drawcall次数); 6、导出的3dtiles会带有模型的用户属性; 7、导出的3dtiles是经过网格合并的; 8、支持纹理图集; ... 这里的3D模型指的是fbx、obj、3ds等osg能够读取的三维模型,但是不包括倾斜摄影模型,倾斜摄影模型目前建议使用https://github.com/fanvanzh/3dtiles。
model23dtiles -i <path> -tf <jpg/png/webp/ktx2> -vf <draco/meshopt/none> -t <quad/oc> -max <Number> -ratio <Number> -o <DIR> -lat <Number> -lng <Number> -height <Number> -comporess_level <low/medium/high> -multi_threading <true/false>
model23dtiles.exe -i D:\test.fbx -o D:\output -lat 30 -lng 116 -height 100
# 输出使用ktx2进行纹理压缩和使用draco进行顶点压缩的3dtiles
model23dtiles.exe -i D:\test.fbx -tf ktx2 -vf draco -o D:\output -lat 30 -lng 116 -height 100
# 设置3dtiles的每个节点所包含的三角面的最大数量为10万
model23dtiles.exe -i D:\test.fbx -max 100000 -o D:\output -lat 30 -lng 116 -height 100
# 设置3dtiles的中间节点的简化比例为0.6
model23dtiles.exe -i D:\test.fbx -ratio 0.6 -o D:\output -lat 30 -lng 116 -height 100
# 设置3dtiles的树结构为四叉树
model23dtiles.exe -i D:\test.fbx -t quad -o D:\output -lat 30 -lng 116 -height 100
-tf
纹理压缩格式,可选值有:png、jpg、webp、ktx2,默认值为:jpg。
-vf
顶点压缩格式,可选的值有:draco、meshopt、none,默认值为:none,即不对顶点进行压缩。
comporess_level
draco压缩级别,可选的值为:low、medium、high,默认值为:medium。
-t
3dtiles的组织结构,可以为四叉树或八叉树,可选的值有:quad、oc,默认值为:quad。
-max
b3dm文件所包含的三角面的最大数量,默认值为:40000。
-ratio
3dtiles中间节点的简化比例,默认值为:0.5。
-lat
纬度,默认30
-lng
经度,默认116
-height
高度,默认300
-multi_threading
是否启用多线程,默认false
1、编译需要fbxsdk和修改后的tinygltf等库,但是文件太大无法上传,因此放在了百度网盘中(链接:https://pan.baidu.com/s/1tAy3tAEuAut5GDLODfCKtA?pwd=fgah
提取码:fgah ),下载解压后放在和src同级目录下即可
2、编译时需要修改根目录下的CMakeLists文件中CMAKE_TOOLCHAIN_FILE变量的值为本地vcpkg工具路径
1、当前不支持b3dm、gltf/glb文件的导入;
2、ktx插件无法读取部分ktx 2.0版本的图片;
...
1、读取b3dm、gltf/glb;
...
简体中文 | English
OSG's GIS plugin can read and display fbx files with Pbr material exported by 3dmax, export gltf/glb files, export b3dm files, read/export ktx2 format images, and read/export webp format images.
At the same time, the following sub tools are provided:
convert b3dm to gltf/glb
convert 3D model to 3dtiles
...
Based on the FBX2glTF plugin of OSG's FBX, reference was made to FBX2glTF project to enable reading of FBX files with Pbr material exported from 3dmax and loading in OSG.
Supports exporting gltf/glb, but currently does not support reading. On the basis of osgEarth's gltf plugin, added texture compression and vertex compression functions, supporting webp and ktx2 format textures; Use Draco/Meshopt to compress vertices, normals, and texture coordinates; Simultaneously supports binding batchId to vertices.
Supports exporting b3dm, but currently does not support reading. The b3DM plugin has all the functions of the gltf plugin, and can also export attributes from UserData to b3DM.Support textureAtlas.
Same as the webp plugin of osgEarth.
In xarray's osgVerse the project has made minor changes to the ktx plugin, which supports exporting texture images in ktx2 format.
Convert b3dm files to gltf/glb.
b3dm2gltf.exe -i <path> -o <path>
b3dm2gltf.exe -i D:\test.b3dm -o D:\output.glb
model23dtiles -i <path> -tf <jpg/png/webp/ktx2> -vf <draco/meshopt/none> -t <quad/oc> -max <Number> -ratio <Number> -o <DIR> -lat <Number> -lng <Number> -height <Number> -compress_level <low/medium/high> -multi_threading <true/false>
# output 3dtiles by texture format ktx2 and vertex format draco
model23dtiles.exe -i D:\test.fbx -tf ktx2 -vf draco -o D:\output -lat 30 -lng 116 -height 100
# The maximum number of triangular faces for each b3dm node of the output 3dtiles is 10w
model23dtiles.exe -i D:\test.fbx -max 100000 -o D:\output -lat 30 -lng 116 -height 100
# Set the simplification ratio of the intermediate nodes of the output 3dtiles to 0.6
model23dtiles.exe -i D:\test.fbx -ratio 0.6 -o D:\output -lat 30 -lng 116 -height 100
# Set the tree structure of 3dtiles to a quadtree
model23dtiles.exe -i D:\test.fbx -t quad -o D:\output -lat 30 -lng 116 -height 100
-tf
texture format,option values are png、jpg、webp、ktx2,default value is jpg.
-vf
vertex format,option values are draco、meshopt、none,default is none.
-t
tree format,option values are quad、oc,default is quad.
compress_level
draco comporession level,option values are low、medium、high,default is medium.
-max
the maximum number of triangles contained in the b3dm node.default value is 40000.
-ratio
Simplified ratio of intermediate nodes.default is 0.5.
-lat
latitude,default is 30
-lng
longitude,default is 116
-height
height,default is 300
-multi_threading
Is multithreading enabled,default is false
这是作者的第一个开源项目,非常感谢osg、osgEarth、osgVerse、Fbx2glTF、3dtiles等开源项目对我的启发和帮助。
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。