@forgeax/engine-gltf 0.1.23 → 0.1.25

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 (43) hide show
  1. package/README.md +56 -3
  2. package/dist/__tests__/physical-clearcoat.unit.test.d.ts +2 -0
  3. package/dist/__tests__/physical-clearcoat.unit.test.d.ts.map +1 -0
  4. package/dist/__tests__/physical-material-import.integration.test.d.ts +2 -0
  5. package/dist/__tests__/physical-material-import.integration.test.d.ts.map +1 -0
  6. package/dist/bridge.d.ts +1 -0
  7. package/dist/bridge.d.ts.map +1 -1
  8. package/dist/check-extensions.d.ts +1 -1
  9. package/dist/check-extensions.d.ts.map +1 -1
  10. package/dist/cli-gltf.mjs +181 -8
  11. package/dist/cli-gltf.mjs.map +1 -1
  12. package/dist/errors.d.ts +7 -0
  13. package/dist/errors.d.ts.map +1 -1
  14. package/dist/gltf-importer.d.ts.map +1 -1
  15. package/dist/image-color-space.d.ts +12 -0
  16. package/dist/image-color-space.d.ts.map +1 -1
  17. package/dist/importer-entry.mjs +377 -26
  18. package/dist/importer-entry.mjs.map +1 -1
  19. package/dist/index.d.ts +2 -2
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.mjs +378 -27
  22. package/dist/index.mjs.map +1 -1
  23. package/dist/material/parse-material.d.ts +66 -0
  24. package/dist/material/parse-material.d.ts.map +1 -1
  25. package/dist/node-file-entry.mjs +181 -8
  26. package/dist/node-file-entry.mjs.map +1 -1
  27. package/package.json +12 -12
  28. package/src/__tests__/bridge-material-values.unit.test.ts +107 -1
  29. package/src/__tests__/bridge-skin-stride.unit.test.ts +22 -0
  30. package/src/__tests__/gltf-error-derived-views.test-d.ts +4 -0
  31. package/src/__tests__/gltf-error-migration.test.ts +3 -3
  32. package/src/__tests__/gltf.unit.test.ts +61 -6
  33. package/src/__tests__/material-pack-refs.integration.test.ts +53 -0
  34. package/src/__tests__/parse-gltf.unit.test.ts +29 -1
  35. package/src/__tests__/physical-clearcoat.unit.test.ts +110 -0
  36. package/src/__tests__/physical-material-import.integration.test.ts +239 -0
  37. package/src/bridge.ts +260 -15
  38. package/src/check-extensions.ts +16 -10
  39. package/src/errors.ts +21 -2
  40. package/src/gltf-importer.ts +35 -0
  41. package/src/image-color-space.ts +29 -4
  42. package/src/index.ts +8 -1
  43. package/src/material/parse-material.ts +307 -0
package/dist/errors.d.ts CHANGED
@@ -38,6 +38,12 @@ export interface GltfMaterialTransmissionInvalidDetail {
38
38
  readonly reason: 'type' | 'range' | 'non-finite' | 'blend';
39
39
  readonly actual?: unknown;
40
40
  }
41
+ export interface GltfMaterialPhysicalInvalidDetail {
42
+ readonly extension: 'KHR_materials_clearcoat' | 'KHR_materials_anisotropy' | 'KHR_materials_sheen' | 'KHR_materials_iridescence' | 'KHR_materials_specular';
43
+ readonly field: string;
44
+ readonly reason: 'type' | 'range' | 'non-finite';
45
+ readonly actual?: unknown;
46
+ }
41
47
  /** `gltf-accessor-type-mismatch` payload: 4-member closed reason discriminator. */
