npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@sayduck/gltf-pipeline

v3.4.2-pre-1

Published

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

Downloads

369

Readme

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]
    gltf-utility [options] <gltf-files...>
    create-gltf [options]

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
    --obj-fix                            generates normals and UVs for the input .obj (or the resulting split .objs) if missing
    --gltf-convert                       convert the input .obj (or the resulting split .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"
            },
          ]
        },
        ...
      ]
    }

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-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-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"
            }
          ]
        }
      ]
    }

create-gltf

help


  Usage: create-gltf [options]

  Options:

    -i, --input-file <input-file>   [required] path to the JSON file to process
    -o --output-file <output-file>  [required] processed glTF file
    --meshes-key                    specifify a JSON key to read glTF meshes from (defaults to `meshes`)
    --materials-key                 specifify a JSON key to read glTF materials from (defaults to `materials`)
    --mesh-assignments-key          specifify a JSON key to read mesh-material assignments from (defaults to `mesh_assignments`)
    -h, --help                      output usage information

Example

$ sayduck-gltf-pipeline create-gltf -i path/to/input/file.json -o path/to/output/file.gltf
    {
      "status": "success",
      "gltfPath": "path/to/output/file.gltf"
    }

Example input-file.json

{
  "meshes": {
    [meshUuid]: { meshGltf },
    ...
  },
  "materials": {
    [materialUuid]: {
      name,
      extras,
      alpha_mode,
      is_double_sided,
      albedo_colour, // { red, green, blue, alpha }
      emissive_colour, // { red, green, blue }
      albedo_transparency,
      roughness, // 0.0 - 1.0
      metallicness, // 0.0 - 1.0
      occlusion_map_intensity, // 0.0 - 1.0
      maps,
      // [
      //   {
      //     kind, // 'albedo' / 'occlusion_roughness_metallic' / 'normal' / 'emissive'
      //     urls: { jpg, png },
      //   },
      //   ...
      // ]
      map_tiling, // { x, y }
      map_tiling_offset, // { x, y }
      map_tiling_rotation, // 0 - 360
    },
    ...
  },
  "mesh_assignments": {
    [meshAssignmentUuid]: {
      "mesh": [meshUuid],
      "material": [materialUuid]
    },
    ...
  }
}

create-glb

help


  Usage: create-glb [options]

  Options:

    -i, --input-file <input-file>   [required] path to the .gltf file to process
    -o --output-file <output-file>  [required] processed .glb file
    -h, --help                      output usage information

Example

$ sayduck-gltf-pipeline create-glb -i path/to/input/file.gltf -o path/to/output/file.glb
    {
      "status": "success",
      "gltfPath": "path/to/output/file.glb"
    }