@nebula-spatial/viewer 0.5.12 → 0.5.14

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
@@ -2,6 +2,57 @@
2
2
 
3
3
  All notable changes to this package are documented in this file.
4
4
 
5
+ ## 0.5.14
6
+
7
+ ### Added
8
+
9
+ - 新增 `@nebula-spatial/viewer/vite` 的 `viewerRuntimeAssets()` 插件:开发服务器以稳定文件名提供 `basis/`、`draco/`,生产构建输出同名目录,并把包内 OpenUSD 的 JS/WASM 作为带哈希的独立静态资产交给打包器。
10
+ - 新增 `./basis/*`、`./draco/*`、`./runtime-assets` 子路径导出;`draco/` 运行时(`draco_wasm_wrapper.js`、`draco_decoder.wasm`)随包发布,`runtime-assets` 提供未安装插件时的回退目录与 URL 常量。
11
+ - 未配置 `openUsdBaseUrl` 时默认使用包内 OpenUSD runtime;`assets.openUsdWasmModule`、本地目录和 CDN 显式覆盖继续可用。
12
+ - 发布流程新增 `check:runtime-assets`,校验包内 Basis/Draco/OpenUSD 文件与导出是否完整。
13
+
14
+ ### Changed
15
+
16
+ - `vite` 成为可选 peer dependency(`>=5.0.0`);Vite 消费方接入插件后不再需要手工复制 Basis/Draco 文件,GLB/glTF Draco 也不再必须显式配置 `dracoDecoderPath`。
17
+ - 移除仓库内 `web/public/{openusd,basis,draco}` 静态副本和 OpenUSD 同步脚本,各 Vite 配置统一通过插件输出运行时资源。
18
+ - 默认资源路径调整:Basis/Draco 改为相对当前页面目录的 `basis/`、`draco/`;OpenUSD 在 Vite 下使用包内资产,无插件时回退到站点根 `/openusd/`。
19
+
20
+ ### Fixed
21
+
22
+ - 保留 `usd-preload` 与公开 `usd-prewarm` 声明文件,避免严格 TypeScript 消费方在发布包类型检查时找不到公开入口。
23
+
24
+ ### Behavior notes
25
+
26
+ - 现有 Vite 消费方需在 `vite.config` 中加入 `viewerRuntimeAssets()`;未加入时需自行提供页面相对的 `basis/`、`draco/` 目录,OpenUSD 回退到 `/openusd/`。
27
+ - 依赖旧版站点根 `/basis/` 默认路径的部署应改为接入插件,或继续显式设置 `assets.ktx2TranscoderPath`、`assets.dracoDecoderPath`;旧静态副本可直接删除。
28
+ - 非 Vite 宿主仍需从 `@nebula-spatial/viewer/openusd|basis|draco` 提供文件,或通过显式 URL 覆盖;单线程 OpenUSD 的 CORS 与跨源要求不变。
29
+ - 本次发布只更新 Viewer;`@nebula-spatial/cad-loader`、私有 `scene-runtime` 和 OpenUSD 运行时文件内容均无变更。
30
+
31
+ ## 0.5.13
32
+
33
+ ### Added
34
+
35
+ - 扩展 MaterialX Standard Surface 常用语义:emission weight/color、specular color/anisotropy/rotation、coat color 与 coat IOR(F0 近似)、subsurface 受控透射近似、颜色亮度 `opacity`、`base` 权重;`specular_color`/`sheen_color` 颜色纹理、`coat_normal` 到 `clearcoatNormalMap`、`specular` 权重 A 通道到 `specularIntensityMap`。
36
+ - 支持实体外壳包围实体介质的嵌套透射:通过封闭网格射线识别内层介质并校验完整几何包含关系,合并真实壁厚与内部介质光程,将内层 IOR、透射色和体积吸收接入 transmission shader,同时保留屏幕空间折射。
37
+ - 新增官方 MaterialX 库审计基线与 `MATERIALX-LIBRARY-AUDIT.md`(随包发布):覆盖官方 TestSuite / StandardSurface Examples 的节点出现次数、分类和适配边界;仓库内可通过 `npm run audit:materialx` 重跑,`--strict` 下未知节点直接失败。
38
+
39
+ ### Changed
40
+
41
+ - 嵌套标签由覆盖层改为完整标签材质栈:离屏透射时只抑制相机近侧片元,保留背面标签采样;未声明双面且整体反向绕序的纹理表面也能正确显示。
42
+ - 完善 MaterialX 基础色权重、coat 纹理衰减和重复适配的组合逻辑,补充官方多材质球体链路回归。
43
+ - MaterialX UV 与通道语义完善:支持 `ND_separate3_color3` 通道提取、glTF normal map 标准 `[2,2,2]` / `[-1,-1,-1]` scale/bias、`ND_multiply_vector2(FA)` UV 缩放与 `texcoord` reader 组合;节点自身与上游同时存在 UV 变换时报告 `TEXTURE_UV_UNSUPPORTED`,不再静默选取。
44
+
45
+ ### Fixed
46
+
47
+ - 修复实体透射标签重复采样:标签材质栈对所有透射体积统一判定,避免同一标签被多个体积重复安装 shader。
48
+ - 修复 MaterialX 纹理 UV 变换在上游 `multiply`/`transform2d` 链中丢失,以及 glTF normal map 未应用标准解码 scale/bias 的问题。
49
+
50
+ ### Behavior notes
51
+
52
+ - 实体嵌套透射仅在外壳完整包含内层介质且射线校验通过时启用;不满足时保持原有的单层透射近似,不使用包围盒推断替代。
53
+ - MaterialX 仍不执行任意节点图。程序化噪声、ramp、复杂 blend/layer、条件节点和多 UV set 继续保留 gap,并在审计报告中列出。
54
+ - 本次发布只更新 Viewer;`@nebula-spatial/cad-loader`、私有 `scene-runtime` 和 OpenUSD 运行时均无变更。
55
+
5
56
  ## 0.5.12
6
57
 
7
58
  ### Fixed
