@needle-tools/materialx 1.3.0 → 1.3.1

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.
Files changed (2) hide show
  1. package/README.md +27 -27
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -6,16 +6,41 @@ Web runtime support to load and display MaterialX materials in Needle Engine and
6
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
7
  > [Learn more in the Needle Engine documentation](https://engine.needle.tools/docs/materialx.html).
8
8
 
9
- ## Extension Design
9
+ ## Installation
10
+ `npm i @needle-tools/materialx`
11
+
12
+ ## Examples
13
+ - [three.js Example on Stackblitz](https://stackblitz.com/edit/needle-materialx-example?file=main.js,package.json,index.html)
14
+
15
+ ## How to use
16
+
17
+ ### Use with Needle Engine
18
+
19
+ ```ts
20
+ import { useNeedleMaterialX } from "@needle-tools/materialx/needle";
21
+ // Simply call this function in global scope as soon as possible
22
+ useNeedleMaterialX();
23
+ ```
24
+
25
+ ### Use with three.js
26
+
27
+ ```ts
28
+ import { useNeedleMaterialX } from "@needle-tools/materialx";
29
+ // Call the function with your GLTFLoader instance
30
+ useNeedleMaterialX(<yourGltfLoaderInstance>);
31
+ ```
32
+
33
+ ## glTF Extension: NEEDLE_materials_mtlx
10
34
 
11
35
  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
36
 
13
37
  The `textures` array is used to resolve texture paths from inside the MaterialX document to texture pointers in the glTF file.
14
38
 
39
+ Materials can also contain the `NEEDLE_materials_mtlx` extension, which references a document and shader. This allows you to use the same MaterialX document for multiple materials in the glTF file.
40
+
15
41
  ### Root-level extension
16
42
  ```json
17
43
  {
18
- ...
19
44
  "extensions": {
20
45
  "NEEDLE_materials_mtlx": {
21
46
  "documents": [
@@ -59,31 +84,6 @@ The `textures` array is used to resolve texture paths from inside the MaterialX
59
84
  }
60
85
  ```
61
86
 
62
- ## Installation
63
- `npm i @needle-tools/materialx`
64
-
65
- ## Examples
66
- - [three.js Example on Stackblitz](https://stackblitz.com/edit/needle-materialx-example?file=main.js,package.json,index.html)
67
-
68
- ## How to use
69
-
70
- ### Use with Needle Engine
71
-
72
- ```ts
73
- import { useNeedleMaterialX } from "@needle-tools/materialx/needle";
74
- // Simply call this function in global scope as soon as possible
75
- useNeedleMaterialX();
76
- ```
77
-
78
- ### Use with three.js
79
-
80
- ```ts
81
- import { useNeedleMaterialX } from "@needle-tools/materialx";
82
- // Call the function with your GLTFLoader instance
83
- useNeedleMaterialX(<yourGltfLoaderInstance>);
84
- ```
85
-
86
-
87
87
  <br />
88
88
 
89
89
  # Contact ✒️
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/materialx",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",