@babylonjs/core 9.2.1 → 9.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/Animations/animation.d.ts +9 -0
  2. package/Animations/animation.js +9 -0
  3. package/Animations/animation.js.map +1 -1
  4. package/Animations/runtimeAnimation.js +28 -0
  5. package/Animations/runtimeAnimation.js.map +1 -1
  6. package/Cameras/geospatialCameraMovement.js +19 -19
  7. package/Cameras/geospatialCameraMovement.js.map +1 -1
  8. package/Debug/physicsViewer.js +2 -12
  9. package/Debug/physicsViewer.js.map +1 -1
  10. package/Engines/abstractEngine.js +2 -2
  11. package/Engines/abstractEngine.js.map +1 -1
  12. package/FlowGraph/Blocks/flowGraphBlockFactory.js +14 -1
  13. package/FlowGraph/Blocks/flowGraphBlockFactory.js.map +1 -1
  14. package/FlowGraph/flowGraph.js +6 -0
  15. package/FlowGraph/flowGraph.js.map +1 -1
  16. package/FlowGraph/flowGraphEventBlock.d.ts +10 -0
  17. package/FlowGraph/flowGraphEventBlock.js +24 -0
  18. package/FlowGraph/flowGraphEventBlock.js.map +1 -1
  19. package/FlowGraph/flowGraphParser.js +23 -4
  20. package/FlowGraph/flowGraphParser.js.map +1 -1
  21. package/FlowGraph/serialization.js +36 -14
  22. package/FlowGraph/serialization.js.map +1 -1
  23. package/Layers/thinEffectLayer.js +8 -1
  24. package/Layers/thinEffectLayer.js.map +1 -1
  25. package/Loading/Plugins/babylonFileLoader.js +26 -0
  26. package/Loading/Plugins/babylonFileLoader.js.map +1 -1
  27. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +15 -2
  28. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
  29. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +3 -1
  30. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
  31. package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.d.ts +18 -4
  32. package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.js +29 -4
  33. package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.js.map +1 -1
  34. package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +48 -8
  35. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +276 -26
  36. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  37. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.d.ts +39 -4
  38. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.js +113 -22
  39. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.js.map +1 -1
  40. package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.d.ts +61 -7
  41. package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.js +94 -11
  42. package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.js.map +1 -1
  43. package/Meshes/mesh.d.ts +15 -0
  44. package/Meshes/mesh.js +40 -1
  45. package/Meshes/mesh.js.map +1 -1
  46. package/Meshes/transformNode.js +2 -2
  47. package/Meshes/transformNode.js.map +1 -1
  48. package/Misc/sceneSerializer.js +2 -1
  49. package/Misc/sceneSerializer.js.map +1 -1
  50. package/Misc/tools.js +1 -1
  51. package/Misc/tools.js.map +1 -1
  52. package/Particles/baseParticleSystem.d.ts +14 -0
  53. package/Particles/baseParticleSystem.js +23 -0
  54. package/Particles/baseParticleSystem.js.map +1 -1
  55. package/Particles/computeShaderParticleSystem.js +6 -0
  56. package/Particles/computeShaderParticleSystem.js.map +1 -1
  57. package/Particles/gpuParticleSystem.d.ts +37 -19
  58. package/Particles/gpuParticleSystem.js +164 -39
  59. package/Particles/gpuParticleSystem.js.map +1 -1
  60. package/Particles/thinParticleSystem.d.ts +0 -14
  61. package/Particles/thinParticleSystem.js +0 -23
  62. package/Particles/thinParticleSystem.js.map +1 -1
  63. package/Particles/webgl2ParticleSystem.d.ts +1 -0
  64. package/Particles/webgl2ParticleSystem.js +11 -2
  65. package/Particles/webgl2ParticleSystem.js.map +1 -1
  66. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js.map +1 -1
  67. package/Shaders/ShadersInclude/gaussianSplatting.js +25 -4
  68. package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -1
  69. package/Shaders/gaussianSplatting.vertex.js +3 -0
  70. package/Shaders/gaussianSplatting.vertex.js.map +1 -1
  71. package/Shaders/gpuRenderParticles.vertex.js +14 -2
  72. package/Shaders/gpuRenderParticles.vertex.js.map +1 -1
  73. package/Shaders/gpuUpdateParticles.vertex.js +12 -0
  74. package/Shaders/gpuUpdateParticles.vertex.js.map +1 -1
  75. package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +37 -5
  76. package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -1
  77. package/ShadersWGSL/gaussianSplatting.vertex.js +3 -0
  78. package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
  79. package/ShadersWGSL/gpuUpdateParticles.compute.js +15 -1
  80. package/ShadersWGSL/gpuUpdateParticles.compute.js.map +1 -1
  81. package/package.json +1 -1