@@ -0,0 +1,250 @@
1
+ # MaterialX Official Library Coverage Audit
2
+
3
+ - Generated: 2026-11-12
4
+ - MaterialX revision: `9176de82cd993bace533b734e17f9ca738061714`
5
+ - MaterialX checkout: `materialx-official-validation`
6
+ - Files scanned: `168`
7
+ - Nodes observed: `157`
8
+ - Parse errors: `2`
9
+
10
+ This report extracts node usage from the official MaterialX TestSuite and
11
+ StandardSurface examples, then applies the Viewer Adapter policy. It is an
12
+ audit of declared coverage, not a claim that each conditional node is
13
+ executable in every authored graph.
14
+
15
+ ## Classification Summary
16
+
17
+ | Classification | Meaning | Nodes | Occurrences |
18
+ |---|---|---:|---:|
19
+ | `adapter-bounded` | Mapped common slots with documented material-level approximation. | 2 | 114 |
20
+ | `adapter-conditional` | Only specific constant, channel, UV or texture-graph forms are mapped. | 24 | 769 |
21
+ | `shader-required` | Requires graph/shader evaluation or work beyond the Adapter layer. | 126 | 751 |
22
+ | `structural` | Material/look organization rather than a renderable shader node. | 5 | 254 |
23
+
24
+ ## Node Matrix
25
+
26
+ | Node | Group | TestSuite | Examples | Total | Classification | Adapter boundary |
27
+ |---|---|---:|---:|---:|---|---|
28
+ | `standard_surface` | `pbr` | 77 | 34 | 111 | `adapter-bounded` | Standard Surface common PBR slots map to Three.js; advanced layering/BSDF semantics remain incomplete. |
29
+ | `open_pbr_surface` | `pbr` | 3 | 0 | 3 | `adapter-bounded` | OpenPBR subset mapped to MeshPhysicalMaterial; advanced BSDF/volume semantics remain incomplete. |
30
+ | `image` | `texture2d` | 68 | 59 | 127 | `adapter-conditional` | Texture lookup only when resource, channel, color space and UV contract resolve. |
31
+ | `multiply` | `pbr` | 104 | 12 | 116 | `adapter-conditional` | Constant affine operand only when one side is a sampled texture or UV graph. |
32
+ | `constant` | `procedural` | 98 | 1 | 99 | `adapter-conditional` | Folded only as a constant operand for supported texture/UV affine graphs. |
33
+ | `add` | `pbr` | 42 | 4 | 46 | `adapter-conditional` | Constant affine operand only when one side is a sampled texture or UV graph. |
34
+ | `mix` | `pbr` | 43 | 3 | 46 | `adapter-conditional` | Only texture plus constant foreground/background with a constant mask. |
35
+ | `tiledimage` | `texture2d` | 33 | 10 | 43 | `adapter-conditional` | Authored tiling/offset and supported UV/address modes only. |
36
+ | `texcoord` | `geometric` | 40 | 1 | 41 | `adapter-conditional` | UV0 or a resolved single UV set; multiple UV sets remain gaps. |
37
+ | `divide` | `math` | 29 | 1 | 30 | `adapter-conditional` | Constant affine operand only; vector divisors and shader evaluation remain gaps. |
38
+ | `subtract` | `math` | 29 | 1 | 30 | `adapter-conditional` | Constant affine operand only; vector subtraction is not evaluated per pixel. |
39
+ | `normalmap` | `math` | 13 | 16 | 29 | `adapter-conditional` | Default scale/frame chains only; custom tangent frames remain gaps. |
40
+ | `transformmatrix` | `math` | 28 | 0 | 28 | `adapter-conditional` | Constant matrix33 only, converted from MaterialX row-vector convention. |
41
+ | `extract` | `channel` | 24 | 1 | 25 | `adapter-conditional` | Texture channel extraction only when index and source width are known. |
42
+ | `convert` | `shader` | 22 | 2 | 24 | `adapter-conditional` | Only equivalent-width texture channel conversions are accepted. |
43
+ | `remap` | `adjustment` | 23 | 0 | 23 | `adapter-conditional` | Only constant linear remap inputs that fold into scale/bias. |
44
+ | `invert` | `math` | 21 | 0 | 21 | `adapter-conditional` | Official `amount - in` folded only when amount is constant and affine. |
45
+ | `place2d` | `math` | 9 | 1 | 10 | `adapter-conditional` | Constant SRT inputs and supported operation order only. |
46
+ | `geompropvalue` | `geometric` | 8 | 0 | 8 | `adapter-conditional` | UV semantics only when the geometry property resolves to a supported UV set. |
47
+ | `combine3` | `channel` | 5 | 1 | 6 | `adapter-conditional` | Only same-source R/G/B channel composition with identical affine transforms. |
48
+ | `separate2` | `channel` | 4 | 0 | 4 | `adapter-conditional` | Same-source vector2 channel extraction into texture R/G. |
49
+ | `separate3` | `channel` | 4 | 0 | 4 | `adapter-conditional` | Same-source packed texture channel extraction into RGB. |
50
+ | `normalize` | `math` | 3 | 0 | 3 | `adapter-conditional` | Normal pass-through only inside a supported normal-map chain. |
51
+ | `rotate2d` | `math` | 3 | 0 | 3 | `adapter-conditional` | Constant angle folded into a UV affine matrix. |
52
+ | `separate4` | `channel` | 2 | 0 | 2 | `adapter-conditional` | Channel extraction only when the requested source channel is authored. |
53
+ | `contrast` | `adjustment` | 1 | 0 | 1 | `adapter-conditional` | Constant amount/pivot folded into texture scale/bias. |
54
+ | `ifequal` | `conditional` | 34 | 0 | 34 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
55
+ | `dielectric_bsdf` | `pbr` | 33 | 0 | 33 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
56
+ | `layer` | `pbr` | 30 | 0 | 30 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
57
+ | `oren_nayar_diffuse_bsdf` | `pbr` | 29 | 0 | 29 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
58
+ | `ifgreatereq` | `conditional` | 28 | 0 | 28 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
59
+ | `switch` | `conditional` | 28 | 0 | 28 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
60
+ | `ifgreater` | `conditional` | 23 | 0 | 23 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
61
+ | `max` | `math` | 19 | 1 | 20 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
62
+ | `clamp` | `math` | 18 | 1 | 19 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
63
+ | `position` | `geometric` | 17 | 1 | 18 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
64
+ | `modulo` | `math` | 17 | 0 | 17 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
65
+ | `surface_unlit` | `shader` | 16 | 0 | 16 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
66
+ | `conductor_bsdf` | `pbr` | 13 | 0 | 13 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
67
+ | `power` | `math` | 12 | 1 | 13 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
68
+ | `uniform_edf` | `pbr` | 13 | 0 | 13 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
69
+ | `floor` | `math` | 12 | 0 | 12 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
70
+ | `ramp4` | `procedural2d` | 12 | 0 | 12 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
71
+ | `safepower` | `math` | 12 | 0 | 12 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
72
+ | `min` | `math` | 11 | 0 | 11 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
73
+ | `fractal3d` | `procedural3d` | 8 | 1 | 9 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
74
+ | `generalized_schlick_bsdf` | `pbr` | 9 | 0 | 9 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
75
+ | `normal` | `geometric` | 9 | 0 | 9 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
76
+ | `ramptb` | `procedural2d` | 9 | 0 | 9 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
77
+ | `absval` | `math` | 8 | 0 | 8 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
78
+ | `dot` | `organization` | 8 | 0 | 8 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
79
+ | `noise2d` | `procedural2d` | 8 | 0 | 8 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
80
+ | `subsurface_bsdf` | `pbr` | 8 | 0 | 8 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
81
+ | `blur` | `convolution2d` | 7 | 0 | 7 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
82
+ | `ceil` | `math` | 7 | 0 | 7 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
83
+ | `line` | `procedural2d` | 7 | 0 | 7 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
84
+ | `ramplr` | `procedural2d` | 7 | 0 | 7 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
85
+ | `round` | `math` | 7 | 0 | 7 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
86
+ | `splitlr` | `procedural2d` | 7 | 0 | 7 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
87
+ | `splittb` | `procedural2d` | 7 | 0 | 7 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
88
+ | `sqrt` | `math` | 7 | 0 | 7 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
89
+ | `triplanarprojection` | `texture3d` | 7 | 0 | 7 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
90
+ | `fract` | `math` | 6 | 0 | 6 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
91
+ | `noise3d` | `procedural3d` | 6 | 0 | 6 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
92
+ | `sign` | `math` | 6 | 0 | 6 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
93
+ | `sin` | `math` | 5 | 1 | 6 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
94
+ | `smoothstep` | `adjustment` | 6 | 0 | 6 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
95
+ | `atan2` | `math` | 5 | 0 | 5 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
96
+ | `combine2` | `channel` | 5 | 0 | 5 | `shader-required` | Official node group `channel` is not currently folded into a material slot. |
97
+ | `combine4` | `channel` | 5 | 0 | 5 | `shader-required` | Official node group `channel` is not currently folded into a material slot. |
98
+ | `displacement` | `pbr` | 5 | 0 | 5 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
99
+ | `dotproduct` | `math` | 4 | 1 | 5 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
100
+ | `maxcomponent` | `math` | 5 | 0 | 5 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
101
+ | `mincomponent` | `math` | 5 | 0 | 5 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
102
+ | `sheen_bsdf` | `pbr` | 5 | 0 | 5 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
103
+ | `transformpoint` | `math` | 5 | 0 | 5 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
104
+ | `transformvector` | `math` | 5 | 0 | 5 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
105
+ | `acos` | `math` | 4 | 0 | 4 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
106
+ | `artistic_ior` | `pbr` | 4 | 0 | 4 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
107
+ | `asin` | `math` | 4 | 0 | 4 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
108
+ | `burn` | `compositing` | 4 | 0 | 4 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
109
+ | `cos` | `math` | 4 | 0 | 4 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
110
+ | `dodge` | `compositing` | 4 | 0 | 4 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
111
+ | `exp` | `math` | 4 | 0 | 4 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
112
+ | `fractal2d` | `procedural2d` | 4 | 0 | 4 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
113
+ | `hextiledimage` | `texture2d` | 2 | 2 | 4 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
114
+ | `ln` | `math` | 4 | 0 | 4 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
115
+ | `roughness_anisotropy` | `pbr` | 4 | 0 | 4 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
116
+ | `tan` | `math` | 4 | 0 | 4 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
117
+ | `transformnormal` | `math` | 4 | 0 | 4 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
118
+ | `cellnoise2d` | `procedural2d` | 3 | 0 | 3 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
119
+ | `creatematrix` | `math` | 3 | 0 | 3 | `shader-required` | Official node group `math` is not currently folded into a material slot. |
120
+ | `difference` | `compositing` | 3 | 0 | 3 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
121
+ | `geomcolor` | `geometric` | 3 | 0 | 3 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
122
+ | `hsvtorgb` | `adjustment` | 2 | 1 | 3 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
123
+ | `inside` | `compositing` | 3 | 0 | 3 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
124
+ | `luminance` | `adjustment` | 3 | 0 | 3 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
125
+ | `magnitude` | `math` | 3 | 0 | 3 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
126
+ | `minus` | `compositing` | 3 | 0 | 3 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
127
+ | `outside` | `compositing` | 3 | 0 | 3 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
128
+ | `plus` | `compositing` | 3 | 0 | 3 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
129
+ | `rgbtohsv` | `adjustment` | 2 | 1 | 3 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
130
+ | `screen` | `compositing` | 3 | 0 | 3 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
131
+ | `translucent_bsdf` | `pbr` | 3 | 0 | 3 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
132
+ | `worleynoise2d` | `procedural2d` | 3 | 0 | 3 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
133
+ | `worleynoise3d` | `procedural3d` | 3 | 0 | 3 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
134
+ | `burley_diffuse_bsdf` | `pbr` | 2 | 0 | 2 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
135
+ | `cellnoise3d` | `procedural3d` | 2 | 0 | 2 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
136
+ | `chiang_hair_bsdf` | `pbr` | 2 | 0 | 2 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
137
+ | `circle` | `procedural2d` | 2 | 0 | 2 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
138
+ | `determinant` | `math` | 2 | 0 | 2 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
139
+ | `disjointover` | `compositing` | 2 | 0 | 2 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
140
+ | `flake3d` | `procedural3d` | 2 | 0 | 2 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
141
+ | `gooch_shade` | `npr` | 2 | 0 | 2 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
142
+ | `heighttonormal` | `convolution2d` | 2 | 0 | 2 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
143
+ | `invertmatrix` | `math` | 2 | 0 | 2 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
144
+ | `rotate3d` | `math` | 2 | 0 | 2 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
145
+ | `time` | `application` | 2 | 0 | 2 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
146
+ | `transpose` | `math` | 2 | 0 | 2 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
147
+ | `and` | `conditional` | 1 | 0 | 1 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
148
+ | `anisotropic_vdf` | `pbr` | 1 | 0 | 1 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
149
+ | `bitangent` | `geometric` | 1 | 0 | 1 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
150
+ | `blackbody` | `pbr` | 1 | 0 | 1 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
151
+ | `chiang_hair_absorption_from_color` | `pbr` | 1 | 0 | 1 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
152
+ | `chiang_hair_roughness` | `pbr` | 1 | 0 | 1 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
153
+ | `crosshatch` | `procedural2d` | 1 | 0 | 1 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
154
+ | `crossproduct` | `math` | 1 | 0 | 1 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
155
+ | `deon_hair_absorption_from_melanin` | `pbr` | 1 | 0 | 1 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
156
+ | `facingratio` | `npr` | 1 | 0 | 1 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
157
+ | `flake2d` | `procedural2d` | 1 | 0 | 1 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
158
+ | `frame` | `application` | 1 | 0 | 1 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
159
+ | `generalized_schlick_edf` | `pbr` | 1 | 0 | 1 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
160
+ | `geompropvalueuniform` | `geometric` | 1 | 0 | 1 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
161
+ | `grid` | `procedural2d` | 1 | 0 | 1 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
162
+ | `hextilednormalmap` | `math` | 1 | 0 | 1 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
163
+ | `light` | `pbr` | 1 | 0 | 1 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
164
+ | `mask` | `compositing` | 1 | 0 | 1 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
165
+ | `matte` | `compositing` | 1 | 0 | 1 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
166
+ | `not` | `conditional` | 1 | 0 | 1 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
167
+ | `or` | `conditional` | 1 | 0 | 1 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
168
+ | `over` | `compositing` | 1 | 0 | 1 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
169
+ | `premult` | `compositing` | 1 | 0 | 1 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
170
+ | `randomcolor` | `procedural3d` | 1 | 0 | 1 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
171
+ | `roughness_dual` | `pbr` | 1 | 0 | 1 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
172
+ | `tangent` | `geometric` | 1 | 0 | 1 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
173
+ | `tiledcircles` | `procedural2d` | 1 | 0 | 1 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
174
+ | `tiledcloverleafs` | `procedural2d` | 1 | 0 | 1 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
175
+ | `tiledhexagons` | `procedural2d` | 1 | 0 | 1 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
176
+ | `unpremult` | `compositing` | 1 | 0 | 1 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
177
+ | `viewdirection` | `npr` | 1 | 0 | 1 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
178
+ | `volumematerial` | `material` | 1 | 0 | 1 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
179
+ | `xor` | `conditional` | 1 | 0 | 1 | `shader-required` | Requires graph/shader evaluation or a dedicated runtime approximation. |
180
+ | `surfacematerial` | `material` | 102 | 34 | 136 | `structural` | Material/look organization; not a shader node for Adapter evaluation. |
181
+ | `surface` | `pbr` | 90 | 0 | 90 | `structural` | Material/look organization; not a shader node for Adapter evaluation. |
182
+ | `materialassign` | `-` | 7 | 19 | 26 | `structural` | Material/look organization; not a shader node for Adapter evaluation. |
183
+ | `in` | `compositing` | 1 | 0 | 1 | `structural` | Material/look organization; not a shader node for Adapter evaluation. |
184
+ | `out` | `compositing` | 1 | 0 | 1 | `structural` | Material/look organization; not a shader node for Adapter evaluation. |
185
+
186
+ ## Standard Surface Inputs
187
+
188
+ | Shader | Input | Occurrences | Classification | Adapter boundary |
189
+ |---|---|---:|---|---|
190
+ | `open_pbr_surface` | `geometry_opacity` | 1 | `adapter-bounded` | Coverage subset. |
191
+ | `open_pbr_surface` | `geometry_thin_walled` | 1 | `adapter-bounded` | Physical thin-wall policy. |
192
+ | `open_pbr_surface` | `subsurface_color` | 1 | `adapter-gap` | OpenPBR SSS is not yet approximated. |
193
+ | `open_pbr_surface` | `subsurface_scatter_anisotropy` | 1 | `adapter-gap` | No stock phase-function parameter. |
194
+ | `open_pbr_surface` | `subsurface_weight` | 1 | `adapter-gap` | OpenPBR SSS is not yet approximated; StandardSurface bounded SSS work does not imply OpenPBR coverage. |
195
+ | `open_pbr_surface` | `transmission_weight` | 1 | `adapter-bounded` | Physical transmission subset. |
196
+ | `standard_surface` | `base_color` | 92 | `adapter-bounded` | Maps to MeshStandardMaterial color. |
197
+ | `standard_surface` | `specular_roughness` | 48 | `adapter-bounded` | Maps to roughness. |
198
+ | `standard_surface` | `base` | 36 | `adapter-bounded` | Multiplies the authored base color. |
199
+ | `standard_surface` | `metalness` | 32 | `adapter-bounded` | Maps to metalness. |
200
+ | `standard_surface` | `normal` | 32 | `adapter-bounded` | Maps supported normal-map graphs to normalMap. |
201
+ | `standard_surface` | `specular` | 24 | `adapter-bounded` | Maps to specular intensity where the physical material is required. |
202
+ | `standard_surface` | `subsurface` | 21 | `adapter-bounded` | A controlled transmission lobe approximates SSS; random-walk scattering is not equivalent. |
203
+ | `standard_surface` | `subsurface_color` | 21 | `adapter-bounded` | Tints the approximate transmission/SSS lobe. |
204
+ | `standard_surface` | `subsurface_scale` | 19 | `adapter-bounded` | Preserved as mean-free-path scale metadata. |
205
+ | `standard_surface` | `subsurface_radius` | 16 | `adapter-bounded` | Preserved as mean-free-path metadata for the bounded approximation. |
206
+ | `standard_surface` | `coat` | 15 | `adapter-bounded` | Maps to clearcoat weight. |
207
+ | `standard_surface` | `specular_color` | 15 | `adapter-bounded` | Maps to constant or texture specular color. |
208
+ | `standard_surface` | `coat_roughness` | 9 | `adapter-bounded` | Maps to clearcoat roughness. |
209
+ | `standard_surface` | `specular_IOR` | 9 | `adapter-bounded` | Maps to MeshPhysicalMaterial IOR. |
210
+ | `standard_surface` | `specular_anisotropy` | 8 | `adapter-bounded` | Constant values map to anisotropy; tangent-frame differences remain bounded. |
211
+ | `standard_surface` | `coat_color` | 6 | `adapter-bounded` | Constant values attenuate substrate and emission; a connected map is supported when it can own the base map slot. |
212
+ | `standard_surface` | `opacity` | 6 | `adapter-bounded` | Official color luminance maps to coverage; connected color textures use a bounded 8-bit luminance repack. |
213
+ | `standard_surface` | `transmission_color` | 6 | `adapter-bounded` | Used as a transmission lobe tint and volume attenuation input. |
214
+ | `standard_surface` | `specular_rotation` | 5 | `adapter-bounded` | Normalized rotation maps to anisotropyRotation times 2pi. |
215
+ | `standard_surface` | `transmission` | 5 | `adapter-bounded` | Uses the physical transmission lobe and same-mesh thickness when available. |
216
+ | `standard_surface` | `emission` | 4 | `adapter-bounded` | Maps to emissiveIntensity. |
217
+ | `standard_surface` | `emission_color` | 4 | `adapter-bounded` | Maps to constant or texture emissive color. |
218
+ | `standard_surface` | `thin_walled` | 4 | `adapter-bounded` | Controls physical transmission thickness policy. |
219
+ | `standard_surface` | `coat_IOR` | 3 | `adapter-bounded` | Scales clearcoat strength by the F0 ratio; the clearcoat IOR itself is fixed by Three.js. |
220
+ | `standard_surface` | `coat_anisotropy` | 3 | `adapter-gap` | MeshPhysicalMaterial has no separate anisotropic clearcoat distribution. |
221
+ | `standard_surface` | `diffuse_roughness` | 3 | `adapter-bounded` | Preserved as authored metadata; stock Three.js uses Lambert diffuse rather than Oren-Nayar. |
222
+ | `standard_surface` | `thin_film_IOR` | 3 | `adapter-gap` | Thin-film interference is deferred. |
223
+ | `standard_surface` | `thin_film_thickness` | 3 | `adapter-gap` | Thin-film interference is deferred. |
224
+ | `standard_surface` | `coat_normal` | 2 | `adapter-bounded` | Maps to clearcoatNormalMap. |
225
+ | `standard_surface` | `coat_rotation` | 2 | `adapter-gap` | No separate clearcoat anisotropy rotation is available. |
226
+ | `standard_surface` | `sheen` | 2 | `adapter-bounded` | Maps to sheen weight. |
227
+ | `standard_surface` | `sheen_color` | 2 | `adapter-bounded` | Maps to constant or texture sheen color. |
228
+ | `standard_surface` | `sheen_roughness` | 2 | `adapter-bounded` | Maps to sheen roughness. |
229
+ | `standard_surface` | `transmission_depth` | 2 | `adapter-bounded` | Used as a Beer-Lambert depth when the geometry contract resolves. |
230
+ | `standard_surface` | `transmission_dispersion` | 2 | `adapter-gap` | Spectral dispersion requires a renderer path beyond the Adapter. |
231
+ | `standard_surface` | `transmission_extra_roughness` | 2 | `adapter-gap` | Three.js cannot independently roughen transmission versus reflection. |
232
+ | `standard_surface` | `transmission_scatter` | 2 | `adapter-gap` | Volumetric scatter is not represented by the stock physical material. |
233
+ | `standard_surface` | `transmission_scatter_anisotropy` | 2 | `adapter-gap` | No equivalent stock Three.js phase-function parameter. |
234
+ | `standard_surface` | `coat_affect_color` | 1 | `adapter-gap` | Offline coat saturation coupling is not expressible in the stock material. |
235
+ | `standard_surface` | `coat_affect_roughness` | 1 | `adapter-gap` | Offline coat/base roughness coupling is not expressible in the stock material. |
236
+ | `standard_surface` | `subsurface_anisotropy` | 1 | `adapter-gap` | The stock Three.js physical material has no SSS phase anisotropy. |
237
+ | `standard_surface` | `tangent` | 1 | `adapter-gap` | Custom tangent frames are not yet consumed as stock material inputs. |
238
+
239
+ ## Parse Errors
240
+
241
+ These official files were skipped because their XML is not well formed
242
+ (for example, an unescaped `<UDIM>` token inside an attribute value).
243
+
244
+ - `resources/Materials/TestSuite/nprlib/toon_shade.mtlx: unbound prefix: line 19, column 2`
245
+ - `resources/Materials/TestSuite/stdlib/texture/udim.mtlx: not well-formed (invalid token): line 4, column 78`
246
+
247
+ ## Source Groups
248
+
249
+ - `resources/Materials/TestSuite`: 146 files
250
+ - `resources/Materials/Examples/StandardSurface`: 22 files
package/README.md CHANGED
@@ -251,24 +251,22 @@ URDF/XACRO/MJCF 规范即 Z-up,USD 在加载时已按 stage 声明的 up 轴
251
251
  中键缩放),`left-pan` 保留 sim-studio 的左键平移、右键旋转映射。运行期可用
