@needle-tools/usd 1.0.0-next.d536d99 → 1.0.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,30 @@ 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.0.0] - 2026-06-30
8
+ ### Added
9
+ - Added optional material readiness policy support for loaders that need to wait for asynchronous material generation and texture loading before reporting completion.
10
+ - Added matrix coverage for USD Working Group assets, Needle Engine runtime shapes, public viewer lifecycle cleanup, authored USD concepts, and culling/material edge cases.
11
+
12
+ ### Changed
13
+ - Improved the existing Needle Engine integration so the Engine loader/component path uses the updated USD runtime, readiness, and cleanup behavior alongside the direct three.js Hydra path.
14
+ - Updated the public viewer examples so original glTF samples use the regular glTF loader path instead of wrapping glTF assets in USD.
15
+
16
+ ### Fixed
17
+ - Fixed Hydra lifecycle cleanup when switching assets so stale RPrim/SPrim state and three.js resources are destroyed instead of accumulating across loads.
18
+ - Addressed repeated-load resource leaks that could cause out-of-memory failures after cycling between large USDZ assets.
19
+ - Improved browser asset resolution for nested package paths, authored relative paths, parent-directory references, USDZ-embedded textures, GLB-embedded texture assets, and MaterialX texture assets.
20
+ - Fixed known MaterialX and UsdPreviewSurface texture regressions, including separate metallic/roughness/occlusion maps, packed texture updates after async loads, texture transforms, procedural texture fixtures, and noise/bricks sample coverage.
21
+ - Fixed material culling so materials are only cloned when the same authored material is used with conflicting sidedness, preserving animation bindings for the common shared-material path.
22
+ - Fixed USD-authored normals/interpolation handling to better match OpenUSD/usdview flat-vs-smooth behavior.
23
+ - Fixed single-sided/double-sided rendering for USD meshes and added shared-material culling tests.
24
+ - Fixed variant and payload switching so old selections are removed instead of double-rendering alongside the new composed result.
25
+ - Fixed up-axis setup before the first Hydra draw and across repeated stage loads so one asset cannot leak orientation state into the next.
26
+ - Fixed camera/light SPrim routing and expanded coverage for visibility, purpose switching, native instances, point instancers, and nested package references.
27
+ - Fixed Needle Engine loader timing and readiness so USD stages, materials, and animations initialize consistently through the Engine loader path.
28
+ - Fixed three.js/Needle Engine import compatibility across vanilla three.js and Engine-provided three.js runtime mappings.
29
+ - Fixed animated HTTP/USD package loads so playback time updates cannot dirty Hydra while an async initial draw is still in progress.
30
+
7
31
  ## [1.0.0-next.0] - 2026-06-25
8
32
  - Modernized the wasm runtime to upstream OpenUSD 26.05 with Hydra imaging enabled for the three.js render delegate.
9
33
  - Added the Adobe glTF file-format plugin, MaterialX support through Hydra material documents, and OpenSubdiv-enabled builds.
package/README.md CHANGED
@@ -8,12 +8,12 @@ For commercial use, please contact [hi@needle.tools](mailto:hi@needle.tools).
8
8
  ## Install
9
9
 
10
10
  ```sh
11
- npm install @needle-tools/usd@next three @needle-tools/materialx@1.7.0
11
+ npm install @needle-tools/usd@1.0.0 three
12
12
  ```
13
13
 
14
- This major prerelease uses upstream OpenUSD 26.05 and ships a Hydra imaging
15
- bridge for three.js. The wasm bundle includes Adobe `usdGltf`, MaterialX, and
16
- OpenSubdiv support.
14
+ Version 1.0 uses upstream OpenUSD 26.05 and ships a Hydra imaging bridge for
15
+ three.js. The wasm bundle includes Adobe `usdGltf`, MaterialX, and OpenSubdiv
16
+ support.
17
17
 
18
18
  ## Runtime Requirements
19
19
 
@@ -41,44 +41,218 @@ The modern Emscripten output contains `emHdBindings.js` and
41
41
  `emHdBindings.wasm`. It does not ship a separate `emHdBindings.worker.js`; the
42
42
  pthread workers load the main generated JavaScript entrypoint directly.
43
43
 