@@ -157,7 +157,34 @@ var PLYValue;
157
157
  PLYValue[PLYValue["SH_42"] = 82] = "SH_42";
158
158
  PLYValue[PLYValue["SH_43"] = 83] = "SH_43";
159
159
  PLYValue[PLYValue["SH_44"] = 84] = "SH_44";
160
- PLYValue[PLYValue["UNDEFINED"] = 85] = "UNDEFINED";
160
+ PLYValue[PLYValue["SH_45"] = 85] = "SH_45";
161
+ PLYValue[PLYValue["SH_46"] = 86] = "SH_46";
162
+ PLYValue[PLYValue["SH_47"] = 87] = "SH_47";
163
+ PLYValue[PLYValue["SH_48"] = 88] = "SH_48";
164
+ PLYValue[PLYValue["SH_49"] = 89] = "SH_49";
165
+ PLYValue[PLYValue["SH_50"] = 90] = "SH_50";
166
+ PLYValue[PLYValue["SH_51"] = 91] = "SH_51";
167
+ PLYValue[PLYValue["SH_52"] = 92] = "SH_52";
168
+ PLYValue[PLYValue["SH_53"] = 93] = "SH_53";
169
+ PLYValue[PLYValue["SH_54"] = 94] = "SH_54";
170
+ PLYValue[PLYValue["SH_55"] = 95] = "SH_55";
171
+ PLYValue[PLYValue["SH_56"] = 96] = "SH_56";
172
+ PLYValue[PLYValue["SH_57"] = 97] = "SH_57";
173
+ PLYValue[PLYValue["SH_58"] = 98] = "SH_58";
174
+ PLYValue[PLYValue["SH_59"] = 99] = "SH_59";
175
+ PLYValue[PLYValue["SH_60"] = 100] = "SH_60";
176
+ PLYValue[PLYValue["SH_61"] = 101] = "SH_61";
177
+ PLYValue[PLYValue["SH_62"] = 102] = "SH_62";
178
+ PLYValue[PLYValue["SH_63"] = 103] = "SH_63";
179
+ PLYValue[PLYValue["SH_64"] = 104] = "SH_64";
180
+ PLYValue[PLYValue["SH_65"] = 105] = "SH_65";
181
+ PLYValue[PLYValue["SH_66"] = 106] = "SH_66";
182
+ PLYValue[PLYValue["SH_67"] = 107] = "SH_67";
183
+ PLYValue[PLYValue["SH_68"] = 108] = "SH_68";
184
+ PLYValue[PLYValue["SH_69"] = 109] = "SH_69";
185
+ PLYValue[PLYValue["SH_70"] = 110] = "SH_70";
186
+ PLYValue[PLYValue["SH_71"] = 111] = "SH_71";
187
+ PLYValue[PLYValue["UNDEFINED"] = 112] = "UNDEFINED";
161
188
  })(PLYValue || (PLYValue = {}));
162
189
  /**
163
190
  * Base class for Gaussian Splatting meshes. Contains all single-cloud rendering logic.
@@ -197,7 +224,7 @@ export class GaussianSplattingMeshBase extends Mesh {
197
224
  return this._shDegree;
198
225
  }
199
226
  set shDegree(value) {
200
- const maxDegree = this._shTextures?.length ?? 0;
227
+ const maxDegree = this._maxShDegree;
201
228
  const clamped = Math.max(0, Math.min(Math.round(value), maxDegree));
202
229
  if (this._shDegree === clamped) {
203
230
  return;
@@ -209,7 +236,7 @@ export class GaussianSplattingMeshBase extends Mesh {
209
236
  * Maximum SH degree available from the loaded data.
210
237
  */