42
48
  export interface GltfAccessorTypeMismatchDetail {
43
49
  readonly accessorIndex: number;
@@ -200,6 +206,7 @@ interface DetailFor {
200
206
  readonly 'gltf-color-accessor-malformed': GltfColorAccessorMalformedDetail;
201
207
  readonly 'gltf-mesh-bridge-invalid': GltfMeshBridgeInvalidDetail;
202
208
  readonly 'gltf-material-transmission-invalid': GltfMaterialTransmissionInvalidDetail;
209
+ readonly 'gltf-material-physical-invalid': GltfMaterialPhysicalInvalidDetail;
203
210
  }
204
211
  /**
205
212
  * Build a fully-typed GltfError. The discriminated-union return type lets
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,mBAAmB,EACnB,GAAG,EACH,KAAK,8BAA8B,EACnC,KAAK,aAAa,EAClB,EAAE,EACF,KAAK,MAAM,GACZ,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,yBAAyB,EAAE,M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AC;IACrF,QAAQ,CAAC,gCAAgC,EAAE,iCAAiC,CAAC;CAC9E;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,aAAa,EAC7C,IAAI,EAAE,CAAC,EACP,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,SAAS,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAA;CAAE,CAAC,CAO1C"}
@@ -1 +1 @@
1
- {"version":3,"file":"gltf-importer.d.ts","sourceRoot":"","sources":["../src/gltf-importer.ts"],"names":[],"mappings":"AAqCA,OAAO,KAAK,EAEV,QAAQ,EAIR,QAAQ,EAMT,MAAM,uBAAuB,CAAC;AAiB/B,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAqB,MAAM,iBAAiB,CAAC;AAwTlF,iFAAiF;AACjF,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,cAAc,EACnB,GAAG,EAAE,OAAO,EACZ,kBAAkB,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/C,kBAAkB,GAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAa,GAC1D,SAAS,QAAQ,EAAE,CAiCrB;AAonBD;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE,8BAA8B,GAAG,QAAQ,CAMrF;AAED,8EAA8E;AAC9E,eAAO,MAAM,YAAY,EAAE,QAA+B,CAAC"}
1
+ {"version":3,"file":"gltf-importer.d.ts","sourceRoot":"","sources":["../src/gltf-importer.ts"],"names":[],"mappings":"AAqCA,OAAO,KAAK,EAEV,QAAQ,EAIR,QAAQ,EAMT,MAAM,uBAAuB,CAAC;AAkB/B,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAqB,MAAM,iBAAiB,CAAC;AAwTlF,iFAAiF;AACjF,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,cAAc,EACnB,GAAG,EAAE,OAAO,EACZ,kBAAkB,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/C,kBAAkB,GAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAa,GAC1D,SAAS,QAAQ,EAAE,CA2CrB;AA4oBD;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE,8BAA8B,GAAG,QAAQ,CAMrF;AAED,8EAA8E;AAC9E,eAAO,MAAM,YAAY,EAAE,QAA+B,CAAC"}
@@ -9,6 +9,18 @@ export interface MaterialColorSpaceInput {
9
9
  readonly normalTexture?: TextureBinding;
10
10
  readonly emissiveTexture?: TextureBinding;
11
11
  readonly occlusionTexture?: TextureBinding;
12
+ readonly transmissionTexture?: TextureBinding;
13
+ readonly thicknessTexture?: TextureBinding;
14
+ readonly clearcoatTexture?: TextureBinding;
15
+ readonly clearcoatRoughnessTexture?: TextureBinding;
16
+ readonly clearcoatNormalTexture?: TextureBinding;
17
+ readonly anisotropyTexture?: TextureBinding;
18
+ readonly sheenColorTexture?: TextureBinding;
19
+ readonly sheenRoughnessTexture?: TextureBinding;
20
+ readonly iridescenceTexture?: TextureBinding;
21
+ readonly iridescenceThicknessTexture?: TextureBinding;
22
+ readonly specularTexture?: TextureBinding;
23
+ readonly specularColorTexture?: TextureBinding;
12
24
  }
13
25
  /** Slim view of a parsed `textures[]` row. */
14
26
  export interface TextureColorSpaceInput {
@@ -1 +1 @@
1
- {"version":3,"file":"image-color-space.d.ts","sourceRoot":"","sources":["../src/image-color-space.ts"],"names":[],"mappings":"AA2BA,MAAM,MAAM,2BAA2B,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE5D,KAAK,cAAc,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5D,k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,EAAE,cAAc,CAAC;IAC3C,QAAQ,CAAC,mBAAmB,CAAC,EAAE,cAAc,CAAC;IAC9C,QAAQ,CAAC,gBAAgB,CAAC,EAAE,cAAc,CAAC;IAC3C,QAAQ,CAAC,gBAAgB,CAAC,EAAE,cAAc,CAAC;IAC3C,QAAQ,CAAC,yBAAyB,CAAC,EAAE,cAAc,CAAC;IACpD,QAAQ,CAAC,sBAAsB,CAAC,EAAE,cAAc,CAAC;IACjD,QAAQ,CAAC,iBAAiB,CAAC,EAAE,cAAc,CAAC;IAC5C,QAAQ,CAAC,iBAAiB,CAAC,EAAE,cAAc,CAAC;IAC5C,QAAQ,CAAC,qBAAqB,CAAC,EAAE,cAAc,CAAC;IAChD,QAAQ,CAAC,kBAAkB,CAAC,EAAE,cAAc,CAAC;IAC7C,QAAQ,CAAC,2BAA2B,CAAC,EAAE,cAAc,CAAC;IACtD,QAAQ,CAAC,eAAe,CAAC,EAAE,cAAc,CAAC;IAC1C,QAAQ,CAAC,oBAAoB,CAAC,EAAE,cAAc,CAAC;CAChD;AAED,8CAA8C;AAC9C,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;GAIG;AACH,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,SAAS,sBAAsB,EAAE,GAAG,SAAS,CAAC;IACjE,QAAQ,CAAC,SAAS,EAAE,SAAS,uBAAuB,EAAE,CAAC;CACxD;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,4BAA4B,GAClC,GAAG,CAAC,MAAM,EAAE,2BAA2B,CAAC,CAmD1C"}
@@ -2,8 +2,8 @@ import { MeshoptDecoder } from 'meshoptimizer';
2
2
  import { deriveDefaultLodScreenCoverages } from '@forgeax/engine-import';
3
3
  import { packMeshBinV4 } from '@forgeax/engine-import/mesh-bin';
4
4
  import { AssetGuid } from '@forgeax/engine-pack/guid';
5
- import { ImportError, toShared, err, ok, reconcileMeshMaterialSlotTopology, IMPORT_ERROR_HINTS, resolveMeshMaterialSlotDefaultGuid, createMaterialError } from '@forgeax/engine-types';
6
- import { packInterleavedVertexAttributes } from '@forgeax/engine-geometry';
5
+ import { ImportError, toShared, err, ok, reconcileMeshMaterialSlotTopology, IMPORT_ERROR_HINTS, resolveMeshMaterialSlotDefaultGuid, createMaterialError, standardMaterialParameters, STANDARD_MATERIAL_PARAM_SCHEMA, STANDARD_PHYSICAL_PARAMETER_NAMES, STANDARD_TRANSMISSION_PARAMETER_NAMES, STANDARD_LAYER_PARAMETER_GROUPS } from '@forgeax/engine-types';
6
+ import { computeTangentVec4, packInterleavedVertexAttributes } from '@forgeax/engine-geometry';
7
7
  import { box3, mat4, vec3, quat } from '@forgeax/engine-math';
8
8
  import { deriveAnimationTargetId } from '@forgeax/engine-animation/target-id';
9
9
 
@@ -24,8 +24,8 @@ var gltfErrorPolicy = {
24
24
  hint: "rebuild .gltf with valid bufferViews; check accessor index; ensure accessor.byteOffset + EFFECTIVE_STRIDE * (count - 1) + element_size <= bufferView.byteLength"
25
25
  },
26
26
  "gltf-extension-unsupported": {
27
- expected: "extension listed in v1 allowlist (see EXTENSION_ALLOWLIST in @forgeax/engine-gltf)",
28
- hint: "see feat-future-gltf-extensions-allowlist; remove this extension or wait for the allowlist to expand"
27
+ expected: "extension listed in the supported allowlist (see EXTENSION_ALLOWLIST in @forgeax/engine-gltf)",
28
+ hint: "remove the unsupported required extension or use a supported glTF extension; extensionsUsed-only entries remain diagnostic"
29
29
  },
30
30
  "gltf-lod-invalid": {
31
31
  expected: "MSFT_lod ids to reference unique existing node indices with valid coverage",
@@ -35,6 +35,10 @@ var gltfErrorPolicy = {
35
35
  expected: "KHR transmission, IOR, and volume values are finite and within their glTF ranges",
36
36
  hint: "repair the named glTF material extension value and re-import the source"
37
37
  },
38
+ "gltf-material-physical-invalid": {
39
+ expected: "KHR clearcoat, anisotropy, sheen, iridescence, and specular values are finite and within their glTF ranges",
40
+ hint: "repair the named physical material extension value and re-import the source"
41
+ },
38
42
  "gltf-accessor-type-mismatch": {
39
43
  expected: "dense fixed-stride accessor with supported componentType",
40
44
  hint: "sparse: see feat-future-gltf-sparse-accessor; morph: see feat-future-gltf-morph; interleaved: see feat-future-gltf-mesh-multi-section"
@@ -218,6 +222,16 @@ function meshIrToMeshAsset(prims, materials = {}) {
218
222
  const materialSlot = slotFor(mesh.materialIndex);
219
223
  const primVertexCount = mesh.positions.length / 3;
220
224
  const primIndexCount = mesh.indices === void 0 ? 0 : mesh.indices.length;
225
+ let generatedTangents;
226
+ if (mesh.tangents === void 0 && mesh.normals !== void 0 && mesh.texcoord0 !== void 0) {
227
+ const generated = computeTangentVec4(
228
+ mesh.positions,
229
+ mesh.normals,
230
+ mesh.texcoord0,
231
+ mesh.indices
232
+ );
233
+ if (generated.ok) generatedTangents = generated.value;
234
+ }
221
235
  if (mesh.colors0 !== void 0 && mesh.colors0.length !== primVertexCount * 4) {
222
236
  return err(
223
237
  gltfErr("gltf-mesh-bridge-invalid", {
@@ -249,12 +263,13 @@ function meshIrToMeshAsset(prims, materials = {}) {
249
263
  uvsCat[(vertexCursor + i) * 2 + 0] = mesh.texcoord0[t + 0];
250
264
  uvsCat[(vertexCursor + i) * 2 + 1] = mesh.texcoord0[t + 1];
251
265
  }
252
- if (mesh.tangents !== void 0) {
266
+ const sourceTangents = mesh.tangents ?? generatedTangents;
267
+ if (sourceTangents !== void 0) {
253
268
  const g = i * 4;
254
- tangentsCat[(vertexCursor + i) * 4 + 0] = mesh.tangents[g + 0];
255
- tangentsCat[(vertexCursor + i) * 4 + 1] = mesh.tangents[g + 1];
256
- tangentsCat[(vertexCursor + i) * 4 + 2] = mesh.tangents[g + 2];
257
- tangentsCat[(vertexCursor + i) * 4 + 3] = mesh.tangents[g + 3];
269
+ tangentsCat[(vertexCursor + i) * 4 + 0] = sourceTangents[g + 0];
270
+ tangentsCat[(vertexCursor + i) * 4 + 1] = sourceTangents[g + 1];
271
+ tangentsCat[(vertexCursor + i) * 4 + 2] = sourceTangents[g + 2];
272
+ tangentsCat[(vertexCursor + i) * 4 + 3] = sourceTangents[g + 3];
258
273
  } else {
259
274
  tangentsCat[(vertexCursor + i) * 4 + 0] = 1;
260
275
  tangentsCat[(vertexCursor + i) * 4 + 3] = 1;
@@ -589,6 +604,12 @@ function textureValue(info, slot, ctx) {
589
604
  return { ...value, normalScale: normal.scale };
590
605
  }
591
606
  }
607
+ if (slot === "clearcoatNormalTexture") {
608
+ const normal = info;
609
+ if (typeof normal === "object" && normal?.scale !== void 0) {
610
+ return { ...value, normalScale: normal.scale };
611
+ }
612
+ }
592
613
  if (slot === "occlusionTexture") {
593
614
  const occlusion = info;
594
615
  if (typeof occlusion === "object" && occlusion?.strength !== void 0) {
@@ -597,6 +618,47 @@ function textureValue(info, slot, ctx) {
597
618
  }
598
619
  return value;
599
620
  }
621
+ function standardRootParameterNames(mat) {
622
+ const names = new Set(
623
+ STANDARD_MATERIAL_PARAM_SCHEMA.filter(
624
+ (entry) => !STANDARD_PHYSICAL_PARAMETER_NAMES.has(entry.name) && !STANDARD_TRANSMISSION_PARAMETER_NAMES.has(entry.name)
625
+ ).map((entry) => entry.name)
626
+ );
627
+ names.add("ior");
628
+ const addLayer = (layer) => {
629
+ for (const name of STANDARD_LAYER_PARAMETER_GROUPS[layer]) names.add(name);
630
+ };
631
+ const addTexture = (name, info) => {
632
+ if (info !== void 0) names.add(name);
633
+ };
634
+ const clearcoat = mat.clearcoatFactor !== void 0 || mat.clearcoatRoughnessFactor !== void 0 || mat.clearcoatNormalTexture !== void 0 || mat.clearcoatTexture !== void 0 || mat.clearcoatRoughnessTexture !== void 0;
635
+ const anisotropy = mat.anisotropyStrength !== void 0 || mat.anisotropyRotation !== void 0 || mat.anisotropyTexture !== void 0;
636
+ const sheen = mat.sheenColorFactor !== void 0 || mat.sheenRoughnessFactor !== void 0 || mat.sheenColorTexture !== void 0 || mat.sheenRoughnessTexture !== void 0;
637
+ const iridescence = mat.iridescenceFactor !== void 0 || mat.iridescenceIor !== void 0 || mat.iridescenceThicknessMinimum !== void 0 || mat.iridescenceThicknessMaximum !== void 0 || mat.iridescenceTexture !== void 0 || mat.iridescenceThicknessTexture !== void 0;
638
+ if (clearcoat) addLayer("clearcoat");
639
+ if (anisotropy) addLayer("anisotropy");
640
+ if (sheen) addLayer("sheen");
641
+ if (iridescence) addLayer("iridescence");
642
+ if (clearcoat && mat.clearcoatNormalTexture !== void 0) names.add("clearcoatNormalScale");
643
+ addTexture("clearcoatTexture", mat.clearcoatTexture);
644
+ addTexture("clearcoatRoughnessTexture", mat.clearcoatRoughnessTexture);
645
+ addTexture("clearcoatNormalTexture", mat.clearcoatNormalTexture);
646
+ addTexture("anisotropyTexture", mat.anisotropyTexture);
647
+ addTexture("sheenColorTexture", mat.sheenColorTexture);
648
+ addTexture("sheenRoughnessTexture", mat.sheenRoughnessTexture);
649
+ addTexture("iridescenceTexture", mat.iridescenceTexture);
650
+ addTexture("iridescenceThicknessTexture", mat.iridescenceThicknessTexture);
651
+ addTexture("specularTexture", mat.specularTexture);
652
+ addTexture("specularColorTexture", mat.specularColorTexture);
653
+ const transmission = mat.transmissionFactor !== void 0 || mat.transmissionTexture !== void 0 || mat.ior !== void 0 || mat.thicknessFactor !== void 0 || mat.thicknessTexture !== void 0 || mat.attenuationColor !== void 0 || mat.attenuationDistance !== void 0;
654
+ if (transmission) {
655
+ for (const name of STANDARD_TRANSMISSION_PARAMETER_NAMES) names.add(name);
656
+ }
657
+ return {
658
+ names,
659
+ extended: clearcoat || anisotropy || sheen || iridescence || transmission || mat.specularTexture !== void 0 || mat.specularColorTexture !== void 0
660
+ };
661
+ }
600
662
  function validateMaterialUvSets(mat, primitive, availableSets) {
601
663
  const available = new Set(availableSets);
602
664
  const slots = [
@@ -606,7 +668,17 @@ function validateMaterialUvSets(mat, primitive, availableSets) {
606
668
  ["occlusionTexture", mat.occlusionTexture],
607
669
  ["emissiveTexture", mat.emissiveTexture],
608
670
  ["transmissionTexture", mat.transmissionTexture],
609
- ["thicknessTexture", mat.thicknessTexture]
671
+ ["thicknessTexture", mat.thicknessTexture],
672
+ ["clearcoatTexture", mat.clearcoatTexture],
673
+ ["clearcoatRoughnessTexture", mat.clearcoatRoughnessTexture],
674
+ ["clearcoatNormalTexture", mat.clearcoatNormalTexture],
675
+ ["anisotropyTexture", mat.anisotropyTexture],
676
+ ["sheenColorTexture", mat.sheenColorTexture],
677
+ ["sheenRoughnessTexture", mat.sheenRoughnessTexture],
678
+ ["iridescenceTexture", mat.iridescenceTexture],
679
+ ["iridescenceThicknessTexture", mat.iridescenceThicknessTexture],
680
+ ["specularTexture", mat.specularTexture],
681
+ ["specularColorTexture", mat.specularColorTexture]
610
682
  ];
611
683
  for (const [slot, rawBinding] of slots) {
612
684
  const binding = textureInfo(rawBinding);
@@ -626,7 +698,44 @@ function validateMaterialUvSets(mat, primitive, availableSets) {
626
698
  }
627
699
  return ok(void 0);
628
700
  }
701
+ function validateMaterialTangentInputs(mat, mesh, layer = "clearcoat") {
702
+ const anisotropyDeclared = mat.anisotropyStrength !== void 0 || mat.anisotropyRotation !== void 0 || mat.anisotropyTexture !== void 0;
703
+ const tangentSlot = anisotropyDeclared ? { layer: "anisotropy", info: mat.anisotropyTexture } : mat.clearcoatNormalTexture !== void 0 ? { layer: "clearcoat", info: mat.clearcoatNormalTexture } : void 0;
704
+ if (tangentSlot === void 0) return ok(void 0);
705
+ const selected = textureInfo(tangentSlot.info);
706
+ const uvSet = selected?.texCoord ?? 0;
707
+ const uv = mesh[`texcoord${uvSet === 0 ? "0" : uvSet}`];
708
+ const attributes = ["NORMAL", `TEXCOORD_${uvSet}`, "TANGENT"];
709
+ const fail = (reason) => err(
710
+ createMaterialError("material-tangent-required", {
711
+ code: "material-tangent-required",
712
+ material: mat.name ?? "<unnamed>",
713
+ mesh: mesh.name ?? "<unnamed>",
714
+ layer: tangentSlot.layer ?? layer,
715
+ uv: `TEXCOORD_${uvSet}`,
716
+ attributes,
717
+ reason
718
+ })
719
+ );
720
+ if (mesh.tangents !== void 0) {
721
+ if (mesh.tangents.length !== mesh.positions.length / 3 * 4 || mesh.tangents.some((value) => !Number.isFinite(value))) {
722
+ return fail("imported TANGENT must be finite vec4 per vertex");
723
+ }
724
+ return ok(void 0);
725
+ }
726
+ if (mesh.normals === void 0) return fail("NORMAL is required to generate tangent");
727
+ if (!(uv instanceof Float32Array))
728
+ return fail("the selected UV set is required to generate tangent");
729
+ const generated = computeTangentVec4(mesh.positions, mesh.normals, uv, mesh.indices);
730
+ if (!generated.ok) {
731
+ const detail = generated.error.detail;
732
+ const reason = detail !== void 0 && "reason" in detail ? String(detail.reason) : "tangent producer rejected topology";
733
+ return fail(reason);
734
+ }
735
+ return ok(void 0);
736
+ }
629
737
  function toMaterialAsset(mat, ctx) {
738
+ const rootContract = standardRootParameterNames(mat);
630
739
  const values = {
631
740
  baseColor: mat.baseColorFactor,
632
741
  metallic: mat.metallicFactor,
@@ -643,7 +752,17 @@ function toMaterialAsset(mat, ctx) {
643
752
  ["occlusionTexture", mat.occlusionTexture],
644
753
  ["emissiveTexture", mat.emissiveTexture],
645
754
  ["transmissionTexture", mat.transmissionTexture],
646
- ["thicknessTexture", mat.thicknessTexture]
755
+ ["thicknessTexture", mat.thicknessTexture],
756
+ ["clearcoatTexture", mat.clearcoatTexture],
757
+ ["clearcoatRoughnessTexture", mat.clearcoatRoughnessTexture],
758
+ ["clearcoatNormalTexture", mat.clearcoatNormalTexture],
759
+ ["anisotropyTexture", mat.anisotropyTexture],
760
+ ["sheenColorTexture", mat.sheenColorTexture],
761
+ ["sheenRoughnessTexture", mat.sheenRoughnessTexture],
762
+ ["iridescenceTexture", mat.iridescenceTexture],
763
+ ["iridescenceThicknessTexture", mat.iridescenceThicknessTexture],
764
+ ["specularTexture", mat.specularTexture],
765
+ ["specularColorTexture", mat.specularColorTexture]
647
766
  ];
648
767
  for (const [slot, info] of textureSlots) {
649
768
  const value = textureValue(info, slot, ctx);
@@ -652,11 +771,35 @@ function toMaterialAsset(mat, ctx) {
652
771
  if (mat.occlusionTexture !== void 0 && values.occlusionStrength === void 0) {
653
772
  values.occlusionStrength = 1;
654
773
  }
655
- if (mat.transmissionFactor !== void 0) values.transmission = mat.transmissionFactor;
656
- if (mat.ior !== void 0) values.ior = mat.ior;
657
- if (mat.thicknessFactor !== void 0) values.thickness = mat.thicknessFactor;
658
- if (mat.attenuationColor !== void 0) values.attenuationColor = mat.attenuationColor;
659
- if (mat.attenuationDistance !== void 0) values.attenuationDistance = mat.attenuationDistance;
774
+ if (rootContract.extended && rootContract.names.has("transmission")) {
775
+ values.transmission = mat.transmissionFactor ?? 0;
776
+ values.ior = mat.ior ?? 1.5;
777
+ values.thickness = mat.thicknessFactor ?? 0;
778
+ values.attenuationColor = mat.attenuationColor ?? [1, 1, 1];
779
+ if (mat.attenuationDistance !== void 0) values.attenuationDistance = mat.attenuationDistance;
780
+ }
781
+ if (rootContract.names.has("clearcoat")) {
782
+ values.clearcoat = mat.clearcoatFactor ?? 0;
783
+ values.clearcoatRoughness = mat.clearcoatRoughnessFactor ?? 0;
784
+ }
785
+ const clearcoatNormal = textureInfo(mat.clearcoatNormalTexture);
786
+ if (clearcoatNormal?.scale !== void 0) values.clearcoatNormalScale = clearcoatNormal.scale;
787
+ if (rootContract.names.has("anisotropyStrength")) {
788
+ values.anisotropyStrength = mat.anisotropyStrength ?? 0;
789
+ values.anisotropyRotation = mat.anisotropyRotation ?? 0;
790
+ }
791
+ if (rootContract.names.has("sheenColor")) {
792
+ values.sheenColor = mat.sheenColorFactor ?? [0, 0, 0];
793
+ values.sheenRoughness = mat.sheenRoughnessFactor ?? 0;
794
+ }
795
+ if (rootContract.names.has("iridescence")) {
796
+ values.iridescence = mat.iridescenceFactor ?? 0;
797
+ values.iridescenceIor = mat.iridescenceIor ?? 1.3;
798
+ values.iridescenceThicknessMinimum = mat.iridescenceThicknessMinimum ?? 100;
799
+ values.iridescenceThicknessMaximum = mat.iridescenceThicknessMaximum ?? 400;
800
+ }
801
+ if (mat.specularFactor !== void 0) values.specular = mat.specularFactor;
802
+ if (mat.specularColorFactor !== void 0) values.specularColor = mat.specularColorFactor;
660
803
  const module = ctx?.skinned === true ? "forgeax::pbr-skin" : "forgeax::default-standard-pbr";
661
804
  const isMask = mat.alphaMode === "MASK";
662
805
  const alphaCutoff = isMask ? mat.alphaCutoff ?? 0.5 : void 0;
@@ -686,11 +829,14 @@ function toMaterialAsset(mat, ctx) {
686
829
  } : {}
687
830
  }
688
831
  };
832
+ const child = !rootContract.extended && ctx?.standardRootGuid !== void 0;
689
833
  return {
690
834
  kind: "material",
691
- colorSpace: "linear",
692
- ...ctx?.standardRootGuid === void 0 ? {} : { parent: ctx.standardRootGuid },
693
- passes: [pass],
835
+ ...child ? { parent: ctx.standardRootGuid } : {
836
+ colorSpace: "linear",
837
+ passes: [pass],
838
+ parameters: standardMaterialParameters(rootContract.names)
839
+ },
694
840
  values
695
841
  };
696
842
  }
@@ -1109,9 +1255,21 @@ function deriveTextureColorSpace(input) {
1109
1255
  for (const mat of input.materials) {
1110
1256
  record(imageOfTexture(mat.baseColorTexture), "srgb");
1111
1257
  record(imageOfTexture(mat.emissiveTexture), "srgb");
1258
+ record(imageOfTexture(mat.sheenColorTexture), "srgb");
1259
+ record(imageOfTexture(mat.specularColorTexture), "srgb");
1112
1260
  record(imageOfTexture(mat.metallicRoughnessTexture), "linear");
1113
1261
  record(imageOfTexture(mat.normalTexture), "linear");
1114
1262
  record(imageOfTexture(mat.occlusionTexture), "linear");
1263
+ record(imageOfTexture(mat.transmissionTexture), "linear");
1264
+ record(imageOfTexture(mat.thicknessTexture), "linear");
1265
+ record(imageOfTexture(mat.clearcoatTexture), "linear");
1266
+ record(imageOfTexture(mat.clearcoatRoughnessTexture), "linear");
1267
+ record(imageOfTexture(mat.clearcoatNormalTexture), "linear");
1268
+ record(imageOfTexture(mat.anisotropyTexture), "linear");
1269
+ record(imageOfTexture(mat.sheenRoughnessTexture), "linear");
1270
+ record(imageOfTexture(mat.iridescenceTexture), "linear");
1271
+ record(imageOfTexture(mat.iridescenceThicknessTexture), "linear");
1272
+ record(imageOfTexture(mat.specularTexture), "linear");
1115
1273
  }
1116
1274
  for (let i = 0; i < input.imageCount; i++) {
1117
1275
  if (!result.has(i)) {
@@ -1400,16 +1558,21 @@ function decodeColorAccessor(input, flags = {}) {
1400
1558
  var EXTENSION_ALLOWLIST = [
1401
1559
  "EXT_mesh_gpu_instancing",
1402
1560
  "EXT_meshopt_compression",
1403
- "MSFT_lod",
1404
- "MSFT_screencoverage"
1405
- ];
1406
- var SUPPORTED_EXTENSIONS = [
1407
- ...EXTENSION_ALLOWLIST,
1408
1561
  "KHR_lights_punctual",
1409
1562
  "KHR_texture_transform",
1410
1563
  "KHR_materials_transmission",
1411
1564
  "KHR_materials_ior",
1412
- "KHR_materials_volume"
1565
+ "KHR_materials_volume",
1566
+ "KHR_materials_clearcoat",
1567
+ "KHR_materials_anisotropy",
1568
+ "KHR_materials_sheen",
1569
+ "KHR_materials_iridescence",
1570
+ "KHR_materials_specular"
1571
+ ];
1572
+ var SUPPORTED_EXTENSIONS = [
1573
+ ...EXTENSION_ALLOWLIST,
1574
+ "MSFT_lod",
1575
+ "MSFT_screencoverage"
1413
1576
  ];
1414
1577
  function checkExtensions(json) {
1415
1578
  const required = json.extensionsRequired ?? [];
@@ -1552,6 +1715,11 @@ function parseMaterial(matJson, textures) {
1552
1715
  const transmission = matJson.extensions?.KHR_materials_transmission;
1553
1716
  const ior = matJson.extensions?.KHR_materials_ior;
1554
1717
  const volume = matJson.extensions?.KHR_materials_volume;
1718
+ const clearcoat = matJson.extensions?.KHR_materials_clearcoat;
1719
+ const anisotropy = matJson.extensions?.KHR_materials_anisotropy;
1720
+ const sheen = matJson.extensions?.KHR_materials_sheen;
1721
+ const iridescence = matJson.extensions?.KHR_materials_iridescence;
1722
+ const specular = matJson.extensions?.KHR_materials_specular;
1555
1723
  const attenuationColor = tuple3(volume?.attenuationColor);
1556
1724
  const invalid = (extension, field, reason, actual) => err(
1557
1725
  gltfErr("gltf-material-transmission-invalid", {
@@ -1561,6 +1729,14 @@ function parseMaterial(matJson, textures) {
1561
1729
  ...actual === void 0 ? {} : { actual }
1562
1730
  })
1563
1731
  );
1732
+ const physicalInvalid = (extension, field, reason, actual) => err(
1733
+ gltfErr("gltf-material-physical-invalid", {
1734
+ extension,
1735
+ field,
1736
+ reason,
1737
+ ...actual === void 0 ? {} : { actual }
1738
+ })
1739
+ );
1564
1740
  if (transmission?.transmissionFactor !== void 0 && (typeof transmission.transmissionFactor !== "number" || !Number.isFinite(transmission.transmissionFactor))) {
1565
1741
  return invalid(
1566
1742
  "KHR_materials_transmission",
@@ -1611,6 +1787,98 @@ function parseMaterial(matJson, textures) {
1611
1787
  if (alphaMode === "BLEND" && (transmission?.transmissionFactor ?? 0) > 0) {
1612
1788
  return invalid("KHR_materials_transmission", "alphaMode", "blend", alphaMode);
1613
1789
  }
1790
+ if (clearcoat?.clearcoatFactor !== void 0 && (typeof clearcoat.clearcoatFactor !== "number" || !Number.isFinite(clearcoat.clearcoatFactor))) {
1791
+ return physicalInvalid(
1792
+ "KHR_materials_clearcoat",
1793
+ "clearcoatFactor",
1794
+ "non-finite",
1795
+ clearcoat.clearcoatFactor
1796
+ );
1797
+ }
1798
+ if (clearcoat?.clearcoatFactor !== void 0 && (clearcoat.clearcoatFactor < 0 || clearcoat.clearcoatFactor > 1)) {
1799
+ return physicalInvalid(
1800
+ "KHR_materials_clearcoat",
1801
+ "clearcoatFactor",
1802
+ "range",
1803
+ clearcoat.clearcoatFactor
1804
+ );
1805
+ }
1806
+ if (clearcoat?.clearcoatRoughnessFactor !== void 0 && (typeof clearcoat.clearcoatRoughnessFactor !== "number" || !Number.isFinite(clearcoat.clearcoatRoughnessFactor))) {
1807
+ return physicalInvalid(
1808
+ "KHR_materials_clearcoat",
1809
+ "clearcoatRoughnessFactor",
1810
+ "non-finite",
1811
+ clearcoat.clearcoatRoughnessFactor
1812
+ );
1813
+ }
1814
+ if (clearcoat?.clearcoatRoughnessFactor !== void 0 && (clearcoat.clearcoatRoughnessFactor < 0 || clearcoat.clearcoatRoughnessFactor > 1)) {
1815
+ return physicalInvalid(
1816
+ "KHR_materials_clearcoat",
1817
+ "clearcoatRoughnessFactor",
1818
+ "range",
1819
+ clearcoat.clearcoatRoughnessFactor
1820
+ );
1821
+ }
1822
+ if (clearcoat?.clearcoatNormalTexture?.scale !== void 0 && (typeof clearcoat.clearcoatNormalTexture.scale !== "number" || !Number.isFinite(clearcoat.clearcoatNormalTexture.scale) || clearcoat.clearcoatNormalTexture.scale < 0)) {
1823
+ return physicalInvalid(
1824
+ "KHR_materials_clearcoat",
1825
+ "clearcoatNormalTexture.scale",
1826
+ "range",
1827
+ clearcoat.clearcoatNormalTexture.scale
1828
+ );
1829
+ }
1830
+ const validateUnit = (extension, field, value) => {
1831
+ if (value === void 0) return void 0;
1832
+ if (typeof value !== "number" || !Number.isFinite(value))
1833
+ return physicalInvalid(extension, field, "non-finite", value);
1834
+ if (value < 0 || value > 1) return physicalInvalid(extension, field, "range", value);
1835
+ return void 0;
1836
+ };
1837
+ const validateFinite = (extension, field, value, minimum) => {
1838
+ if (value === void 0) return void 0;
1839
+ if (typeof value !== "number" || !Number.isFinite(value))
1840
+ return physicalInvalid(extension, field, "non-finite", value);
1841
+ if (minimum !== void 0 && value < minimum)
1842
+ return physicalInvalid(extension, field, "range", value);
1843
+ return void 0;
1844
+ };
1845
+ const validateColor = (extension, field, value) => {
1846
+ if (value === void 0) return void 0;
1847
+ if (value.length < 3 || value.slice(0, 3).some((channel) => typeof channel !== "number" || !Number.isFinite(channel))) {
1848
+ return physicalInvalid(extension, field, "type", value);
1849
+ }
1850
+ if (value.slice(0, 3).some((channel) => channel < 0 || channel > 1)) {
1851
+ return physicalInvalid(extension, field, "range", value);
1852
+ }
1853
+ return void 0;
1854
+ };
1855
+ const physicalChecks = [
1856
+ validateUnit("KHR_materials_anisotropy", "anisotropyStrength", anisotropy?.anisotropyStrength),
1857
+ validateFinite(
1858
+ "KHR_materials_anisotropy",
1859
+ "anisotropyRotation",
1860
+ anisotropy?.anisotropyRotation
1861
+ ),
1862
+ validateUnit("KHR_materials_sheen", "sheenRoughnessFactor", sheen?.sheenRoughnessFactor),
1863
+ validateColor("KHR_materials_sheen", "sheenColorFactor", sheen?.sheenColorFactor),
1864
+ validateUnit("KHR_materials_iridescence", "iridescenceFactor", iridescence?.iridescenceFactor),
1865
+ validateFinite("KHR_materials_iridescence", "iridescenceIor", iridescence?.iridescenceIor, 1),
1866
+ validateFinite(
1867
+ "KHR_materials_iridescence",
1868
+ "iridescenceThicknessMinimum",
1869
+ iridescence?.iridescenceThicknessMinimum,
1870
+ 0
1871
+ ),
1872
+ validateFinite(
1873
+ "KHR_materials_iridescence",
1874
+ "iridescenceThicknessMaximum",
1875
+ iridescence?.iridescenceThicknessMaximum,
1876
+ 0
1877
+ ),
1878
+ validateUnit("KHR_materials_specular", "specularFactor", specular?.specularFactor),
1879
+ validateColor("KHR_materials_specular", "specularColorFactor", specular?.specularColorFactor)
1880
+ ];
1881
+ for (const check of physicalChecks) if (check !== void 0) return check;
1614
1882
  return ok({
1615
1883
  ...matJson.name === void 0 ? {} : { name: matJson.name },
1616
1884
  baseColorFactor: baseColor4,
@@ -1647,6 +1915,65 @@ function parseMaterial(matJson, textures) {
1647
1915
  ...attenuationColor === void 0 ? {} : { attenuationColor },
1648
1916
  ...finiteOrUndefined(volume.attenuationDistance) === void 0 ? {} : { attenuationDistance: volume.attenuationDistance }
1649
1917
  },
1918
+ ...clearcoat === void 0 ? {} : {
1919
+ clearcoatFactor: clearcoat.clearcoatFactor ?? 0,
1920
+ clearcoatChannel: 0,
1921
+ clearcoatRoughnessFactor: clearcoat.clearcoatRoughnessFactor ?? 0,
1922
+ clearcoatRoughnessChannel: 1,
1923
+ clearcoatNormalChannel: [0, 1],
1924
+ ...clearcoat.clearcoatTexture === void 0 ? {} : { clearcoatTexture: parseTextureInfo(clearcoat.clearcoatTexture, textures) },
1925
+ ...clearcoat.clearcoatRoughnessTexture === void 0 ? {} : {
1926
+ clearcoatRoughnessTexture: parseTextureInfo(
1927
+ clearcoat.clearcoatRoughnessTexture,
1928
+ textures
1929
+ )
1930
+ },
1931
+ ...clearcoat.clearcoatNormalTexture === void 0 ? {} : {
1932
+ clearcoatNormalTexture: {
1933
+ ...parseTextureInfo(clearcoat.clearcoatNormalTexture, textures),
1934
+ ...clearcoat.clearcoatNormalTexture.scale === void 0 ? {} : { scale: clearcoat.clearcoatNormalTexture.scale }
1935
+ }
1936
+ }
1937
+ },
1938
+ ...anisotropy === void 0 ? {} : {
1939
+ anisotropyStrength: anisotropy.anisotropyStrength ?? 0,
1940
+ anisotropyRotation: anisotropy.anisotropyRotation ?? 0,
1941
+ anisotropyChannel: [0, 1, 2],
1942
+ ...anisotropy.anisotropyTexture === void 0 ? {} : { anisotropyTexture: parseTextureInfo(anisotropy.anisotropyTexture, textures) }
1943
+ },
1944
+ ...sheen === void 0 ? {} : {
1945
+ sheenColorFactor: tuple3(sheen.sheenColorFactor) ?? [0, 0, 0],
1946
+ sheenColorChannel: [0, 1, 2],
1947
+ sheenRoughnessFactor: sheen.sheenRoughnessFactor ?? 0,
1948
+ sheenRoughnessChannel: 3,
1949
+ ...sheen.sheenColorTexture === void 0 ? {} : { sheenColorTexture: parseTextureInfo(sheen.sheenColorTexture, textures) },
1950
+ ...sheen.sheenRoughnessTexture === void 0 ? {} : { sheenRoughnessTexture: parseTextureInfo(sheen.sheenRoughnessTexture, textures) }
1951
+ },
1952
+ ...iridescence === void 0 ? {} : {
1953
+ iridescenceFactor: iridescence.iridescenceFactor ?? 0,
1954
+ iridescenceIor: iridescence.iridescenceIor ?? 1.3,
1955
+ iridescenceThicknessMinimum: iridescence.iridescenceThicknessMinimum ?? 100,
1956
+ iridescenceThicknessMaximum: iridescence.iridescenceThicknessMaximum ?? 400,
1957
+ iridescenceChannel: 0,
1958
+ iridescenceThicknessChannel: 1,
1959
+ ...iridescence.iridescenceTexture === void 0 ? {} : { iridescenceTexture: parseTextureInfo(iridescence.iridescenceTexture, textures) },
1960
+ ...iridescence.iridescenceThicknessTexture === void 0 ? {} : {
1961
+ iridescenceThicknessTexture: parseTextureInfo(
1962
+ iridescence.iridescenceThicknessTexture,
1963
+ textures
1964
+ )
1965
+ }
1966
+ },
1967
+ ...specular === void 0 ? {} : {
1968
+ specularFactor: specular.specularFactor ?? 1,
1969
+ specularChannel: 3,
1970
+ specularColorFactor: tuple3(specular.specularColorFactor) ?? [1, 1, 1],
1971
+ specularColorChannel: [0, 1, 2],
1972
+ ...specular.specularTexture === void 0 ? {} : { specularTexture: parseTextureInfo(specular.specularTexture, textures) },
1973
+ ...specular.specularColorTexture === void 0 ? {} : {
1974
+ specularColorTexture: parseTextureInfo(specular.specularColorTexture, textures)
1975
+ }
1976
+ },
1650
1977
  ...alphaMode === void 0 ? {} : { alphaMode },
1651
1978
  ...alphaCutoff === void 0 ? {} : { alphaCutoff },
1652
1979
  ...matJson.doubleSided === true ? { doubleSided: true } : {},
@@ -3137,6 +3464,16 @@ function materialRefsForPack(mat, doc, textureGuidByIndex, samplerGuidByIndex =
3137
3464
  pushRefsForSlot(mat.emissiveTexture, "emissiveTexture");
3138
3465
  pushRefsForSlot(mat.transmissionTexture, "transmissionTexture");
3139
3466
  pushRefsForSlot(mat.thicknessTexture, "thicknessTexture");
3467
+ pushRefsForSlot(mat.clearcoatTexture, "clearcoatTexture");
3468
+ pushRefsForSlot(mat.clearcoatRoughnessTexture, "clearcoatRoughnessTexture");
3469
+ pushRefsForSlot(mat.clearcoatNormalTexture, "clearcoatNormalTexture");
3470
+ pushRefsForSlot(mat.anisotropyTexture, "anisotropyTexture");
3471
+ pushRefsForSlot(mat.sheenColorTexture, "sheenColorTexture");
3472
+ pushRefsForSlot(mat.sheenRoughnessTexture, "sheenRoughnessTexture");
3473
+ pushRefsForSlot(mat.iridescenceTexture, "iridescenceTexture");
3474
+ pushRefsForSlot(mat.iridescenceThicknessTexture, "iridescenceThicknessTexture");
3475
+ pushRefsForSlot(mat.specularTexture, "specularTexture");
3476
+ pushRefsForSlot(mat.specularColorTexture, "specularColorTexture");
3140
3477
  return refs;
3141
3478
  }
3142
3479
  function availableUvSets(mesh) {
@@ -3157,7 +3494,17 @@ function rewriteMaterialAssetRefs(matAsset, mat, doc, maps) {
3157
3494
  ["occlusionTexture", mat.occlusionTexture],
3158
3495
  ["emissiveTexture", mat.emissiveTexture],
3159
3496
  ["transmissionTexture", mat.transmissionTexture],
3160
- ["thicknessTexture", mat.thicknessTexture]
3497
+ ["thicknessTexture", mat.thicknessTexture],
3498
+ ["clearcoatTexture", mat.clearcoatTexture],
3499
+ ["clearcoatRoughnessTexture", mat.clearcoatRoughnessTexture],
3500
+ ["clearcoatNormalTexture", mat.clearcoatNormalTexture],
3501
+ ["anisotropyTexture", mat.anisotropyTexture],
3502
+ ["sheenColorTexture", mat.sheenColorTexture],
3503
+ ["sheenRoughnessTexture", mat.sheenRoughnessTexture],
3504
+ ["iridescenceTexture", mat.iridescenceTexture],
3505
+ ["iridescenceThicknessTexture", mat.iridescenceThicknessTexture],
3506
+ ["specularTexture", mat.specularTexture],
3507
+ ["specularColorTexture", mat.specularColorTexture]
3161
3508
  ];
3162
3509
  let cursor = 0;
3163
3510
  for (const [slot, rawBinding] of slots) {
@@ -3374,6 +3721,10 @@ async function importGltf(ctx, meshopt) {
3374
3721
  if (!uvResult.ok) {
3375
3722
  throw Object.assign(new Error(uvResult.error.message), uvResult.error);
3376
3723
  }
3724
+ const tangentResult = validateMaterialTangentInputs(mat, meshIr);
3725
+ if (!tangentResult.ok) {
3726
+ throw Object.assign(new Error(tangentResult.error.message), tangentResult.error);
3727
+ }
3377
3728
  }
3378
3729
  const matAsset = toMaterialAsset(mat, {
3379
3730
  textureHandles: maps.textureHandles,