Skip to content

bhouston/material-viewer

Repository files navigation

material-viewer

TypeScript monorepo for reading, validating, and writing MaterialX XML, with node definitions generated from upstream MaterialX nodedef documents.

Packages

  • packages/mtlx-core - typed MaterialX document model, XML parser/serializer, filesystem IO helpers, validation API, generated node registry
  • packages/mtlx - command-line tool built with yargs-file-commands
  • packages/materialx-three - MaterialX to Three.js TSL compiler/runtime for Standard Surface and OpenPBR workflows
  • apps/viewer - TanStack Start preview app for interactive MaterialX -> Three TSL diagnostics, rendering, and upstream sample browsing

Tooling

  • pnpm workspaces monorepo
  • TypeScript native preview (tsgo) with composite projects
  • oxlint + oxfmt
  • vitest for package tests
  • vitest-command-line for CLI subprocess tests

Install

pnpm install

Development Commands

pnpm lint
pnpm format
pnpm tsc
pnpm test
pnpm build
pnpm cli -- --help

Releasing To npm

Release scripts stage each package into publish/, rewrite workspace:* dependencies to real versions, and then publish.

Prerequisites:

  • Root LICENSE file must exist (release fails if missing)
  • npm auth must be configured for publish

Commands:

# Publish one package
pnpm release:package packages/mtlx-core

# Publish all packages in order
pnpm release:all

# Dry-run staging only (no npm publish)
pnpm release:package packages/mtlx-core --dry-run
pnpm release:all --dry-run

Node Registry Generation

Node definitions are generated from:

  • ../MaterialX/libraries/**/*.mtlx

Run:

pnpm generate:nodes

This regenerates:

  • packages/mtlx-core/src/generated/node-registry.generated.ts

CLI Commands

pnpm cli -- info <input.mtlx>
pnpm cli -- check <input.mtlx|input.mtlz>
pnpm cli -- pack <input.mtlx>
pnpm cli -- unpack <input.mtlz>

Validation Corpus

Current test fixtures are loaded from the local upstream checkout in ../MaterialX, including:

  • resources/Materials/Examples/StandardSurface/standard_surface_brick_procedural.mtlx
  • resources/Materials/Examples/OpenPbr/open_pbr_default.mtlx
  • resources/Materials/TestSuite/stdlib/texture/image.mtlx
  • resources/Materials/TestSuite/stdlib/texture/tiledimage.mtlx
  • resources/Materials/TestSuite/stdlib/math/math_operators.mtlx
  • resources/Materials/TestSuite/stdlib/compositing/compositing.mtlx

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors