Skip to content

chrismichaelps/WebUsdFramework

Repository files navigation

WebUsdFramework

Library for converting GLB/GLTF 3D models to USDZ format.

This library builds USD schemas based on the OpenUSD Core API specifications. The USD schema implementation follows the Universal Scene Description standards developed by Pixar Animation Studios.

Current Status

⚠️ This is a proof of concept (POC) - The library is currently in active development and should be used for experimental purposes. While functional, it may not be production-ready for all use cases.

Prerequisites

  • Node.js >= 22.0.0
  • Yarn >= 1.x

📚 Documentation

📦 Installation

pnpm install

Basic Usage

const { defineConfig } = require('./build/index.js');

// Create framework instance
const usd = defineConfig();

// Convert GLB file to USDZ
const usdzBlob = await usd.convert('./model.glb');

// Convert GLTF file to USDZ
const usdzBlob2 = await usd.convert('./model.gltf');

// Save the result
const fs = require('fs');
const buffer = await usdzBlob.arrayBuffer();
fs.writeFileSync('output.usdz', Buffer.from(buffer));

With Debug Output

const { defineConfig } = require('./build/index.js');

// Enable debug mode for inspection
const usd = defineConfig({
  debug: true,
  debugOutputDir: './debug-output',
});

// Convert with detailed logging
const usdzBlob = await usd.convert('./model.glb');

// Debug files will be created in ./debug-output/
// - model.usda (main USD file)
// - geometries/ (external geometry files)
// - textures/ (texture files)
// - converted.usdz (final package)

From ArrayBuffer

const { defineConfig } = require('./build/index.js');
const fs = require('fs');

const usd = defineConfig();

// From file system (Node.js) - GLB files
const glbBuffer = fs.readFileSync('model.glb').buffer;
const usdzBlob = await usd.convert(glbBuffer);

// From file path - GLTF files
const usdzBlob2 = await usd.convert('./model.gltf');

// Save the result
const buffer = await usdzBlob.arrayBuffer();
fs.writeFileSync('output.usdz', Buffer.from(buffer));

Advanced Configuration

const { defineConfig } = require('./build/index.js');
const fs = require('fs');

const config = {
  debug: true,
  debugOutputDir: './output',
  upAxis: 'Y',
  metersPerUnit: 1,
};

const usd = defineConfig(config);

// Works with both GLB and GLTF files
const usdzBlob = await usd.convert('./model.glb'); // GLB file
const usdzBlob2 = await usd.convert('./model.gltf'); // GLTF file with external resources

// Save the result
const buffer = await usdzBlob.arrayBuffer();
fs.writeFileSync('output.usdz', Buffer.from(buffer));

...

🤝 Contributing

  • Fork it!
  • Create your feature branch: git checkout -b my-new-feature
  • Commit your changes: git commit -am 'Add some feature'
  • Push to the branch: git push origin my-new-feature
  • Submit a pull request

👥 Credits


💢 Troubleshootings

This is just a personal project created for study / demonstration purpose and to simplify my working life, it may or may not be a good fit for your project(s).


❤️ Show your support

Please ⭐ this repository if you like it or this project helped you!
Feel free to open issues or submit pull-requests to help me improving my work.


🤖 Author

Chris M. Perez

You can follow me on github · twitter


Copyright ©2025 WebUsdFramework.

About

POC: Library for converting GLB/GLTF 3D models to USDZ format.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published