Giter VIP home page Giter VIP logo

gltfvariantmeld's Introduction

glTFVariantMeld

License: MIT CircleCI Actions Status

Description

This tool melds multiple glTF assets, each representing a different variant of a model, into a single, compact format, implemented as a glTF extension.

A canonical use case is a retail product that's available in a range of colour combinations, with an application that lets a prospective customer switch between these different variants with minimal latency.

We're making this internal tool publicly available with the hope of helping the glTF ecosystem come together around a common, open format. In this prerelease version, the tool produces files with the vendor extension FB_material_variants. We are hopeful that the glTF community will find speedy consensus around a ratified extension.

In this prerelease version, the tool produces files with the vendor extension FB_material_variants. We are hopeful that the glTF community will find speedy consensus around a multi-vendor extension.

Our aspirational roadmap includes the development of a web app which would leverage WebAssembly to run entirely in the browser. There will also be a native CLI.

Assistance is always welcome! Pull requests are encouraged.

Installation

We've yet to actually publish a release. Until we do, please build the bleeding edge code yourself.

Usage

The tool depends on glTF source files that are identical except for which materials the various meshes reference. The proposed work flow is to export the same asset from the same digital content creation app repeatedly, taking care to make no changes to geometry or structure between each exported file.

Then, using the (quite primitive, as yet) command-line interface might look like:

> dist/app.js black:GizmoBlack.glb blue:GizmoBlue.glb clear:GizmoClear.glb GizmoVariational.glb
Parsing source asset: 'GizmoBlack.glb'...
Initial asset:
             Total file size: 2.4 MB
          Total texture data: 1.8 MB
  Of which is depends on tag: 0.0 kB

Parsing source asset: 'GizmoBlue.glb'...
New melded result:
             Total file size: 3.9 MB
          Total texture data: 3.3 MB
  Of which is depends on tag: 3.3 MB

Parsing source asset: 'GizmoClear.glb'...
New melded result:
             Total file size: 4.6 MB
          Total texture data: 4.0 MB
  Of which is depends on tag: 4.0 MB
Success! 4594404 bytes written to 'GizmoVariational.glb'.

The first source file contains 1.8 MB of textures and 0.6 MB of geometry. Subsequent source files contribute first another 1.5 MB of textures, and then for the third variant, 1.7 MB. The geometry of the asset remains constant.

Asset Requirements

For assets to be meldable, they must be logically identical: contain the same meshes, with the same mesh primitives. They may vary meaningfully only in what materials are assigned to each mesh primitive. The tool will complain if it finds disrepancies between the source assets that are too confusing for it to work around.

During the melding process, all common data is shared, whereas varying material definitions and textures are copied as needed. Parts of the assets that don't vary are left untouched.

Each source asset brought into the tool is identified by a tag, a short string, and it's these same tags that are later used to trigger different runtime apperances.

Building

Please see separate BUILDING instructions.

Contributing

See the CONTRIBUTING file for how to help out.

Credits

This tool was written by Pär Winzel and Renee Rashid with help from Susie Su and Jeremy Cytryn, and ultimately made possible only through the hard work of others:

  • The Rust language & community,
  • The authors of wasm-bindgen, for WebAssembly support,
  • The Rust crates gltf and serde.
  • and many others...

License

glTFVariantMeld is NIT licensed, as found in the LICENSE file.

gltfvariantmeld's People

Contributors

debuggrl avatar zellski avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.