211
238
  get maxShDegree() {
212
- return this._shTextures?.length ?? 0;
239
+ return this._maxShDegree;
213
240
  }
214
241
  /**
215
242
  * Number of splats in the mesh
@@ -341,6 +368,7 @@ export class GaussianSplattingMeshBase extends Mesh {
341
368
  this._textureSize = new Vector2(0, 0);
342
369
  this._keepInRam = false;
343
370
  this._alwaysRetainSplatsData = false;
371
+ this._flipY = false;
344
372
  this._delayedTextureUpdate = null;
345
373
  this._useRGBACovariants = false;
346
374
  this._material = null;
@@ -351,6 +379,7 @@ export class GaussianSplattingMeshBase extends Mesh {
351
379
  this._cachedBoundingMax = null;
352
380
  /** @internal */
353
381
  this._shDegree = 0;
382
+ this._maxShDegree = 0;
354
383
  this._cameraViewInfos = new Map();
355
384
  /**
356
385
  * Cosine value of the angle threshold to update view dependent splat sorting. Default is 0.0001.
@@ -373,6 +402,7 @@ export class GaussianSplattingMeshBase extends Mesh {
373
402
  const gaussianSplattingMaterial = new GaussianSplattingMaterial(this.name + "_material", this._scene);
374
403
  // Cast is safe: GaussianSplattingMeshBase is @internal; all concrete instances are GaussianSplattingMesh.
375
404
  gaussianSplattingMaterial.setSourceMesh(this);
405
+ gaussianSplattingMaterial.doNotSerialize = true;
376
406
  this._material = gaussianSplattingMaterial;
377
407
  // delete meshes created for cameras on camera removal
378
408
  this._scene.onCameraRemovedObservable.add((camera) => {
@@ -464,6 +494,7 @@ export class GaussianSplattingMeshBase extends Mesh {
464
494
  else {
465
495
  // mesh doesn't exist yet for this camera
466
496
  const cameraMesh = new Mesh(this.name + "_cameraMesh_" + cameraId, this._scene);
497
+ cameraMesh.doNotSerialize = true;
467
498
  // not visible with inspector or the scene graph
468
499
  cameraMesh.reservedDataStore = { hidden: true };
469
500
  cameraMesh.setEnabled(false);
@@ -772,8 +803,62 @@ export class GaussianSplattingMeshBase extends Mesh {
772
803
  return 83 /* PLYValue.SH_43 */;
773
804
  case "f_rest_44":
774
805
  return 84 /* PLYValue.SH_44 */;
775
- }
776
- return 85 /* PLYValue.UNDEFINED */;
806
+ case "f_rest_45":
807
+ return 85 /* PLYValue.SH_45 */;
808
+ case "f_rest_46":
809
+ return 86 /* PLYValue.SH_46 */;
810
+ case "f_rest_47":
811
+ return 87 /* PLYValue.SH_47 */;
812
+ case "f_rest_48":
813
+ return 88 /* PLYValue.SH_48 */;
814
+ case "f_rest_49":
815
+ return 89 /* PLYValue.SH_49 */;
816
+ case "f_rest_50":
817
+ return 90 /* PLYValue.SH_50 */;
818
+ case "f_rest_51":
819
+ return 91 /* PLYValue.SH_51 */;
820
+ case "f_rest_52":
821
+ return 92 /* PLYValue.SH_52 */;
822
+ case "f_rest_53":
823
+ return 93 /* PLYValue.SH_53 */;
824
+ case "f_rest_54":
825
+ return 94 /* PLYValue.SH_54 */;
826
+ case "f_rest_55":
827
+ return 95 /* PLYValue.SH_55 */;
828
+ case "f_rest_56":
829
+ return 96 /* PLYValue.SH_56 */;
830
+ case "f_rest_57":
831
+ return 97 /* PLYValue.SH_57 */;
832
+ case "f_rest_58":
833
+ return 98 /* PLYValue.SH_58 */;
834
+ case "f_rest_59":
835
+ return 99 /* PLYValue.SH_59 */;
836
+ case "f_rest_60":
837
+ return 100 /* PLYValue.SH_60 */;
838
+ case "f_rest_61":
839
+ return 101 /* PLYValue.SH_61 */;
840
+ case "f_rest_62":
841
+ return 102 /* PLYValue.SH_62 */;
842
+ case "f_rest_63":
843
+ return 103 /* PLYValue.SH_63 */;
844
+ case "f_rest_64":
845
+ return 104 /* PLYValue.SH_64 */;
846
+ case "f_rest_65":
847
+ return 105 /* PLYValue.SH_65 */;
848
+ case "f_rest_66":
849
+ return 106 /* PLYValue.SH_66 */;
850
+ case "f_rest_67":
851
+ return 107 /* PLYValue.SH_67 */;
852
+ case "f_rest_68":
853
+ return 108 /* PLYValue.SH_68 */;
854
+ case "f_rest_69":
855
+ return 109 /* PLYValue.SH_69 */;
856
+ case "f_rest_70":
857
+ return 110 /* PLYValue.SH_70 */;
858
+ case "f_rest_71":
859
+ return 111 /* PLYValue.SH_71 */;
860
+ }
861
+ return 112 /* PLYValue.UNDEFINED */;
777
862
  }