44
- ## Use with Needle Engine
45
-
46
-
47
- ```ts
48
- import { get } from "svelte/store";
49
- import { activeFiles } from "..";
50
- import { addPluginForNeedleEngine } from "@needle-tools/usd/plugins";
44
+ ## Minimal Examples
45
+
46
+ All browser examples must be served with the COOP/COEP headers from
47
+ ["Runtime Requirements"](#runtime-requirements). The import-map examples use
48
+ same-origin `/vendor/...` URLs so the threaded wasm worker can load the
49
+ Emscripten JavaScript from the page origin; replace those URLs with your own
50
+ served package paths.
51
+
52
+ ### three.js With Import Map
53
+
54
+ `index.html`
55
+
56
+ ```html
57
+ <!doctype html>
58
+ <html>
59
+ <body style="margin:0">
60
+ <script type="importmap">
61
+ {
62
+ "imports": {
63
+ "three": "/vendor/three/build/three.module.js",
64
+ "three/addons/": "/vendor/three/examples/jsm/",
65
+ "@needle-tools/materialx": "/vendor/@needle-tools/materialx/index.js",
66
+ "@needle-tools/usd": "/vendor/@needle-tools/usd/src/index.js",
67
+ "@needle-tools/usd/three": "/vendor/@needle-tools/usd/src/create.three.js"
68
+ }
69
+ }
70
+ </script>
71
+ <script type="module">
72
+ import * as THREE from "three";
73
+ import { getUsdModule } from "@needle-tools/usd";
74
+ import { createThreeHydra } from "@needle-tools/usd/three";
75
+
76
+ const scene = new THREE.Scene();
77
+ const camera = new THREE.PerspectiveCamera(45, innerWidth / innerHeight, 0.01, 1000);
78
+ camera.position.set(0, 1.5, 4);
79
+
80
+ const renderer = new THREE.WebGLRenderer({ antialias: true });
81
+ renderer.setSize(innerWidth, innerHeight);
82
+ document.body.append(renderer.domElement);
83
+
84
+ const usd = await getUsdModule();
85
+ const handle = await createThreeHydra({
86
+ USD: usd,
87
+ scene,
88
+ url: "./model.usdz"
89
+ });
90
+ await handle.ready();
91
+ // By default ready() waits for the stage and first Hydra draw, but not for
92
+ // async material generation. Pass waitForMaterials: true when correctness
93
+ // requires a material/texture barrier, or await handle.materialsReady().
94
+
95
+ let last = performance.now();
96
+ renderer.setAnimationLoop((time) => {
97
+ const dt = (time - last) / 1000;
98
+ last = time;
99
+ handle.update(dt);
100
+ renderer.render(scene, camera);
101
+ });
102
+ </script>
103
+ </body>
104
+ </html>
105
+ ```
51
106
 
52
- export function addUsdPlugin() {
53
- return addPluginForNeedleEngine({
54
- // USD files to load (first file must be the main file)
55
- getFiles: () => { return get(activeFiles) as Array<File & { path: string }> }
56
- })
107
+ ### three.js With Package Install
108
+
109
+ `package.json`
110
+
111
+ ```json
112
+ {
113
+ "type": "module",
114
+ "scripts": {
115
+ "dev": "vite --host 127.0.0.1"
116
+ },
117
+ "dependencies": {
118
+ "@needle-tools/usd": "1.0.0",
119
+ "three": "^0.185.0",
120
+ "vite": "^8.1.0"
121
+ }
57
122
  }
58
123
  ```
59
124
 
125
+ `index.html`
126
+
127
+ ```html
128
+ <!doctype html>
129
+ <html>
130
+ <body style="margin:0">
131
+ <script type="module">
132
+ import * as THREE from "three";
133
+ import { getUsdModule } from "@needle-tools/usd";
134
+ import { createThreeHydra } from "@needle-tools/usd/three";
135
+
136
+ const scene = new THREE.Scene();
137
+ const camera = new THREE.PerspectiveCamera(45, innerWidth / innerHeight, 0.01, 1000);
138
+ camera.position.set(0, 1.5, 4);
139
+
140
+ const renderer = new THREE.WebGLRenderer({ antialias: true });
141
+ renderer.setSize(innerWidth, innerHeight);
142
+ document.body.append(renderer.domElement);
143
+
144
+ const usd = await getUsdModule();
145
+ const handle = await createThreeHydra({
146
+ USD: usd,
147
+ scene,
148
+ url: "./model.usdz"
149
+ });
150
+ await handle.ready();
151
+
152
+ let last = performance.now();
153
+ renderer.setAnimationLoop((time) => {
154
+ const dt = (time - last) / 1000;
155
+ last = time;
156
+ handle.update(dt);
157
+ renderer.render(scene, camera);
158
+ });
159
+ </script>
160
+ </body>
161
+ </html>
162
+ ```
60
163
 
61
- ### Use with three.js
62
-
63
-
64
- See full example in [examples](/usd-wasm/examples/src/main.ts)
164
+ For Vite projects, add the `needleUSD()` plugin shown above so dev serving uses
165
+ the required COOP/COEP headers.
166
+
167
+ ### Needle Engine With Import Map
168
+
169
+ `index.html`
170
+
171
+ ```html
172
+ <!doctype html>
173
+ <html>
174
+ <body style="margin:0">
175
+ <script type="importmap">
176
+ {
177
+ "imports": {
178
+ "three": "/vendor/@needle-tools/engine/dist/three.min.js",
179
+ "three/addons/": "/vendor/@needle-tools/three/examples/jsm/",
180
+ "@needle-tools/engine": "/vendor/@needle-tools/engine/dist/needle-engine.min.js",
181
+ "@needle-tools/materialx": "/vendor/@needle-tools/materialx/index.js",
182
+ "@needle-tools/usd": "/vendor/@needle-tools/usd/src/index.js",
183
+ "@needle-tools/usd/three": "/vendor/@needle-tools/usd/src/create.three.js",
184
+ "@needle-tools/usd/plugins": "/vendor/@needle-tools/usd/src/plugins/index.js"
185
+ }
186
+ }
187
+ </script>
188
+ <script type="module">
189
+ import "@needle-tools/engine";
190
+ import { addPluginForNeedleEngine } from "@needle-tools/usd/plugins";
191
+
192
+ await addPluginForNeedleEngine({
193
+ // Defaults to non-blocking materials. Set waitForMaterials: true if the
194
+ // Needle loader should not report ready until materials/textures settle.
195
+ getFiles: () => []
196
+ });
197
+
198
+ document.body.insertAdjacentHTML(
199
+ "beforeend",
200
+ '<needle-engine src="./model.usdz" camera-controls contactshadows="0.7"></needle-engine>'
201
+ );
202
+ </script>
203
+ </body>
204
+ </html>
205
+ ```
65
206
 
66
- ```js
67
- import { getUsdModule } from "@needle-tools/usd";
68
- import { createThreeHydra } from "@needle-tools/usd/three";
207
+ ### Needle Engine With Package Install
208
+
209
+ `package.json`
210
+
211
+ ```json
212
+ {
213
+ "type": "module",
214
+ "scripts": {
215
+ "dev": "vite --host 127.0.0.1"
216
+ },
217
+ "dependencies": {
218
+ "@needle-tools/engine": "^5.1.2",
219
+ "@needle-tools/usd": "1.0.0",
220
+ "three": "npm:@needle-tools/three@^0.169.19",
221
+ "vite": "^8.1.0"
222
+ }
223
+ }
224
+ ```
69
225
 
