sayduck-gltf-pipeline

1.0.0 • Public • Published

sayduck-gltf-pipeline

Node package holding all of Sayduck's scripts to convert assets and products to glTF 2.0

Pipeline help

$ sayduck-gltf-pipeline -h
 
  Usage: sayduck-gltf-pipeline [options] [command]
 
  Options:
 
    -v, --version                           output the version number
    -h, --help                              output usage information
 
  Commands:
 
    obj-utility [options]
    material-utility [options]
    gltf-utility [options] <gltf-files...>

obj-utility

help

$ sayduck-gltf-pipeline obj-utility -h
 
  Usage: obj-utility [options]
 
  Options:
 
    -i, --input-file <input-file>        [required] path to .obj file to process
    -o, --output-folder <output-folder>  [required] output folder for generated file(s)
    --obj-split                          outputs one .obj per group present in .obj to process
    --gltf-convert                       convert the input .obj (or the resulting splitted .objs) to .gltf + .bin
    -h, --help                           output usage information

Example

$ sayduck-gltf-pipeline obj-utility -i path/to/source.obj -o path/to/output/folder/ --obj-split --gltf-convert
    {
      "status""success",
      "meshes": [
        {
          "reference""source_obj_group_1_name",
          "assets":  [
            {
              "type""obj",
              "uri""path/to/output/folder/source_obj_group_1_name.obj",
              "content_type""text/plain"
            },
            {
              "type""gltf",
              "uri""path/to/output/folder/source_obj_group_1_name.gltf",
              "content_type""model/gltf+json"
            },
            {
              "type""bin",
              "uri""path/to/output/folder/source_obj_group_1_name.bin",
              "content_type""application/octet-stream"
            },
          ]
        },
        ...
      ]
    }

material-utility

help

$ sayduck-gltf-pipeline material-utility -h
 
  Usage: material-utility [options]
 
  Options:
 
    -m, --material <material>               [required] path to material JSON file to process
    -g, --gltf <gltf>                       [required] path to .gltf file to process
    -o, --output-folder <output-folder>     [required] output folder for generated file(s)
    --material-assign <assigned-file-name>  assign the passed-in material JSON to the passed-in .gltf (will remove all existing materials, textures, images, samplers)
    -h, --help                              output usage information

Example

$ sayduck-gltf-pipeline material-utility --material-assign assigned_name.gltf --material path/to/gltf_material.json --gltf path/to/gltf.gltf -o path/to/output/folder/ 
    {
      "status""success",
      "meshes": [
        {
          "reference""assigned_name",
          "assets": [
            {
              "type""gltf",
              "uri""path/to/output/folder/assigned_name.gltf",
              "content_type""model/gltf+json"
            }
          ]
        }
      ]
    }

gltf-utility

help

$ sayduck-gltf-pipeline gltf-utility -h
 
  Usage: gltf-utility [options] <gltf-files...>
 
  Options:
 
    -o, --output-folder <output-folder>  [required] output folder for generated file(s)
    --gltf-merge [merged-file-name]      merge the list of passed-in gltf files (optional output name, defaults to merged.gltf)
    --gltf-optimize                      optimize the passed-in .gltf files
    --gltf-binary                        create .glb file(s) instead of .gltf
    --gltf-embed-assets                  embed assets in .gltf files (meshes are always embedded with --gltf-binary)
    --gltf-draco-compression             enable draco compression for meshes
    -h, --help                           output usage information

Example: gltf-merge

$ sayduck-gltf-pipeline gltf-utility --gltf-merge merged_name.gltf -o path/to/output/folder/ path/to/first.gltf path/to/second.gltf
    {
      "status""success",
      "meshes": [
        {
          "reference""merged_name",
          "assets": [
            {
              "type""gltf",
              "uri""path/to/output/folder/merged_name.gltf",
              "content_type""model/gltf+json"
            }
          ]
        }
      ]
    }

Example: gltf-optimize

$ sayduck-gltf-pipeline gltf-utility --gltf-optimize -o path/to/output/folder/ path/to/first.gltf path/to/second.gltf 
    {
      "status""success",
      "meshes": [
        {
          "reference""first",
          "assets": [
            {
              "type""gltf",
              "uri""path/to/output/folder/first.gltf",
              "content_type""model/gltf+json"
            },
            {
              "type""png",
              "uri""path/to/output/folder/texture.png",
              "content_type""image/png"
            },
            {
              "type""bin",
              "uri""path/to/output/folder/mesh.bin",
              "content_type""application/octet-stream"
            },
            ...
          ]
        },
        ...
      ]
    }

Example: create glb

$ sayduck-gltf-pipeline gltf-utility --gltf-optimize --gltf-binary --gltf-embed-assets -o path/to/output/folder/ path/to/input.gltf 
  {
      "status""success",
      "meshes": [
        {
          "reference""input",
          "assets": [
            {
              "type""glb",
              "uri""path/to/output/folder/input.glb",
              "content_type""model/gltf-binary"
            }
          ]
        }
      ]
    }

Readme

Keywords

none

Package Sidebar

Install

npm i sayduck-gltf-pipeline

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

88.4 kB

Total Files

23

Last publish

Collaborators

  • silvain-sayduck