{"id":15033131,"url":"https://github.com/cesiumgs/gltf-pipeline","last_synced_at":"2025-05-14T07:10:33.864Z","repository":{"id":38204181,"uuid":"46226879","full_name":"CesiumGS/gltf-pipeline","owner":"CesiumGS","description":"Content pipeline tools for optimizing glTF assets. :globe_with_meridians:","archived":false,"fork":false,"pushed_at":"2024-06-27T09:29:14.000Z","size":26613,"stargazers_count":2023,"open_issues_count":103,"forks_count":254,"subscribers_count":54,"default_branch":"main","last_synced_at":"2025-05-04T18:49:09.446Z","etag":null,"topics":["3d-converter","gltf"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CesiumGS.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-11-15T17:00:20.000Z","updated_at":"2025-04-30T05:46:15.000Z","dependencies_parsed_at":"2022-07-13T19:30:32.249Z","dependency_job_id":"97fa7374-77d2-40d5-841c-1680ecfacd82","html_url":"https://github.com/CesiumGS/gltf-pipeline","commit_stats":null,"previous_names":[],"tags_count":45,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CesiumGS%2Fgltf-pipeline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CesiumGS%2Fgltf-pipeline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CesiumGS%2Fgltf-pipeline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CesiumGS%2Fgltf-pipeline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CesiumGS","download_url":"https://codeload.github.com/CesiumGS/gltf-pipeline/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254092797,"owners_count":22013291,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["3d-converter","gltf"],"created_at":"2024-09-24T20:20:11.604Z","updated_at":"2025-05-14T07:10:28.851Z","avatar_url":"https://github.com/CesiumGS.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# glTF Pipeline\n\n[![License](https://img.shields.io/:license-apache-blue.svg)](https://github.com/CesiumGS/gltf-pipeline/blob/main/LICENSE.md)\n[![Build Status](https://travis-ci.org/CesiumGS/gltf-pipeline.svg?branch=main)](https://travis-ci.org/CesiumGS/gltf-pipeline)\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://www.khronos.org/gltf\"\u003e\u003cimg src=\"doc/gltf.png\" onerror=\"this.src='gltf.png'\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nContent pipeline tools for optimizing [glTF](https://www.khronos.org/gltf) assets by [Richard Lee](http://leerichard.net/) and the [Cesium team](https://cesium.com/).\n\nSupports common operations including:\n\n- Converting glTF to glb (and reverse)\n- Saving buffers/textures as embedded or separate files\n- Converting glTF 1.0 models to glTF 2.0\n- Applying [Draco](https://github.com/google/draco) mesh compression\n\n`gltf-pipeline` can be used as a command-line tool or Node.js module.\n\n## Getting Started\n\nInstall [Node.js](https://nodejs.org/en/) if you don't already have it, and then:\n\n```\nnpm install -g gltf-pipeline\n```\n\n### Using gltf-pipeline as a command-line tool:\n\n#### Converting a glTF to glb\n\n`gltf-pipeline -i model.gltf -o model.glb`\n\n`gltf-pipeline -i model.gltf -b`\n\n#### Converting a glb to glTF\n\n`gltf-pipeline -i model.glb -o model.gltf`\n\n`gltf-pipeline -i model.glb -j`\n\n#### Converting a glTF to Draco glTF\n\n`gltf-pipeline -i model.gltf -o modelDraco.gltf -d`\n\n### Saving separate textures\n\n`gltf-pipeline -i model.gltf -t`\n\n### Using gltf-pipeline as a library:\n\n#### Converting a glTF to glb:\n\n```javascript\nconst gltfPipeline = require(\"gltf-pipeline\");\nconst fsExtra = require(\"fs-extra\");\nconst gltfToGlb = gltfPipeline.gltfToGlb;\nconst gltf = fsExtra.readJsonSync(\"./input/model.gltf\");\nconst options = { resourceDirectory: \"./input/\" };\ngltfToGlb(gltf, options).then(function (results) {\n  fsExtra.writeFileSync(\"model.glb\", results.glb);\n});\n```\n\n#### Converting a glb to embedded glTF\n\n```javascript\nconst gltfPipeline = require(\"gltf-pipeline\");\nconst fsExtra = require(\"fs-extra\");\nconst glbToGltf = gltfPipeline.glbToGltf;\nconst glb = fsExtra.readFileSync(\"model.glb\");\nglbToGltf(glb).then(function (results) {\n  fsExtra.writeJsonSync(\"model.gltf\", results.gltf);\n});\n```\n\n#### Converting a glTF to Draco glTF\n\n```javascript\nconst gltfPipeline = require(\"gltf-pipeline\");\nconst fsExtra = require(\"fs-extra\");\nconst processGltf = gltfPipeline.processGltf;\nconst gltf = fsExtra.readJsonSync(\"model.gltf\");\nconst options = {\n  dracoOptions: {\n    compressionLevel: 10,\n  },\n};\nprocessGltf(gltf, options).then(function (results) {\n  fsExtra.writeJsonSync(\"model-draco.gltf\", results.gltf);\n});\n```\n\n#### Saving separate textures\n\n```javascript\nconst gltfPipeline = require(\"gltf-pipeline\");\nconst fsExtra = require(\"fs-extra\");\nconst processGltf = gltfPipeline.processGltf;\nconst gltf = fsExtra.readJsonSync(\"model.gltf\");\nconst options = {\n  separateTextures: true,\n};\nprocessGltf(gltf, options).then(function (results) {\n  fsExtra.writeJsonSync(\"model-separate.gltf\", results.gltf);\n  // Save separate resources\n  const separateResources = results.separateResources;\n  for (const relativePath in separateResources) {\n    if (separateResources.hasOwnProperty(relativePath)) {\n      const resource = separateResources[relativePath];\n      fsExtra.writeFileSync(relativePath, resource);\n    }\n  }\n});\n```\n\n### Command-Line Flags\n\n| Flag                           | Description                                                                                                                                                  | Required                                  |\n| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------- |\n| `--help`, `-h`                 | Display help                                                                                                                                                 | No                                        |\n| `--input`, `-i`                | Path to the glTF or glb file.                                                                                                                                | :white_check_mark: Yes                    |\n| `--output`, `-o`               | Output path of the glTF or glb file. Separate resources will be saved to the same directory.                                                                 | No                                        |\n| `--binary`, `-b`               | Convert the input glTF to glb.                                                                                                                               | No, default `false`                       |\n| `--json`, `-j`                 | Convert the input glb to glTF.                                                                                                                               | No, default `false`                       |\n| `--separate`, `-s`             | Write separate buffers, shaders, and textures instead of embedding them in the glTF.                                                                         | No, default `false`                       |\n| `--separateTextures`, `-t`     | Write out separate textures only.                                                                                                                            | No, default `false`                       |\n| `--stats`                      | Print statistics to console for output glTF file.                                                                                                            | No, default `false`                       |\n| `--keepUnusedElements`         | Keep unused materials, nodes and meshes.                                                                                                                     | No, default `false`                       |\n| `--keepLegacyExtensions`       | When false, materials with `KHR_techniques_webgl`, `KHR_blend`, or `KHR_materials_common` will be converted to PBR.                                          | No, default `false`                       |\n| `--draco.compressMeshes`, `-d` | Compress the meshes using Draco. Adds the `KHR_draco_mesh_compression` extension.                                                                            | No, default `false`                       |\n| `--draco.compressionLevel`     | Draco compression level [0-10], most is 10, least is 0. A value of 0 will apply sequential encoding and preserve face order.                                 | No, default `7`                           |\n| `--draco.quantizePositionBits` | Quantization bits for position attribute when using Draco compression.                                                                                       | No, default `11`                          |\n| `--draco.quantizeNormalBits`   | Quantization bits for normal attribute when using Draco compression.                                                                                         | No, default `8`                           |\n| `--draco.quantizeTexcoordBits` | Quantization bits for texture coordinate attribute when using Draco compression.                                                                             | No, default `10`                          |\n| `--draco.quantizeColorBits`    | Quantization bits for color attribute when using Draco compression.                                                                                          | No, default `8`                           |\n| `--draco.quantizeGenericBits`  | Quantization bits for skinning attribute (joint indices and joint weights) and custom attributes when using Draco compression.                               | No, default `8`                           |\n| `--draco.unifiedQuantization`  | Quantize positions of all primitives using the same quantization grid. If not set, quantization is applied separately.                                       | No, default `false`                       |\n| `--draco.uncompressedFallback` | Adds uncompressed fallback versions of the compressed meshes.                                                                                                | No, default `false`                       |\n| `--baseColorTextureNames`      | Names of uniforms that should be considered to refer to base color textures \u003cbr /\u003e when updating from the `KHR_techniques_webgl` extension to PBR materials. | No. (The defaults are not specified here) |\n| `--baseColorFactorNames`       | Names of uniforms that should be considered to refer to base color factors \u003cbr /\u003e when updating from the `KHR_techniques_webgl` extension to PBR materials.  | No. (The defaults are not specified here) |\n\n## Build Instructions\n\nRun the tests:\n\n```\nnpm run test\n```\n\nTo run ESLint on the entire codebase, run:\n\n```\nnpm run eslint\n```\n\nTo run ESLint automatically when a file is saved, run the following and leave it open in a console window:\n\n```\nnpm run eslint-watch\n```\n\n### Building for CesiumJS integration\n\nSome functionality of gltf-pipeline is used by CesiumJS as a third party library. The necessary files can be generated using:\n\n```\nnpm run build-cesium\n```\n\nThis will output a portion of the gltf-pipeline code into the `dist/cesium` folder for use with CesiumJS in the browser. Copy the files into `Source/Scene/GltfPipeline/` in the [`cesium`](https://github.com/CesiumGS/cesium) repository and submit a pull request.\n\n### Running Test Coverage\n\nCoverage uses [nyc](https://github.com/istanbuljs/nyc). Run:\n\n```\nnpm run coverage\n```\n\nFor complete coverage details, open `coverage/lcov-report/index.html`.\n\nThe tests and coverage covers the Node.js module; it does not cover the command-line interface, which is tiny.\n\n## Generating Documentation\n\nTo generate the documentation:\n\n```\nnpm run jsdoc\n```\n\nThe documentation will be placed in the `doc` folder.\n\n## Contributions\n\nPull requests are appreciated! Please use the same [Contributor License Agreement (CLA)](https://github.com/CesiumGS/cesium/blob/main/CONTRIBUTING.md) and [Coding Guide](https://github.com/CesiumGS/cesium/blob/main/Documentation/Contributors/CodingGuide/README.md) used for [Cesium](https://github.com/CesiumGS/cesium).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcesiumgs%2Fgltf-pipeline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcesiumgs%2Fgltf-pipeline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcesiumgs%2Fgltf-pipeline/lists"}