70
- // Load the USD module
71
- const usd = await getUsdModule();
72
- // Load a USD file to be rendered by threejs
73
- const handle = await createThreeHydra({
74
- USD: usd,
75
- scene: ctx.scene,
76
- usdz: "http://localhost:8081/v1/public/89aa693/89aa693/ImageTrackingNeedleSample.usdz",
77
- })
78
- // Call handle.update(dt) in your threejs update loop
226
+ `index.html`
227
+
228
+ ```html
229
+ <!doctype html>
230
+ <html>
231
+ <body style="margin:0">
232
+ <script type="module">
233
+ import "@needle-tools/engine";
234
+ import { addPluginForNeedleEngine } from "@needle-tools/usd/plugins";
235
+
236
+ await addPluginForNeedleEngine({
237
+ // Defaults to non-blocking materials. Set waitForMaterials: true if the
238
+ // Needle loader should not report ready until materials/textures settle.
239
+ getFiles: () => []
240
+ });
241
+
242
+ document.body.insertAdjacentHTML(
243
+ "beforeend",
244
+ '<needle-engine src="./model.usdz" camera-controls contactshadows="0.7"></needle-engine>'
245
+ );
246
+ </script>
247
+ </body>
248
+ </html>
79
249
  ```
80
250
 
81
- Public package entrypoints:
251
+ For folder/drop workflows, return the active file set from `getFiles()`. The
252
+ first file must be the root USD file, and each file should have a stable `path`
253
+ property so USD references can resolve.
254
+
255
+ ## Public Entrypoints
82
256
 
83
257
  ```js
84
258
  import { getUsdModule, loadOpenUsdBuildInfo } from "@needle-tools/usd";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/usd",
3
- "version": "1.0.0-next.d536d99",
3
+ "version": "1.0.0",
4
4
  "main": "src/index.js",
5
5
  "types": "src/index.d.ts",
6
6
  "type": "module",
@@ -62,12 +62,13 @@
62
62
  "three-matrix:cache": "node scripts/cache-three-matrix.mjs",
63
63
  "test:bindings": "node --test tests/bindings/*.test.mjs",
64
64
  "test:needle-engine-matrix": "npm run needle-engine-matrix:cache && playwright test -c tests/needle-engine-matrix/playwright.config.ts",
65
+ "test:public-viewer-lifecycle": "playwright test -c tests/public-viewer/playwright.config.ts",
65
66
  "test:three-matrix": "node scripts/run-three-matrix.mjs",
66
67
  "test:viewer-visual": "playwright test -c tests/viewer-visual/playwright.config.ts"
67
68
  },
68
69
  "devDependencies": {
69
- "@needle-tools/engine": "^5.1.2",
70
- "@needle-tools/three-test-matrix": "^0.1.0",
70
+ "@needle-tools/engine": "^5.1.2-canary.1782735768.reasonable-ramen.4c74c99",
71
+ "@needle-tools/three-test-matrix": "^0.2.0",
71
72
  "@playwright/test": "^1.60.0",
72
73
  "@types/three": "^0.164.1",
73
74
  "vite": "^8.1.0"
@@ -77,6 +78,9 @@
77
78
  "registry": "https://registry.npmjs.org/"
78
79
  },
79
80
  "dependencies": {
80
- "@needle-tools/materialx": "1.7.0-next.57183d6"
81
+ "@needle-tools/materialx": "1.7.0"
82
+ },
83
+ "overrides": {
84
+ "@needle-tools/materialx": "1.7.0"
81
85
  }
82
86
  }