252
252
  `viewer.setPreviewDragPreset('left-rotate' | 'left-pan')` 切换。
253
253
 
254
- GLB/glTF 的 Draco decoder 路径由宿主显式配置,不使用站点根路径默认值:
254
+ Viewer 包携带与当前 Three.js 版本匹配的 OpenUSD、Basis 和 Draco runtime。Vite 消费方接入
255
+ `viewerRuntimeAssets()` 插件后,开发服务器和正式构建会自动提供稳定文件名的 `basis/` 与
256
+ `draco/` 目录;OpenUSD 仍由构建器直接解析包内资产:
255
257
 
256
258
  ```ts
257
- const viewer = createViewer({
258
- viewport,
259
- canvas,
260
- assets: {
261
- dracoDecoderPath: new URL('./draco/', document.baseURI).href,
262
- ktx2TranscoderPath: new URL('./basis/', document.baseURI).href,
263
- },
259
+ import { defineConfig } from 'vite';
260
+ import { viewerRuntimeAssets } from '@nebula-spatial/viewer/vite';
261
+
262
+ export default defineConfig({
263
+ plugins: [viewerRuntimeAssets()],
264
264
  });
265
265
  ```
266
266
 
267
- USD 的 KTX2 纹理由 Three.js `KTX2Loader` 解码。Viewer 会自动使用宿主 renderer
268
- 检测可用的压缩纹理格式;默认从站点根目录 `/basis/` 读取 `basis_transcoder.js` 与
269
- `basis_transcoder.wasm`,部署在子路径或需要自行托管时通过 `assets.ktx2TranscoderPath`
270
- (或单次 `openAsset` 选项)显式覆盖。发布包在 `basis/` 目录提供与当前 Three.js 版本匹配的
271
- 两个 Transcoder 文件。
267
+ 插件会把文件输出到消费方构建目录的 `basis/` 和 `draco/`,Viewer 默认按当前页面目录加载。
268
+ `assets.ktx2TranscoderPath` 和 `assets.dracoDecoderPath` 仍可覆盖到自有静态目录或 CDN;
269
+ 不配置时无需复制文件。
272
270
 
