@needle-tools/materialx 1.2.2-next.4c698a4 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,9 @@ All notable changes to this package will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [1.3.0] - 2025-08-12
8
+ - Change: Refactor extension to use a documents array instead of a single document, backwards compatibility is maintained
9
+
7
10
  ## [1.2.2] - 2025-07-24
8
11
  - Add: `preloadWasm` function with support to wait for network idle. This is automatically done for Needle Engine projects.
9
12
 
package/README.md CHANGED
@@ -1,6 +1,63 @@
1
1
  # Needle MaterialX
2
2
 
3
- Web runtime support to load and display MaterialX materials in Needle Engine and three.js
3
+ Web runtime support to load and display MaterialX materials in Needle Engine and three.js via the MaterialX WebAssembly library. glTF files containing the `NEEDLE_materials_mtlx` extension can be loaded with this package. There is also experimental support for loading raw MaterialX XML files.
4
+
5
+ > [!TIP]
6
+ > When using Needle Engine for Unity, this package can be added to your project via the Needle Engine component. Add it to the "NpmDef Dependencies" field. MaterialX files will then be automatically generated from compatible Shader Graphs with the "MaterialX" export type.
7
+ > [Learn more in the Needle Engine documentation](https://engine.needle.tools/docs/materialx.html).
8
+
9
+ ## Extension Design
10
+
11
+ There is a root level glTF extension, `NEEDLE_materials_mtlx`, which contains an array of documents. Each document contains a MaterialX xml string, and information about textures and materials used in the document, so they can be resolved from inside the glTF buffers.
12
+
13
+ The `textures` array is used to resolve texture paths from inside the MaterialX document to texture pointers in the glTF file.
14
+
15
+ ### Root-level extension
16
+ ```json
17
+ {
18
+ ...
19
+ "extensions": {
20
+ "NEEDLE_materials_mtlx": {
21
+ "documents": [
22
+ {
23
+ "name": "Perforated_Metal",
24
+ "version": "1.38",
25
+ "xml": "<?xml version='1.0' encoding='UTF-8'?><materialx version=\"1.38\">...</materialx>",
26
+ "textures": [
27
+ {
28
+ "pointer": "/textures/0",
29
+ "name": "Perforated_Metal_diffuse"
30
+ },
31
+ {
32
+ "pointer": "/textures/1",
33
+ "name": "Perforated_Metal_normal"
34
+ }
35
+ ],
36
+ "shaders": [ // optional ]
37
+ }
38
+ ]
39
+ }
40
+ }
41
+ }
42
+ ```
43
+
44
+ ### Material-level extension
45
+ ```json
46
+ {
47
+ "materials": [
48
+ {
49
+ "name": "Perforated Metal",
50
+ "extensions": {
51
+ "NEEDLE_materials_mtlx": {
52
+ "name": "Perforated_Metal",
53
+ "document": 0,
54
+ "shader": 0
55
+ }
56
+ }
57
+ }
58
+ ]
59
+ }
60
+ ```
4
61
 
5
62
  ## Installation
6
63
  `npm i @needle-tools/materialx`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/materialx",
3
- "version": "1.2.2-next.4c698a4",
3
+ "version": "1.3.0",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -56,4 +56,4 @@
56
56
  "mtlx",
57
57
  "rendering"
58
58
  ]
59
- }
59
+ }