babylonjs-loaders 9.1.0 → 9.2.2

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.
@@ -627,7 +627,6 @@ declare namespace BABYLON.GLTF2 {
627
627
  */
628
628
  export class PBRMaterialLoadingAdapter implements BABYLON.GLTF2.IMaterialLoadingAdapter {
629
629
  private _material;
630
- private _extinctionCoefficient;
631
630
  /**
632
631
  * Creates a new instance of the PBRMaterialLoadingAdapter.
633
632
  * @param material - The PBR material to adapt.
@@ -1044,6 +1043,7 @@ declare namespace BABYLON.GLTF2 {
1044
1043
  * @returns The scatter coefficient as a Color3
1045
1044
  */
1046
1045
  get transmissionScatter(): Color3;
1046
+ set transmissionScatterTexture(value: Nullable<BaseTexture>);
1047
1047
  /**
1048
1048
  * Sets the transmission scattering anisotropy.
1049
1049
  * @param value The anisotropy intensity value (-1 to 1)
@@ -1074,6 +1074,15 @@ declare namespace BABYLON.GLTF2 {
1074
1074
  * Sets up the material for proper thin-surface transmission behavior.
1075
1075
  */
1076
1076
  configureTransmission(): void;
1077
+ configureVolume(): void;
1078
+ /**
1079
+ * Sets whether the material is thin-walled (i.e. non-volumetric) or not.
1080
+ */
1081
+ set geometryThinWalled(value: boolean);
1082
+ /**
1083
+ * Gets whether the material is thin-walled (i.e. non-volumetric) or not.
1084
+ */
1085
+ get geometryThinWalled(): boolean;
1077
1086
  /**
1078
1087
  * Sets the thickness texture (mapped to PBR subSurface.thicknessTexture).
1079
1088
  * Automatically enables refraction.
@@ -1090,15 +1099,6 @@ declare namespace BABYLON.GLTF2 {
1090
1099
  * Configures subsurface properties for PBR material
1091
1100
  */
1092
1101
  configureSubsurface(): void;
1093
- /**
1094
- * Sets the extinction coefficient of the volume.
1095
- * @param value The extinction coefficient as a Vector3
1096
- */
1097
- set extinctionCoefficient(value: Vector3);
1098
- /**
1099
- * Gets the extinction coefficient of the volume.
1100
- */
1101
- get extinctionCoefficient(): Vector3;
1102
1102
  /**
1103
1103
  * Sets the subsurface weight
1104
1104
  */
@@ -1125,17 +1125,17 @@ declare namespace BABYLON.GLTF2 {
1125
1125
  /**
1126
1126
  * Sets the surface tint of the material (when using subsurface scattering)
1127
1127
  */
1128
- set subsurfaceConstantTint(value: Color3);
1128
+ set diffuseTransmissionTint(value: Color3);
1129
1129
  /**
1130
1130
  * Gets the subsurface constant tint (when using subsurface scattering)
1131
1131
  * @returns The subsurface constant tint as a Color3
1132
1132
  */
1133
- get subsurfaceConstantTint(): Color3;
1133
+ get diffuseTransmissionTint(): Color3;
1134
1134
  /**
1135
1135
  * Sets the subsurface constant tint texture (when using subsurface scattering)
1136
1136
  * @param value The subsurface constant tint texture or null
1137
1137
  */
1138
- set subsurfaceConstantTintTexture(value: Nullable<BaseTexture>);
1138
+ set diffuseTransmissionTintTexture(value: Nullable<BaseTexture>);
1139
1139
  /**
1140
1140
  * Gets the subsurface radius (used for subsurface scattering)
1141
1141
  * subsurfaceRadiusScale * subsurfaceRadius gives the mean free path per color channel.
@@ -1166,6 +1166,11 @@ declare namespace BABYLON.GLTF2 {
1166
1166
  * @param value The anisotropy intensity value (ignored for PBR)
1167
1167
  */
1168
1168
  set subsurfaceScatterAnisotropy(value: number);
1169
+ /**
1170
+ * Does this material have a translucent surface (i.e. either transmission or subsurface)?
1171
+ * @returns True if the material is translucent, false otherwise
1172
+ */
1173
+ isTranslucent(): boolean;
1169
1174
  /**
1170
1175
  * Configures sheen for PBR material.
1171
1176
  * Enables sheen and sets up proper configuration.
@@ -1334,7 +1339,6 @@ declare namespace BABYLON.GLTF2 {
1334
1339
  */
1335
1340
  export class OpenPBRMaterialLoadingAdapter implements BABYLON.GLTF2.IMaterialLoadingAdapter {
1336
1341
  private _material;
1337
- private _extinctionCoefficient;
1338
1342
  /**
1339
1343
  * Creates a new instance of the OpenPBRMaterialLoadingAdapter.
1340
1344
  * @param material - The OpenPBR material to adapt.
@@ -1726,7 +1730,15 @@ declare namespace BABYLON.GLTF2 {
1726
1730
  * @returns The scatter coefficient as a Vector3
1727
1731
  */
1728
1732
  get transmissionScatter(): Color3;
1733
+ /**
1734
+ * Sets the transmission scatter texture.
1735
+ * @param value The transmission scatter texture or null
1736
+ */
1729
1737
  set transmissionScatterTexture(value: Nullable<BaseTexture>);
1738
+ /**
1739
+ * Gets the transmission scatter texture.
1740
+ * @returns The transmission scatter texture or null
1741
+ */
1730
1742
  get transmissionScatterTexture(): Nullable<BaseTexture>;
1731
1743
  /**
1732
1744
  * Sets the transmission scattering anisotropy.
@@ -1771,6 +1783,15 @@ declare namespace BABYLON.GLTF2 {
1771
1783
  * @param value The refraction background texture or null
1772
1784
  */
1773
1785
  set refractionBackgroundTexture(value: Nullable<BaseTexture>);
1786
+ configureVolume(): void;
1787
+ /**
1788
+ * Sets whether the material is thin-walled (i.e. non-volumetric) or not.
1789
+ */
1790
+ set geometryThinWalled(value: boolean);
1791
+ /**
1792
+ * Gets whether the material is thin-walled (i.e. non-volumetric) or not.
1793
+ */
1794
+ get geometryThinWalled(): boolean;
1774
1795
  /**
1775
1796
  * Sets the thickness texture.
1776
1797
  * @param value The thickness texture or null
@@ -1785,15 +1806,6 @@ declare namespace BABYLON.GLTF2 {
1785
1806
  * Configures subsurface properties for PBR material
1786
1807
  */
1787
1808
  configureSubsurface(): void;
1788
- /**
1789
- * Sets the extinction coefficient of the volume.
1790
- * @param value The extinction coefficient as a Vector3
1791
- */
1792
- set extinctionCoefficient(value: Vector3);
1793
- /**
1794
- * Gets the extinction coefficient of the volume.
1795
- */
1796
- get extinctionCoefficient(): Vector3;
1797
1809
  /**
1798
1810
  * Sets the subsurface weight
1799
1811
  */
@@ -1813,18 +1825,20 @@ declare namespace BABYLON.GLTF2 {
1813
1825
  * @param value The subsurface tint texture or null
1814
1826
  */
1815
1827
  set subsurfaceColorTexture(value: Nullable<BaseTexture>);
1828
+ private _diffuseTransmissionTint;
1829
+ private _diffuseTransmissionTintTexture;
1816
1830
  /**
1817
- * Sets the surface tint of the material (when using subsurface scattering)
1831
+ * Sets the diffuse transmission tint of the material
1818
1832
  */
1819
- set subsurfaceConstantTint(value: Color3);
1833
+ set diffuseTransmissionTint(value: Color3);
1820
1834
  /**
1821
- * Gets the surface tint of the material (when using subsurface scattering)
1835
+ * Gets the diffuse transmission tint of the material
1822
1836
  */
1823
- get subsurfaceConstantTint(): Color3;
1837
+ get diffuseTransmissionTint(): Color3;
1824
1838
  /**
1825
- * Sets the surface tint texture of the material (when using subsurface scattering)
1839
+ * Sets the diffuse transmission tint texture of the material
1826
1840
  */
1827
- set subsurfaceConstantTintTexture(value: Nullable<BaseTexture>);
1841
+ set diffuseTransmissionTintTexture(value: Nullable<BaseTexture>);
1828
1842
  /**
1829
1843
  * Gets the subsurface radius for subsurface scattering.
1830
1844
  * subsurfaceRadiusScale * subsurfaceRadius gives the mean free path per color channel.
@@ -1852,6 +1866,11 @@ declare namespace BABYLON.GLTF2 {
1852
1866
  * @param value The anisotropy intensity value
1853
1867
  */
1854
1868
  set subsurfaceScatterAnisotropy(value: number);
1869
+ /**
1870
+ * Does this material have a translucent surface (i.e. either transmission or subsurface)?
1871
+ * @returns True if the material is translucent, false otherwise
1872
+ */
1873
+ isTranslucent(): boolean;
1855
1874
  /**
1856
1875
  * Configures fuzz for OpenPBR.
1857
1876
  * Enables fuzz and sets up proper configuration.
@@ -1995,6 +2014,7 @@ declare namespace BABYLON.GLTF2 {
1995
2014
  * @param value The scale value for the coat normal texture
1996
2015
  */
1997
2016
  set geometryCoatNormalTextureScale(value: number);
2017
+ finalize(): void;
1998
2018
  }
1999
2019
 
2000
2020
 
@@ -2014,6 +2034,10 @@ declare namespace BABYLON.GLTF2 {
2014
2034
  * Gets the underlying material
2015
2035
  */
2016
2036
  readonly material: Material;
2037
+ /**
2038
+ * Finalizes material properties after loading is complete.
2039
+ */
2040
+ finalize?(): void;
2017
2041
  /**
2018
2042
  * Whether the material should be treated as unlit
2019
2043
  */
@@ -2195,6 +2219,10 @@ declare namespace BABYLON.GLTF2 {
2195
2219
  * Sets the scattering coefficient
2196
2220
  */
2197
2221
  transmissionScatter: Color3;
2222
+ /**
2223
+ * Sets the transmission scatter texture
2224
+ */
2225
+ transmissionScatterTexture: Nullable<BaseTexture>;
2198
2226
  /**
2199
2227
  * Sets the scattering anisotropy (-1 to 1)
2200
2228
  */
@@ -2215,6 +2243,11 @@ declare namespace BABYLON.GLTF2 {
2215
2243
  * Configures transmission for thin-surface transmission (KHR_materials_transmission)
2216
2244
  */
2217
2245
  configureTransmission(): void;
2246
+ configureVolume(): void;
2247
+ /**
2248
+ * Sets whether the material is thin-walled (i.e. non-volumetric) or not.
2249
+ */
2250
+ geometryThinWalled: boolean;
2218
2251
  /**
2219
2252
  * Sets the thickness texture
2220
2253
  */
@@ -2227,11 +2260,6 @@ declare namespace BABYLON.GLTF2 {
2227
2260
  * Configures subsurface properties
2228
2261
  */
2229
2262
  configureSubsurface(): void;
2230
- /**
2231
- * @internal
2232
- * Sets/gets the extinction coefficient
2233
- */
2234
- extinctionCoefficient: Vector3;
2235
2263
  /**
2236
2264
  * Sets/gets the subsurface weight
2237
2265
  */
@@ -2249,13 +2277,13 @@ declare namespace BABYLON.GLTF2 {
2249
2277
  */
2250
2278
  subsurfaceColorTexture: Nullable<BaseTexture>;
2251
2279
  /**
2252
- * Sets/gets the surface tint of the material (when using subsurface scattering)
2280
+ * Sets/gets the diffuse transmission tint of the material
2253
2281
  */
2254
- subsurfaceConstantTint: Color3;
2282
+ diffuseTransmissionTint: Color3;
2255
2283
  /**
2256
- * Sets/gets the surface tint texture of the material (when using subsurface scattering)
2284
+ * Sets/gets the diffuse transmission tint texture of the material
2257
2285
  */
2258
- subsurfaceConstantTintTexture: Nullable<BaseTexture>;
2286
+ diffuseTransmissionTintTexture: Nullable<BaseTexture>;
2259
2287
  /**
2260
2288
  * Sets/gets the subsurface radius (used for subsurface scattering)
2261
2289
  */
@@ -2268,6 +2296,10 @@ declare namespace BABYLON.GLTF2 {
2268
2296
  * Sets/gets the subsurface scattering anisotropy
2269
2297
  */
2270
2298
  subsurfaceScatterAnisotropy: number;
2299
+ /**
2300
+ * Does this material have a translucent surface (i.e. either transmission or subsurface)?
2301
+ */
2302
+ isTranslucent(): boolean;
2271
2303
  /**
2272
2304
  * Configures initial settings for fuzz for material.
2273
2305
  */
@@ -2951,6 +2983,7 @@ declare namespace BABYLON.GLTF2 {
2951
2983
  private _defaultBabylonMaterialData;
2952
2984
  private readonly _postSceneLoadActions;
2953
2985
  private readonly _materialAdapterCache;
2986
+ private readonly _materialAdapters;
2954
2987
  /** @internal */
2955
2988
  _pbrMaterialImpl: Nullable<Readonly<PBRMaterialImplementation>> | false;
2956
2989
  /**
@@ -6757,13 +6790,45 @@ declare namespace BABYLON {
6757
6790
 
6758
6791
 
6759
6792
  /**
6760
- * Parses SPZ data and returns a promise resolving to an IParsedPLY object.
6793
+ * Parses SPZ data and returns a promise resolving to an IParsedSplat object.
6761
6794
  * @param data The ArrayBuffer containing SPZ data.
6762
6795
  * @param scene The Babylon.js scene.
6763
- * @param loadingOptions Options for loading Gaussian Splatting files.
6796
+ * @param _loadingOptions Options for loading Gaussian Splatting files.
6764
6797
  * @returns A promise resolving to the parsed SPZ data.
6765
6798
  */
6766
- export function ParseSpz(data: ArrayBuffer, scene: Scene, loadingOptions: SPLATLoadingOptions): Promise<IParsedSplat>;
6799
+ export function ParseSpz(data: ArrayBuffer, scene: Scene, _loadingOptions: SPLATLoadingOptions): Promise<IParsedSplat>;
6800
+ /**
6801
+ * Returns the initialized spz WASM module loaded from the given URL, loading it on first call.
6802
+ * @param url URL to the spz WASM ES module (its default export should be a factory function)
6803
+ * @returns A promise resolving to the initialized spz WASM module
6804
+ */
6805
+ export function GetSpzModule(url: string): Promise<SpzModule>;
6806
+ /**
6807
+ * Converts a GaussianCloud object (from the spz WASM module) into the packed 32-byte-per-splat
6808
+ * ArrayBuffer and SH texture arrays expected by GaussianSplattingMeshBase.updateData.
6809
+ *
6810
+ * Packed layout per splat (32 bytes):
6811
+ * [0-11] position xyz (float32 x3)
6812
+ * [12-23] scale xyz (float32 x3)
6813
+ * [24-27] color RGBA (uint8 x4, colors in [0,255], alpha in [0,255])
6814
+ * [28-31] quaternion wxyz (uint8 x4, encoded as q * 127.5 + 127.5)
6815
+ *
6816
+ * SH coefficients from the cloud (Float32, range ~[-1,1]) are encoded to bytes
6817
+ * using the SPZ convention (load-spz.cc unquantizeSH): byte = coeff * 128 + 128.
6818
+ *
6819
+ * @param cloud The GaussianCloud returned by spz.loadSpzFromBuffer
6820
+ * @param scene The Babylon.js scene (used to query maxTextureSize for SH textures)
6821
+ * @param useCoroutine If true, yields periodically to avoid blocking the main thread
6822
+ * @returns A coroutine returning an IParsedSplat ready to be passed to updateData
6823
+ */
6824
+ export function ConvertSpzToSplat(cloud: GaussianCloud, scene: Scene, useCoroutine?: boolean): Coroutine<IParsedSplat>;
6825
+ /**
6826
+ * Async version of ConvertSpzToSplat that yields periodically to avoid blocking the main thread.
6827
+ * @param cloud The GaussianCloud returned by spz.loadSpzFromBuffer
6828
+ * @param scene The Babylon.js scene
6829
+ * @returns A promise resolving to an IParsedSplat
6830
+ */
6831
+ export function ConvertSpzToSplatAsync(cloud: any, scene: Scene): Promise<IParsedSplat>;
6767
6832
 
6768
6833
 
6769
6834
  /**
@@ -6797,6 +6862,17 @@ declare namespace BABYLON {
6797
6862
  * Mesh that will be used to load data instead of creating a new one
6798
6863
  */
6799
6864
  gaussianSplattingMesh?: GaussianSplattingMesh;
6865
+ /**
6866
+ * URL to load the spz WASM ES module from (e.g. the \@adobe/spz package).
6867
+ * When provided, the WASM-based SPZ loader is used, which supports extra features
6868
+ * such as antialiasing metadata, and vendor-specific extensions such as safe-orbit
6869
+ * camera limits.
6870
+ * Defaults to the \@adobe/spz unpkg URL when WebAssembly is supported, and undefined otherwise.
6871
+ * Set to undefined to force the built-in manual SPZ parser regardless of WebAssembly support.
6872
+ * @example Setting the URL directly on the loader options
6873
+ * spzLibraryUrl: "https://unpkg.com/\@adobe/spz\@0.2.0/dist/spz.js"
6874
+ */
6875
+ spzLibraryUrl?: string;
6800
6876
  };
6801
6877
 
6802
6878
 
@@ -6935,6 +7011,7 @@ declare namespace BABYLON {
6935
7011
  faces?: number[];
6936
7012
  hasVertexColors?: boolean;
6937
7013
  sh?: Uint8Array[];
7014
+ shDegree?: number;
6938
7015
  trainedWithAntialiasing?: boolean;
6939
7016
  compressed?: boolean;
6940
7017
  rawSplat?: boolean;