273
271
  URDF 和 MJCF 以 MuJoCo WASM 运行,仍由 Viewer 唯一的 scene/runtime/RAF 驱动。多文件模型请传
274
272
  `{ kind: 'files', files, entry }`;`entry` 是包内 URDF 或 MJCF XML 路径。USD 会加载视觉与可可靠映射的物理数据,远端 URL 会以根 USD 文件的完整 URL 作为相对子层、纹理和其他资源的解析基址。
@@ -412,7 +410,8 @@ Sdf Layer 上映射至 MEMFS 路径,再进行 composition;支持 USDA/USDC
412
410
  和 subLayers,保留目标 Prim、layer offset 等原始语义。原文件不会被覆盖,每次加载独立目录,
413
411
  关闭或失败时清理;查询参数和不同来源的同名资源不共用缓存。材质资源恢复为宿主标识供现有
414
412
  视觉适配层消费,`OmniPBR.mdl` 等 MDL 模块不按同目录 HTTP 文件预取,现有材质映射与降级不变。
415
- JS bundle、`openusd_probe.js` 和 `.wasm` 必须同步部署;旧运行时缺少映射接口时报
413
+ 默认的包内 runtime 由消费方打包器整体更新;使用自定义 `openUsdBaseUrl` 时,JS bundle、托管目录中的
414
+ `openusd_probe.js` 和 `.wasm` 必须同步部署。旧运行时缺少映射接口时报
416
415
  `E_USD_RUNTIME_VERSION`,不会静默展示丢失引用的场景。资源拒绝、401/403、读取失败或无效 layer
