Skip to content

glb转b3dms

使用cesium官方提供的3d-tiles-tools将glb文件转换为b3dms并压缩,支持在cesium中加载

安装

shell
npm i 3d-tiles-tools -g

pipeline

glb2b3dms.json文件

json
{
  "input": "/Users/AShuGuo/Documents/gis/梦想小镇/2-3dtiles",
  "output": "/Users/AShuGuo/Documents/gis/梦想小镇/2-compress",
  "tilesetStages": [
    {
      "name": "upgrade",
      "description": "Upgrade the input tileset to the latest version"
    },
    {
      "name": "combine",
      "description": "Combine all external tilesets into one"
    },
    {
      "name": "_glbToB3dm",
      "description": "Convert GLB to B3DM",
      "contentStages": [
        {
          "name": "glbToB3dm",
          "description": "Convert each GLB content into B3DM"
        }
      ]
    },
    {
      "name": "_optimizeB3dm",
      "description": "Optimize B3dm",
      "contentStages": [
        {
          "name": "optimizeB3dm",
          "description": "Apply gltf-pipeline to each B3dm content, with the given options",
          "options": {
            "dracoOptions": {
              "compressionLevel": 10,
              "compressMeshes": true
            }
          }
        }
      ]
    }
  ]
}

执行pipeline

shell
3d-tiles-tools pipeline -i ./glb2b3dms.json