778
863
  /**
779
864
  * Parse a PLY file header and returns metas infos on splats and chunks
@@ -823,12 +908,15 @@ export class GaussianSplattingMeshBase extends Mesh {
823
908
  if (prop.startsWith("property ")) {
824
909
  const [, typeName, name] = prop.split(" ");
825
910
  const value = GaussianSplattingMeshBase._ValueNameToEnum(name);
826
- if (value != 85 /* PLYValue.UNDEFINED */) {
827
- // SH degree 1,2 or 3 for 9, 24 or 45 values
828
- if (value >= 84 /* PLYValue.SH_44 */) {
829
- shDegree = 3;
911
+ if (value != 112 /* PLYValue.UNDEFINED */) {
912
+ // SH degree 1,2,3 or 4 for 9, 24, 45 or 72 values
913
+ if (value >= 111 /* PLYValue.SH_71 */) {
914
+ shDegree = 4;
915
+ }
916
+ else if (value >= 84 /* PLYValue.SH_44 */) {
917
+ shDegree = Math.max(shDegree, 3);
830
918
  }
831
- else if (value >= 64 /* PLYValue.SH_24 */) {
919
+ else if (value >= 63 /* PLYValue.SH_23 */) {
832
920
  shDegree = Math.max(shDegree, 2);
833
921
  }
834
922
  else if (value >= 48 /* PLYValue.SH_8 */) {
@@ -1112,7 +1200,7 @@ export class GaussianSplattingMeshBase extends Mesh {
1112
1200
  r3 = value;
1113
1201
  break;
1114
1202
  }
1115
- if (sh && property.value >= 40 /* PLYValue.SH_0 */ && property.value <= 84 /* PLYValue.SH_44 */) {
1203
+ if (sh && property.value >= 40 /* PLYValue.SH_0 */ && property.value <= 111 /* PLYValue.SH_71 */) {
1116
1204
  const shIndex = property.value - 40 /* PLYValue.SH_0 */;
1117
1205
  if (property.type == 4 /* PLYType.UCHAR */ && header.chunkCount) {
1118
1206
  // compressed ply. dataView points to beginning of vertex
@@ -1128,7 +1216,7 @@ export class GaussianSplattingMeshBase extends Mesh {
1128
1216
  }
1129
1217
  }
1130
1218
  if (sh) {
1131
- const shDim = header.shDegree == 1 ? 3 : header.shDegree == 2 ? 8 : 15;
1219
+ const shDim = header.shDegree == 1 ? 3 : header.shDegree == 2 ? 8 : header.shDegree == 3 ? 15 : 24;
1132
1220
  for (let j = 0; j < shDim; j++) {
1133
1221
  sh[j * 3 + 0] = plySH[j];
1134
1222
  sh[j * 3 + 1] = plySH[j + shDim];
@@ -1193,7 +1281,7 @@ export class GaussianSplattingMeshBase extends Mesh {
1193
1281
  }
1194
1282
  }
1195
1283
  }
1196
- return { buffer: header.buffer, sh: sh };
1284
+ return { buffer: header.buffer, sh: sh, shDegree: header.shDegree };
1197
1285
  }
1198
1286
  /**
1199
1287
  * Converts a .ply data array buffer to splat
@@ -1275,8 +1363,8 @@ export class GaussianSplattingMeshBase extends Mesh {
1275
1363
  this._cachedBoundingMin = null;
1276
1364
  this._cachedBoundingMax = null;
1277
1365
  // Note: _splatsData and _shData are intentionally kept alive after dispose.
1278
- // They serve as the source reference for the compound API (addPart/removePart)
1279
- // when this mesh is held by a GaussianSplattingPartProxyMesh.compoundSplatMesh.
1366
+ // They can still be used as runtime source buffers by a compound mesh that retained
1367
+ // this mesh's data before disposal.
1280
1368
  this._worker?.terminate();
1281
1369
  this._worker = null;
1282
1370
  // delete meshes created for each camera
@@ -1524,10 +1612,11 @@ export class GaussianSplattingMeshBase extends Mesh {
1524
1612
  }
1525
1613
  this._sortIsDirty = true;
1526
1614
  }
1527
- *_updateData(data, isAsync, sh, partIndices, { flipY = false, previousVertexCount = 0 } = {}) {
1615
+ *_updateData(data, isAsync, sh, partIndices, { flipY = false, previousVertexCount = 0 } = {}, shDegree) {
1528
1616
  if (!this._covariancesATexture) {
1529
1617
  this._readyToDisplay = false;
1530
1618
  }
1619
+ this._flipY = flipY;
1531
1620
  const uBuffer = new Uint8Array(data);
1532
1621
  const fBuffer = new Float32Array(uBuffer.buffer);
1533
1622
  // Optionally store the raw splat buffer as an ArrayBuffer. This is the source reference
@@ -1547,8 +1636,8 @@ export class GaussianSplattingMeshBase extends Mesh {
1547
1636
  this._updateSplatIndexBuffer(vertexCount);
1548
1637
  }
1549
1638
  this._vertexCount = vertexCount;
1550
- // degree == 1 for 1 texture (3 terms), 2 for 2 textures (8 terms) and 3 for 3 textures (15 terms)
1551
- this._shDegree = sh ? sh.length : 0;
1639
+ this._maxShDegree = sh ? (shDegree ?? 0) : 0;
1640
+ this._shDegree = this._maxShDegree;
1552
1641
  const textureSize = this._getTextureSize(vertexCount);
1553
1642
  const textureLength = textureSize.x * textureSize.y;
1554
1643
  const lineCountUpdate = GaussianSplattingMeshBase.ProgressiveUpdateAmount ?? textureSize.y;
@@ -1653,10 +1742,11 @@ export class GaussianSplattingMeshBase extends Mesh {
1653
1742
  * @param data array buffer containing center, color, orientation and scale of splats
1654
1743
  * @param sh optional array of uint8 array for SH data
1655
1744
  * @param partIndices optional array of uint8 for rig node indices
1745
+ * @param shDegree optional SH degree of the data
1656
1746
  * @returns a promise
1657
1747
  */
1658
- async updateDataAsync(data, sh, partIndices) {
1659
- return await runCoroutineAsync(this._updateData(data, true, sh, partIndices), createYieldingScheduler());
1748
+ async updateDataAsync(data, sh, partIndices, shDegree) {
1749
+ return await runCoroutineAsync(this._updateData(data, true, sh, partIndices, undefined, shDegree), createYieldingScheduler());
1660
1750
  }
1661
1751
  /**
1662
1752
  * @experimental
@@ -1665,9 +1755,10 @@ export class GaussianSplattingMeshBase extends Mesh {
1665
1755
  * @param sh optional array of uint8 array for SH data
1666
1756
  * @param options optional informations on how to treat data (needs to be 3rd for backward compatibility)
1667
1757
  * @param partIndices optional array of uint8 for rig node indices
1758
+ * @param shDegree optional SH degree of the data
1668
1759
  */
1669
- updateData(data, sh, options = { flipY: true }, partIndices) {
1670
- runCoroutineSync(this._updateData(data, false, sh, partIndices, options));
1760
+ updateData(data, sh, options = { flipY: true }, partIndices, shDegree) {
1761
+ runCoroutineSync(this._updateData(data, false, sh, partIndices, options, shDegree));
1671
1762
  }
1672
1763
  /**
1673
1764
  * Refreshes the bounding info, taking into account all the thin instances defined