417
416
  仍是加载失败,不通过空 Blob 或 catch-all 忽略。提供 resolver 的业务必须允许完整模式需要的合法
418
417
  包外引用,Viewer 不绕过白名单。本次模式策略复用现有映射接口,不需要再次构建 OpenUSD WASM。
@@ -578,9 +577,11 @@ embed-viewer 的开发与预览服务器移除。
578
577
  仓库的 `vite.config.ts` 和独立消费者验证脚本包含该配置。可通过 `assets.mujocoBaseUrl` 与
579
578
  `assets.openUsdBaseUrl` 指向自行托管的 runtime 文件目录。
580
579
 
581
- `assets.openUsdBaseUrl` 指向存放 `openusd_probe.js` 与 `openusd_probe.wasm` 的目录,默认 `/openusd/`,
582
- 即站点根绝对路径(不随页面所在子目录变化)。单线程构建是普通 ES 模块 + wasm,跨域 CDN 只需允许 CORS,不需要 Blob 模块 Worker
583
- 入口,也不需要上述跨源隔离响应头。
580
+ `assets.openUsdBaseUrl` 可指向消费方本地目录或 CDN 中存放 `openusd_probe.js` 与
581
+ `openusd_probe.wasm` 的目录。未配置时,Viewer 使用包内 runtime 资产;消费方 Vite 构建会从已安装的
582
+ `@nebula-spatial/viewer` 包中解析这两个文件,并把它们输出为带哈希的独立静态资产,不需要手工复制。
583
+ 单线程构建是普通 ES 模块 + wasm,跨域 CDN 只需允许 CORS,不需要 Blob 模块 Worker 入口,也不需要
584
+ 上述跨源隔离响应头。
584
585
 
585
586
  运行时 URL 自动使用同一个 `?v=<runtimeId>`,其中 `runtimeId` 来自随包发布的
586
587
  `openusd-runtime-manifest.json`,由 JS + WASM 内容哈希生成。因此升级任一文件都会同时绕过 ESM 和
@@ -609,9 +610,7 @@ let openUsdModulePromise: Promise<WebAssembly.Module> | null = null;
609
610
  let mujocoModulePromise: Promise<WebAssembly.Module> | null = null;
610
611
 
611
612
  function getOpenUsdModule() {
612
- return openUsdModulePromise ??= compileOpenUsdWasmModule({
613
- openUsdBaseUrl: '/openusd/',
614
- }).catch((error) => {
613
+ return openUsdModulePromise ??= compileOpenUsdWasmModule().catch((error) => {
615
614
  openUsdModulePromise = null;
616
615
  throw error;
617
616
  });
@@ -628,7 +627,6 @@ const viewer = createViewer({
628
627
  viewport,
629
628
  canvas,
630
629
  assets: {
631
- openUsdBaseUrl: '/openusd/',
632
630
  openUsdWasmModule: getOpenUsdModule(),
633
631
  mujocoWasmModule: getMujocoModule(),
634
632
  },
@@ -659,24 +657,23 @@ Node 和非 Worker 宿主继续使用共享 in-process runtime。
659
657
  异步查询接口,调用方不应再依赖同步 Embind `model.stage`。
660
658
 
661
659
  两个 runtime 文件及 `openusd-runtime-manifest.json` 随包发布,位于
662
- `@nebula-spatial/viewer/openusd/`(`exports` 已暴露 `./openusd/*`)。它们必须保持同名同目录地被站点
663
- 提供,再按需覆盖 `assets.openUsdBaseUrl`:
660
+ `@nebula-spatial/viewer/openusd/`(`exports` 已暴露 `./openusd/*`)。未配置
661
+ `assets.openUsdBaseUrl` 时,Viewer 的内部资产 URL 会交给消费方打包器处理;默认无需复制文件,也无需
662
+ 维护站点根下的 `/openusd/`。需要完全控制交付路径时,再覆盖 `assets.openUsdBaseUrl`:
664
663
 
665
664
  ```ts
666
- // 1. 拷到站点静态目录(public/openusd/):默认的 `/openusd/` 直接生效。
667
- // 2. 用打包器的静态拷贝插件从 node_modules 搬运同一目录。
668
- // 3. 上传到自有 CDN,再把 `assets.openUsdBaseUrl` 指向该目录 URL。
665
+ // 默认:包内 runtime 由消费方打包器自动输出,无需配置。
666
+ // 本地覆盖:把两个同名文件放到自选目录,再设置对应的 openUsdBaseUrl。
667
+ // CDN 覆盖:上传两个同名文件,再把 openUsdBaseUrl 指向该目录 URL。
669
668
  ```
670
669
 
671
- 本仓库自身由 `web/public/openusd/` 提供静态文件,那是构建期副本、不入版本控制;真源是
672
- `packages/viewer/openusd/`,用 `npm run sync:openusd` 刷新。`npm run dev`、
673
- `npm run dev:playground`、`npm run build`、`npm run build:url-viewer` 与
674
- `npm run build:local-viewer` 已自动前置该同步。
670
+ 本仓库自身不再维护 `web/public/openusd/`、`web/public/basis/` 或 `web/public/draco/` 副本;
671
+ 所有 runtime 真源都在 `packages/viewer/`。各 Vite 配置统一接入 `viewerRuntimeAssets()`。
675
672
 
676
673
  替换 `packages/viewer/openusd/` 的 JS 或 WASM 后,在仓库根目录执行 `npm run update:openusd`。
677
- 该命令将 JS 的 CRLF 换行统一为 LF,根据实际 JS / WASM 字节更新清单并同步站点副本;
678
- 检查结果后,将变化的运行时文件和清单一起提交。`.gitattributes` 固定 JS 的提交与检出换行,
679
- WASM 按二进制处理。普通开发和构建只校验与同步,不会自动重新生成清单。
674
+ 该命令将 JS 的 CRLF 换行统一为 LF,并根据实际 JS / WASM 字节更新清单;检查结果后,将变化的
675
+ 运行时文件和清单一起提交。`.gitattributes` 固定 JS 的提交与检出换行,WASM 按二进制处理。
676
+ 普通开发和构建只校验,不会自动重新生成清单。
680
677
 
681
678
 
682
679
  ## CAD 快速开始
@@ -910,7 +907,8 @@ open/close 生命周期被提升到 Viewer。`viewer.cad.open()` / `viewer.cad.c
910
907
  ### 2. 模型与仿真接入
911
908
 
912
909
  - 不再由 Embed/业务代码自行创建 GLTFLoader、挂载模型、管理 loading/failed overlay 或维护独立 RAF。
913
- - GLB/glTF 的 Draco decoder 必须通过 `assets.dracoDecoderPath`(或单次打开选项)由宿主显式配置。
910
+ - GLB/glTF 的 Draco decoder 默认来自 Viewer 包;Vite 消费方需在配置中加入
911
+ `viewerRuntimeAssets()`。自有目录或 CDN 仍可通过 `assets.dracoDecoderPath` 覆盖。
914
912
  - URDF/MJCF 需要 MuJoCo runtime,USD 需要 OpenUSD runtime;可用 `assets.mujocoBaseUrl` 与
915
913
  `assets.openUsdBaseUrl` 指向自托管目录。
916
914
  - 远端目录型资产传入口文件 URL,并保持相对依赖目录;`{ kind:'files' }` 只用于本地 `File | Blob`
@@ -1,6 +1,6 @@
1
1
  # USD 视觉材质适配矩阵
2
2
 
3
- > 更新日期:2026-11-11
3
+ > 更新日期:2026-11-12
4
4
  >
5
5
  > 本文描述浏览器 Viewer 当前对 USD 材质的**语义转换与视觉近似边界**,不是渲染器等价性声明。没有资产资源、没有材质连接或缺少可靠光学数据时,适配层不会生成替代内容。
6
6
 
@@ -23,17 +23,18 @@
23
23
  | KTX2 纹理资源 | 已转换 | ETC1S/UASTC 通过 Three.js `KTX2Loader` 和宿主 renderer 支持检测转码;颜色纹理为 sRGB,normal/ORM 为线性 | 压缩纹理的逐像素 CPU 重排;异步上传尚未完成的中间帧 | 原生同步构建器只保留可识别占位,视觉适配层完成异步转码后再绑定 |
24
24
  | `UsdPreviewSurface` Material interface | 已转换(受限) | `Surface.inputs:* -> Material.inputs:*` 常量、IOR、clearcoat、透明度,以及颜色/自发光/受支持标量纹理 | 无值 interface、未知上游节点、interface opacity/normal 纹理 | 只有值和上游实际落地后才消解 Loader 警告;其余保持 gap |
25
25
  | 标准 UDIM 纹理资源 | 已转换(单 tile / atlas) | `<UDIM>` 模板按包内实际四位 tile 文件解析;唯一 tile 可直接绑定,不假定 `1001`;多 tile 按标准列/行坐标合成紧凑 atlas,并保留 authored UV 通过纹理矩阵采样 | 单张 atlas 超过纹理尺寸上限、非标准 wrap 或无法由普通纹理矩阵表达的逐 tile 采样语义;超大集合仍需要 texture-array/virtual-texture 管线 | atlas 使用 clamp 并记录有界近似;无法安全合成时报告 `USD_VISUAL_TEXTURE_UDIM_MULTI_TILE_UNSUPPORTED`,不静默选择任一 tile |
26
- | `UsdPreviewSurface` / OpenPBR 颜色纹理 | 已转换(受限) | `diffuseColor`/`base_color` RGB sRGB 到 `map`,`emissiveColor`/`emission_color` 到 `emissiveMap`;单位 scale/bias、wrap、UV 变换 | 非 RGB、非 sRGB、非单位 scale/bias、多 UV set、未知 wrap | 不从槽位名称强行改色彩空间,不生成缺失像素 |
27
- | `UsdPreviewSurface` 法线纹理 | 已转换(受限) | raw RGB、标准 `[2,2,2]` / `[-1,-1,-1]` 解码、wrap、UV 变换到 `normalMap` | 非标准 scale/bias、多 UV set、未知输出/节点 | Three.js 自带 2x-1 解码;不把未解码 RGB 或猜测的切线手性当作等价 |
26
+ | `UsdPreviewSurface` / OpenPBR / MaterialX 颜色纹理 | 已转换(受限) | `diffuseColor`/`base_color` RGB sRGB 到 `map`,`emissiveColor`/`emission_color` 到 `emissiveMap`,OpenPBR `specular_color` 与 MaterialX `specular_color` 到 `specularColorMap`,OpenPBR `fuzz_color` 与 MaterialX `sheen_color` 到 `sheenColorMap`;MaterialX `coat_color` 在无基础颜色图时可占用 `map` 作为基体衰减;单位 scale/bias、wrap、UV 变换 | 非 RGB、非 sRGB、多 UV set、未知 wrap、无法进入 `MeshPhysicalMaterial` 的目标;基础色图与 coat 色图同时存在时需要双纹理乘算 | 不从槽位名称强行改色彩空间,不生成缺失像素;颜色图增益只折叠为对应材质的颜色乘数 |
27
+ | `UsdPreviewSurface` / OpenPBR / MaterialX 法线纹理 | 已转换(受限) | raw RGB、标准 `[2,2,2]` / `[-1,-1,-1]` 解码、wrap、UV 变换到 `normalMap`;OpenPBR `geometry_coat_normal` 与 MaterialX `coat_normal` 到 `clearcoatNormalMap` | 非标准 PreviewSurface scale/bias、多 UV set、未知输出/节点、自定义 tangent frame | Three.js 自带 2x-1 解码;清漆法线只写入独立 `clearcoatNormalMap`,不覆盖基础法线 |
28
28
  | `UsdPreviewSurface` 常量介质透明 | 有界近似 | `opacityMode=transparent`、常量 IOR、`MeshPhysicalMaterial.transmission`、反射保留 | Three.js 与 PreviewSurface 的透射瓣、粗糙度和多层透射不完全等价 | 不把所有 opacity 机械转换为玻璃 |
29
29
  | `UsdPreviewSurface` `presence` | 已转换(常量) | 整体覆盖率、零值消失、中间值透明 | 纹理驱动和复杂连接 | 不与玻璃 transmission 混淆 |
30
30
  | `UsdPreviewSurface` `opacityThreshold` | 已转换(受限) | 常量小于阈值裁切,大于等于阈值保留 | 复杂纹理过滤、跨渲染器阈值边缘差异 | 不将裁切误作连续半透明 |
31
31
  | `UsdPreviewSurface` 透明纹理 | 已转换(受限) | raw、UV0、明确通道、scale/bias、支持的 wrap 模式 | 非 raw 色彩空间、复杂 UV、多节点合成 | 只重排已有像素,不生成纹理 |
32
- | `UsdPreviewSurface` / OpenPBR 标量纹理 | 已转换(受限) | roughness G、metalness B、occlusion R、coat R/G、transmission R、thickness G、sheenRoughness A | 多 UV set、未知 wrap、非 raw、连接型 scale/bias、来源冲突贴图 | 按 IR 合同重排;Loader 证明失效才替换,否则保留 gap |
32
+ | `UsdPreviewSurface` / OpenPBR / MaterialX 标量纹理 | 已转换(受限) | roughness G、metalness B、occlusion R、coat R/G、transmission R、thickness G、specular intensity A、sheenRoughness A | 多 UV set、未知 wrap、非 raw、连接型 scale/bias、来源冲突贴图 | 按 IR 合同重排;OpenPBR `specular_weight` 与 MaterialX `specular` 进入 `specularIntensityMap` 的 A 通道,Loader 证明失效才替换,否则保留 gap |
33
33
  | `UsdPreviewSurface` 纯金属透明 | 有界近似 | 保留纯金属镜面响应,不转成玻璃 | 半金属、复杂 specular workflow | 金属和玻璃分支严格区分 |
34
34
  | OpenPBR 基础字段 | 已转换 / 有界近似 | 常量基础色及 `base_weight`、金属度、粗糙度、IOR、emission、coverage | 纹理化 `base_color` 的独立 `base_weight` 分层、raw affine、connected coverage、复杂纹理图 | OpenPBR 明确 authored 字段优先;PreviewSurface 仅补齐缺失字段,压制项不进入纹理回退 |
35
35
  | OpenPBR transmission / coat | 有界近似 | 常量与目标通道纹理、薄壁 `thickness=0`、独立 `transmission_color`;`depth=0` 作为 lobe tint,有限 `transmission_depth` 使用米制 Beer-Lambert;闭合实体从同一 mesh 的 backface ray 生成逐顶点光程 | 散射、色散、多层透射、跨 mesh 体积、复杂纹理驱动 depth;coat color/IOR 仍不完整 | `base_weight=0` 只关闭 base,不让 transmission tint 污染 `base_color`;无可靠同 mesh backface 光程时不生成替代厚度 |
36
- | OpenPBR fuzz / anisotropy | 有界近似 | sheen 参数、标量纹理、anisotropy 常量 | 完整 fuzz BRDF、切线手性、thin film | 未连接 fuzz color 不凭空启用 sheen |
36
+ | OpenPBR fuzz / anisotropy | 有界近似 | `fuzz_weight`、`fuzz_color` 颜色纹理、`fuzz_roughness`、anisotropy 常量 | 完整 fuzz BRDF、连接型 fuzz weight、切线手性、thin film | 未连接 fuzz color 不凭空启用 sheen;连接型 fuzz color 只有在已有可表达权重时才启用 sheen |
37
+ | MaterialX Standard Surface 常用字段 | 有界近似 | `base`/`base_color`、`diffuse_roughness` 元数据、`metalness`、`specular`/`specular_color`/`specular_roughness`/`specular_IOR`、`specular_anisotropy`/`specular_rotation`、`emission * emission_color`、颜色亮度 `opacity`、sheen、coat、`coat_color` 衰减、`coat_IOR` F0 近似、`subsurface` 受控透射近似 | Oren-Nayar 漫反射、完整 SSS、清漆独立 IOR/色散、coat 各向异性、coat/base 耦合、thin film、transmission scatter/dispersion | 有明确主干视觉意图的字段进入有界近似;无股票材质等价项保留结构化近似诊断,不宣称离线 BSDF 等价 |
37
38
  | MaterialX Standard Surface 薄壁透射 | 有界近似 | 常量 opacity 与 transmission 分离;Loader 透射结果保留 | 完整 MaterialX 节点执行、复杂组合和多层透射 | 不把 transmission_depth 当几何壁厚 |
38
39
  | MaterialX 实体透射 | 有界近似 | Standard Surface 的 transmission weight/color、IOR、`geometry_thin_walled`;闭合实体使用同一 mesh 的逐顶点 backface 光程,有限 `transmission_depth` 进入 Beer-Lambert attenuation | 体散射、色散、多层材质和跨 mesh 间隙;逐顶点光程不能表达高频薄壁变化 | 命中率低于 0.5 时报告 `USD_VISUAL_TRANSMISSION_GEOMETRY_UNAVAILABLE`;不使用 bbox、球探针或默认厚度 |
39
40
  | OmniPBR 基础颜色 | 已转换 / 有界近似 | 常量颜色、已有 diffuse texture | 复杂 UV、程序化节点 | 只使用资产已有资源 |
@@ -84,7 +85,10 @@ OpenPBR 与 MaterialX Standard Surface 在适配时生成独立的 `semantics`
84
85
 
85
86
  ```text
86
87
  base: weight, color, diffuseRoughness, metalness
87
- specular: weight, color, roughness, ior, anisotropy
88
+ specular: weight, color, roughness, ior, anisotropy, rotation
89
+ emission: weight, color
90
+ coat: weight, color, roughness, ior, anisotropy, rotation
91
+ subsurface: weight, color, radius, scale, anisotropy
88
92
  transmission: weight, color, depth, scatter, scatterAnisotropy, dispersion, thinWalled
89
93
  geometry: normal, uvSets
90
94
  ```
@@ -113,10 +117,16 @@ hitRatio, minThickness, maxThickness
113
117
 
114
118
  ### MaterialX 当前边界
115
119
 
116
- - 已覆盖 `ND_standard_surface_surfaceshader` 与 `ND_open_pbr_surface_surfaceshader` 的常见颜色、roughness、metalness、IOR、coat、transmission、thickness、AO、sheen roughness、常量透明和透明纹理。
117
- - 纹理图求值支持直接图片节点、channel extract/swizzle/convert、常量及简单四则运算,以及受支持的 UV transform/geomprop。
118
- - 支持 `ND_gltf_image_color4_* -> ND_separate4_color4 -> ND_combine3_color3` 的标签 RGB/alpha 还原,以及 `ND_gltf_normalmap_vector3_*` 的 UV pivot/scale。
119
- - 尚未执行完整 MaterialX 节点图;程序化纹理、ramp、噪声、复杂 blend/layer/条件节点、多 UV set、复杂法线和体积散射仍会保留为 gap。
120
+ | 节点类别 | 当前覆盖 | 处理原则 |
121
+ |---|---|---|
122
+ | Surface Shader | `ND_standard_surface_surfaceshader`、`ND_open_pbr_surface_surfaceshader` 的基础、specular weight/color/anisotropy/rotation、emission、coat/coat color/coat IOR、coat normal、subsurface、transmission、thickness、AO、sheen weight/color/roughness 和透明语义 | 只映射 Three.js 能明确表达的字段或文档化有界近似;Oren-Nayar、完整 SSS、coat 各向异性/耦合、高级 BSDF 和体积语义保留 gap;连接型标量权重不能由图集表达时不得默认启用 |
123
+ | Image | `ND_image_*`、`ND_tiledimage_*`、`ND_gltf_image_*`、`ND_gltf_normalmap_vector3_*` | filename、sRGB/raw、channel、wrap 和受支持的 UV 语义进入 IR;GPU mip/anisotropy 按 renderer 能力统一设置 |
124
+ | UV | `texcoord`、`geompropvalue_vector2`、`transform2d`、`place2d`、`rotate2d`、`transformmatrix_vector2M3`、`invert_vector2/2FA`、常量 `add/subtract/multiply/divide_vector2/2FA` | 可组合的 2×3 affine UV 变换折叠为目标纹理矩阵;MaterialX `matrix33` 按官方行主序、行向量约定转换;多 UV set、非常量除数或未知嵌套仍报 gap |
125
+ | Channel | `extract`、`separate2/3/4`、`combine3`、`convert`,以及兼容旧资产的 `swizzle` | 只有来源纹理、通道和变换完全一致时才重组;不猜测跨纹理通道 |
126
+ | Affine | 常量 `multiply/add/subtract/divide`、`contrast`、`invert`(官方语义 `amount - in`)、`mix`、线性 `remap`、`gamma=1 && doclamp=false` 的 `range` | 仅当参数为常量且可精确折叠为 scale/bias 时消费;非线性、clamp 或 gamma 变换不降级成近似 |
127
+ | Normal | 基础法线与 coat normal 的默认强度和 frame `normalize -> normalmap` 链、glTF normal map、标准 2x-1 解码 | 自定义 tangent/normal frame、非默认 scale、跨法线槽混合保留 gap |
128
+ | 程序化 / 合成 | noise、ramp、curve、checker、smoothstep、clamp、gamma、连接型 range/remap、纹理间 mix/blend/layer、条件节点 | 尚未执行任意节点图;线性 remap/range 仅作为常量仿射特例处理,其余必须报告节点路径和原因,不能静默返回默认色 |
129
+
120
130
  - 薄壁与实体 transmission 都是实时 Three.js transmission 近似;实体光程来自同 mesh 的 backface BVH,逐顶点插值不保证捕获所有薄壁、内部隔断或自相交细节。
121
131
  - 透射背景采用 screen-space refraction approximation,不执行二次光线、跨 mesh 体积积分、散射或色散。
122
132
 
@@ -151,6 +161,40 @@ hitRatio, minThickness, maxThickness
151
161
  - 通过修改背景、排序、颜色或强制双面制造“看起来更像”的资产特例;
152
162
  - 把 Storm、Three.js 实时结果或 Loader 成功解析当作 Cycles、RTX 或 Karma 的最终真值。
153
163
 
164
+ ## 官方 MaterialX 验证基线
165
+
166
+ 材质语义不只依赖本地自造 shader 数据,以下官方资源作为节点定义和真实图结构基线:
167
+
168
+ - `resources/Materials/TestSuite/stdlib`:官方标准库节点测试,包含 `texture`、`math/transform`、`math/matrix`、`channel`、`adjustment`、`noise` 等分组。
169
+ - `resources/Materials/Examples/StandardSurface`:官方 Standard Surface 材质示例,包含 wood、brass、copper、gold、glass、jade、plastic、velvet 等。
170
+ - `resources/Images`:官方示例使用的颜色、粗糙度、法线、渐变和 UDIM 测试纹理。
171
+
172
+ 当前模型级集成回归使用上述 `standard_surface_wood_tiled.mtlx` 和 `stdlib/math/transform.mtlx` 的等价 USD 球体场景:
173
+
174
+ - 保留 `ND_standard_surface_surfaceshader`、`ND_tiledimage_color3/float`、`ND_texcoord_vector2`、`ND_transformmatrix_vector2M3` 的实际 USD shader prim 和连接。
175
+ - 经过 OpenUSD WASM 解析、`outputs:mtlx:surface` 发现、Material IR、Adapter 和最终 Three.js `Texture.matrix` 全链路。
176
+ - 验证 4×4 平铺、sRGB/raw 色彩空间、`specular`、`coat`、`coat_roughness`,以及官方行主序 `matrix33` 到 Three.js 纹理矩阵的转换。
177
+ - 第三个球体验证 Standard Surface 常用字段:`diffuse_roughness`、`emission * emission_color`、specular anisotropy/rotation、`coat_color` 衰减、`coat_IOR` F0 近似和 `subsurface` 受控透射近似。
178
+
179
+ 需要注意:官方仓库直接提供的是 `.mtlx` 测试资产,而 Viewer 当前入口是 USD。因此该回归验证的是“官方节点图语义的 USD 等价场景”,不宣称 Viewer 可直接加载任意 `.mtlx` 文件,也不替代 MaterialXView/MaterialX Graph Editor 的官方逐像素参考图。
180
+
181
+ 官方资产覆盖审计可通过以下命令重跑:
182
+
183
+ ```powershell
184
+ $env:MATERIALX_ROOT = "D:\path\to\MaterialX"
185
+ npm run audit:materialx --workspace @nebula-spatial/viewer
186
+ ```
187
+
188
+ 生成的 [MATERIALX-LIBRARY-AUDIT.md](./MATERIALX-LIBRARY-AUDIT.md) 会列出每个节点在
189
+ TestSuite 与 StandardSurface Examples 中的出现次数、官方 nodegroup、当前分类和适配边界。
190
+ 未知节点在 `--strict` 模式下会直接失败,避免新官方节点在没有覆盖决策时被静默遗漏。
191
+ Surface 输入表同时标注 `adapter-bounded` 或 `adapter-gap`,明确区分“可近似表达”和“当前不处理”。
192
+
193
+ 2026-11-12 对 MaterialX `9176de82` 的快照结果:168 个文件、157 个标准节点,其中
194
+ 2 个 bounded Surface Shader、24 个 conditional Adapter 节点、126 个 shader-required 节点、
195
+ 5 个结构化节点,0 个未分类节点;2 个官方 XML 样例因未转义 `<UDIM>` 或命名空间前缀无法由
196
+ 标准 XML parser 读取,会在报告中显式列出而不是静默跳过。
197
+
154
198
  ## 验证范围
155
199
 
156
200
  当前回归覆盖真实 `S18-17` 的 14 个源材质、19 个有效 group 材质路径和 0 个空 material slot,以及真实
@@ -164,6 +208,9 @@ USDZ/外置 `file_texture`、标签 alpha、`OmniPBRBase`、connected `OmniSurfa
164
208
  扩展标量的源通道和目标通道重排、A 通道写入、Loader 失效贴图替换与重复适配、双 `surface` 终端优先级、OpenPBR volume gap、
165
209
  MaterialX 薄壁/实体边界、OmniPBR ORM/AO 受限路径、OmniGlass 常量参数、OmniSurfaceBase
166
210
  薄壁透射、标准 `<UDIM>` 唯一 tile/多 tile atlas、glTF PBR color/normal lookup、法线纹理和玻璃单双面策略。
211
+ 另覆盖由官方 MaterialX `standard_surface_wood_tiled` 与 `stdlib/math/transform` 派生的真实 USD 球体模型,
212
+ 包括 `ND_tiledimage_*`、`ND_transformmatrix_vector2M3`、Standard Surface 常用常量、coat 色衰减、
213
+ specular anisotropy/rotation、subsurface 透射近似和最终纹理矩阵。
167
214
  另覆盖 `core_definitions.mdl::thin_translucent_v2` 的真实输入签名、sRGB 颜色纹理、
168
215
  `file_texture.mono` 亮度粗糙度和薄壁 `transmission` 有界近似。
169
216
  核心预设集成场景另覆盖 `diffuse`、`scratched_metal_v2`、`scratched_plastic_v2`、
@@ -36,9 +36,17 @@ export interface UsdVariantSelection {
36
36
  readonly selection: string;
37
37
  }
38
38
  export interface ViewerAssetOptions {
39
+ /** Directory containing the Draco wrapper and decoder WASM. */
39
40
  readonly dracoDecoderPath?: string;
40
- /** Directory containing `basis_transcoder.js` and `basis_transcoder.wasm`. */
41
+ /**
42
+ * Directory containing `basis_transcoder.js` and `basis_transcoder.wasm`.
43
+ * Defaults to the Viewer-managed runtime directory.
44
+ */
41
45
  readonly ktx2TranscoderPath?: string;
46
+ /**
47
+ * Directory containing `openusd_probe.js` and `openusd_probe.wasm`.
48
+ * Defaults to the runtime bundled with the Viewer package.
49
+ */
42
50
  readonly openUsdBaseUrl?: string;
43
51
  /** Runtime build id appended as `?v=` to the OpenUSD JS and WASM URLs. */
44
52
  readonly openUsdRuntimeId?: string;
@@ -92,6 +100,7 @@ export interface OpenAssetOptions {
92
100
  /** Overrides `assets.ktx2TranscoderPath` for this open operation. */
93
101
  readonly ktx2TranscoderPath?: string;
94
102
  readonly mujocoBaseUrl?: string;
103
+ /** Overrides `assets.openUsdBaseUrl` for this open operation. */
95
104
  readonly openUsdBaseUrl?: string;
96
105
  /** Overrides the packaged runtime id when hosting a matching CDN build. */
97
106
  readonly openUsdRuntimeId?: string;