@babylonjs/core 9.2.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.
Files changed (200) 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/Inputs/geospatialCameraPointersInput.js +10 -8
  7. package/Cameras/Inputs/geospatialCameraPointersInput.js.map +1 -1
  8. package/Cameras/geospatialCameraMovement.js +21 -21
  9. package/Cameras/geospatialCameraMovement.js.map +1 -1
  10. package/Debug/physicsViewer.js +2 -12
  11. package/Debug/physicsViewer.js.map +1 -1
  12. package/Engines/abstractEngine.js +2 -2
  13. package/Engines/abstractEngine.js.map +1 -1
  14. package/Engines/webgpuEngine.js +2 -0
  15. package/Engines/webgpuEngine.js.map +1 -1
  16. package/FlowGraph/Blocks/flowGraphBlockFactory.js +14 -1
  17. package/FlowGraph/Blocks/flowGraphBlockFactory.js.map +1 -1
  18. package/FlowGraph/flowGraph.js +6 -0
  19. package/FlowGraph/flowGraph.js.map +1 -1
  20. package/FlowGraph/flowGraphEventBlock.d.ts +10 -0
  21. package/FlowGraph/flowGraphEventBlock.js +24 -0
  22. package/FlowGraph/flowGraphEventBlock.js.map +1 -1
  23. package/FlowGraph/flowGraphParser.js +23 -4
  24. package/FlowGraph/flowGraphParser.js.map +1 -1
  25. package/FlowGraph/serialization.js +36 -14
  26. package/FlowGraph/serialization.js.map +1 -1
  27. package/FrameGraph/Node/Blocks/Rendering/iblShadowsRendererBlock.d.ts +105 -0
  28. package/FrameGraph/Node/Blocks/Rendering/iblShadowsRendererBlock.js +318 -0
  29. package/FrameGraph/Node/Blocks/Rendering/iblShadowsRendererBlock.js.map +1 -0
  30. package/FrameGraph/Node/Blocks/index.d.ts +1 -0
  31. package/FrameGraph/Node/Blocks/index.js +1 -0
  32. package/FrameGraph/Node/Blocks/index.js.map +1 -1
  33. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsAccumulationTask.d.ts +34 -0
  34. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsAccumulationTask.js +144 -0
  35. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsAccumulationTask.js.map +1 -0
  36. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsSpatialBlurTask.d.ts +26 -0
  37. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsSpatialBlurTask.js +82 -0
  38. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsSpatialBlurTask.js.map +1 -0
  39. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsTracingTask.d.ts +61 -0
  40. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsTracingTask.js +207 -0
  41. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsTracingTask.js.map +1 -0
  42. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsVoxelizationTask.d.ts +104 -0
  43. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsVoxelizationTask.js +218 -0
  44. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsVoxelizationTask.js.map +1 -0
  45. package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.d.ts +217 -0
  46. package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.js +640 -0
  47. package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.js.map +1 -0
  48. package/FrameGraph/frameGraph.js +1 -0
  49. package/FrameGraph/frameGraph.js.map +1 -1
  50. package/FrameGraph/index.d.ts +1 -0
  51. package/FrameGraph/index.js +1 -0
  52. package/FrameGraph/index.js.map +1 -1
  53. package/Gizmos/boundingBoxGizmo.js +4 -0
  54. package/Gizmos/boundingBoxGizmo.js.map +1 -1
  55. package/Layers/thinEffectLayer.js +8 -1
  56. package/Layers/thinEffectLayer.js.map +1 -1
  57. package/Lights/Clustered/clusteredLightContainer.js +8 -5
  58. package/Lights/Clustered/clusteredLightContainer.js.map +1 -1
  59. package/Loading/Plugins/babylonFileLoader.js +26 -0
  60. package/Loading/Plugins/babylonFileLoader.js.map +1 -1
  61. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +15 -2
  62. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
  63. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +3 -1
  64. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
  65. package/Materials/PBR/openpbrMaterial.d.ts +13 -2
  66. package/Materials/PBR/openpbrMaterial.js +47 -16
  67. package/Materials/PBR/openpbrMaterial.js.map +1 -1
  68. package/Materials/PBR/pbrBRDFConfiguration.js +1 -1
  69. package/Materials/PBR/pbrBRDFConfiguration.js.map +1 -1
  70. package/Materials/Textures/Filtering/hdrFiltering.js +6 -0
  71. package/Materials/Textures/Filtering/hdrFiltering.js.map +1 -1
  72. package/Materials/Textures/envCubeTexture.js +13 -13
  73. package/Materials/Textures/envCubeTexture.js.map +1 -1
  74. package/Materials/materialHelper.functions.js +1 -1
  75. package/Materials/materialHelper.functions.js.map +1 -1
  76. package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.d.ts +18 -4
  77. package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.js +29 -4
  78. package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.js.map +1 -1
  79. package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +48 -8
  80. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +373 -84
  81. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  82. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.d.ts +39 -4
  83. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.js +152 -47
  84. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.js.map +1 -1
  85. package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.d.ts +61 -7
  86. package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.js +94 -11
  87. package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.js.map +1 -1
  88. package/Meshes/mesh.d.ts +15 -0
  89. package/Meshes/mesh.js +40 -1
  90. package/Meshes/mesh.js.map +1 -1
  91. package/Meshes/transformNode.js +2 -2
  92. package/Meshes/transformNode.js.map +1 -1
  93. package/Misc/sceneSerializer.js +2 -1
  94. package/Misc/sceneSerializer.js.map +1 -1
  95. package/Misc/textureTools.d.ts +3 -1
  96. package/Misc/textureTools.js +74 -13
  97. package/Misc/textureTools.js.map +1 -1
  98. package/Misc/tools.js +1 -1
  99. package/Misc/tools.js.map +1 -1
  100. package/Particles/baseParticleSystem.d.ts +47 -1
  101. package/Particles/baseParticleSystem.js +88 -0
  102. package/Particles/baseParticleSystem.js.map +1 -1
  103. package/Particles/computeShaderParticleSystem.js +12 -0
  104. package/Particles/computeShaderParticleSystem.js.map +1 -1
  105. package/Particles/gpuParticleSystem.d.ts +61 -25
  106. package/Particles/gpuParticleSystem.js +249 -75
  107. package/Particles/gpuParticleSystem.js.map +1 -1
  108. package/Particles/particleSystem.d.ts +0 -6
  109. package/Particles/particleSystem.js +3 -14
  110. package/Particles/particleSystem.js.map +1 -1
  111. package/Particles/thinParticleSystem.d.ts +1 -17
  112. package/Particles/thinParticleSystem.js +1 -50
  113. package/Particles/thinParticleSystem.js.map +1 -1
  114. package/Particles/webgl2ParticleSystem.d.ts +1 -0
  115. package/Particles/webgl2ParticleSystem.js +18 -2
  116. package/Particles/webgl2ParticleSystem.js.map +1 -1
  117. package/Rendering/IBLShadows/iblShadowsAccumulationPass.js +1 -1
  118. package/Rendering/IBLShadows/iblShadowsAccumulationPass.js.map +1 -1
  119. package/Rendering/IBLShadows/iblShadowsPluginMaterial.d.ts +3 -1
  120. package/Rendering/IBLShadows/iblShadowsPluginMaterial.js +11 -1
  121. package/Rendering/IBLShadows/iblShadowsPluginMaterial.js.map +1 -1
  122. package/Rendering/IBLShadows/iblShadowsRenderPipeline.d.ts +0 -19
  123. package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +21 -65
  124. package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
  125. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.d.ts +15 -52
  126. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js +129 -220
  127. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js.map +1 -1
  128. package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.js +3 -0
  129. package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.js.map +1 -1
  130. package/Rendering/depthRenderer.js +6 -0
  131. package/Rendering/depthRenderer.js.map +1 -1
  132. package/Rendering/geometryBufferRenderer.d.ts +14 -5
  133. package/Rendering/geometryBufferRenderer.js +6 -2
  134. package/Rendering/geometryBufferRenderer.js.map +1 -1
  135. package/Rendering/geometryBufferRendererSceneComponent.d.ts +4 -6
  136. package/Rendering/geometryBufferRendererSceneComponent.js.map +1 -1
  137. package/Rendering/iblCdfGenerator.d.ts +10 -0
  138. package/Rendering/iblCdfGenerator.js +52 -17
  139. package/Rendering/iblCdfGenerator.js.map +1 -1
  140. package/Rendering/index.d.ts +0 -6
  141. package/Rendering/index.js +0 -6
  142. package/Rendering/index.js.map +1 -1
  143. package/Shaders/ShadersInclude/gaussianSplatting.js +25 -4
  144. package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -1
  145. package/Shaders/ShadersInclude/openpbrDirectLighting.js +6 -1
  146. package/Shaders/ShadersInclude/openpbrDirectLighting.js.map +1 -1
  147. package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js +1 -1
  148. package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
  149. package/Shaders/gaussianSplatting.vertex.js +3 -0
  150. package/Shaders/gaussianSplatting.vertex.js.map +1 -1
  151. package/Shaders/gpuRenderParticles.vertex.js +14 -2
  152. package/Shaders/gpuRenderParticles.vertex.js.map +1 -1
  153. package/Shaders/gpuUpdateParticles.vertex.js +24 -6
  154. package/Shaders/gpuUpdateParticles.vertex.js.map +1 -1
  155. package/Shaders/iblShadowVoxelTracing.fragment.js +5 -1
  156. package/Shaders/iblShadowVoxelTracing.fragment.js.map +1 -1
  157. package/Shaders/iblVoxelGrid.fragment.d.ts +1 -0
  158. package/Shaders/iblVoxelGrid.fragment.js +33 -5
  159. package/Shaders/iblVoxelGrid.fragment.js.map +1 -1
  160. package/Shaders/{iblVoxelSlabDebug.fragment.d.ts → lod3D.fragment.d.ts} +1 -1
  161. package/Shaders/lod3D.fragment.js +13 -0
  162. package/Shaders/lod3D.fragment.js.map +1 -0
  163. package/Shaders/openpbr.fragment.js +5 -0
  164. package/Shaders/openpbr.fragment.js.map +1 -1
  165. package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +37 -5
  166. package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -1
  167. package/ShadersWGSL/ShadersInclude/openpbrDirectLighting.js +6 -1
  168. package/ShadersWGSL/ShadersInclude/openpbrDirectLighting.js.map +1 -1
  169. package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js +1 -1
  170. package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
  171. package/ShadersWGSL/gaussianSplatting.vertex.js +3 -0
  172. package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
  173. package/ShadersWGSL/gpuUpdateParticles.compute.js +29 -8
  174. package/ShadersWGSL/gpuUpdateParticles.compute.js.map +1 -1
  175. package/ShadersWGSL/iblShadowVoxelTracing.fragment.js +5 -1
  176. package/ShadersWGSL/iblShadowVoxelTracing.fragment.js.map +1 -1
  177. package/ShadersWGSL/iblVoxelGrid.fragment.js +1 -1
  178. package/ShadersWGSL/iblVoxelGrid.fragment.js.map +1 -1
  179. package/{Shaders/iblVoxelSlabDebug.vertex.d.ts → ShadersWGSL/lod3D.fragment.d.ts} +1 -1
  180. package/ShadersWGSL/lod3D.fragment.js +13 -0
  181. package/ShadersWGSL/lod3D.fragment.js.map +1 -0
  182. package/ShadersWGSL/openpbr.fragment.js +5 -0
  183. package/ShadersWGSL/openpbr.fragment.js.map +1 -1
  184. package/package.json +1 -1
  185. package/Shaders/iblVoxelGrid3dDebug.fragment.d.ts +0 -5
  186. package/Shaders/iblVoxelGrid3dDebug.fragment.js +0 -24
  187. package/Shaders/iblVoxelGrid3dDebug.fragment.js.map +0 -1
  188. package/Shaders/iblVoxelSlabDebug.fragment.js +0 -13
  189. package/Shaders/iblVoxelSlabDebug.fragment.js.map +0 -1
  190. package/Shaders/iblVoxelSlabDebug.vertex.js +0 -11
  191. package/Shaders/iblVoxelSlabDebug.vertex.js.map +0 -1
  192. package/ShadersWGSL/iblVoxelGrid3dDebug.fragment.d.ts +0 -5
  193. package/ShadersWGSL/iblVoxelGrid3dDebug.fragment.js +0 -23
  194. package/ShadersWGSL/iblVoxelGrid3dDebug.fragment.js.map +0 -1
  195. package/ShadersWGSL/iblVoxelSlabDebug.fragment.d.ts +0 -5
  196. package/ShadersWGSL/iblVoxelSlabDebug.fragment.js +0 -14
  197. package/ShadersWGSL/iblVoxelSlabDebug.fragment.js.map +0 -1
  198. package/ShadersWGSL/iblVoxelSlabDebug.vertex.d.ts +0 -5
  199. package/ShadersWGSL/iblVoxelSlabDebug.vertex.js +0 -12
  200. package/ShadersWGSL/iblVoxelSlabDebug.vertex.js.map +0 -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
@@ -1741,6 +1832,10 @@ export class GaussianSplattingMeshBase extends Mesh {
1741
1832
  const positions = Float32Array.from(this._splatPositions);
1742
1833
  this._worker.postMessage({ positions }, [positions.buffer]);
1743
1834
  this._onWorkerCreated(this._worker);
1835
+ this._worker.onerror = () => {
1836
+ // If the worker throws an unhandled error, unlock the posting gate so the next frame can retry the sort.
1837
+ this._canPostToWorker = true;
1838
+ };
1744
1839
  this._worker.onmessage = (e) => {
1745
1840
  // Recompute vertexCountPadded in case _vertexCount has changed since the last update
1746
1841
  const vertexCountPadded = (this._vertexCount + 15) & ~0xf;
@@ -1964,12 +2059,13 @@ GaussianSplattingMeshBase._CreateWorker = function (self) {
1964
2059
  const globalWorldMatrix = e.data.worldMatrix;
1965
2060
  const cameraForward = e.data.cameraForward;
1966
2061
  const cameraPosition = e.data.cameraPosition;
1967
- const vertexCountPadded = (positions.length / 4 + 15) & ~0xf;
2062
+ depthMix = e.data.depthMix;
1968
2063
  if (!positions || !cameraForward) {
1969
- // Sanity check, it shouldn't happen!
1970
- throw new Error("positions or camera info is not defined!");
2064
+ // Sort request arrived before positions were initialized — return the buffer unchanged so the main thread can unlock _canPostToWorker.
2065
+ self.postMessage({ depthMix, cameraId }, [depthMix.buffer]);
2066
+ return;
1971
2067
  }
1972
- depthMix = e.data.depthMix;
2068
+ const vertexCountPadded = (positions.length / 4 + 15) & ~0xf;
1973
2069
  indices = new Uint32Array(depthMix.buffer);
1974
2070
  floatMix = new Float32Array(depthMix.buffer);
1975
2071
  // Sort
@@ -1986,30 +2082,39 @@ GaussianSplattingMeshBase._CreateWorker = function (self) {
1986
2082
  cameraForward[0] * m[12] + cameraForward[1] * m[13] + cameraForward[2] * m[14] - camDot,
1987
2083
  ];
1988
2084
  };
1989
- if (partMatrices && partIndices) {
1990
- // Precompute depth coefficients for each rig node
1991
- const depthCoeffs = partMatrices.map((m) => computeDepthCoeffs(m));
1992
- // NB: For performance reasons, we assume that part indices are valid
1993
- const length = partIndices.length;
1994
- for (let j = 0; j < vertexCountPadded; j++) {
1995
- // NB: We need this 'min' because vertex array is padded, not partIndices
1996
- const partIndex = partIndices[Math.min(j, length - 1)];
1997
- const coeff = depthCoeffs[partIndex];
1998
- floatMix[2 * j + 1] = coeff[0] * positions[4 * j + 0] + coeff[1] * positions[4 * j + 1] + coeff[2] * positions[4 * j + 2] + coeff[3];
1999
- // instead of using minus to sort back to front, we use bitwise not operator to invert the order of indices
2000
- // might not be faster but a minus sign implies a reference value that may not be enough and will decrease floatting precision
2001
- indices[2 * j + 1] = ~indices[2 * j + 1];
2085
+ try {
2086
+ if (partMatrices && partIndices) {
2087
+ // Precompute depth coefficients for each rig node
2088
+ const depthCoeffs = partMatrices.map((m) => computeDepthCoeffs(m));
2089
+ // NB: For performance reasons, we assume that part indices are valid
2090
+ const length = partIndices.length;
2091
+ for (let j = 0; j < vertexCountPadded; j++) {
2092
+ // NB: We need this 'min' because vertex array is padded, not partIndices
2093
+ const partIndex = partIndices[Math.min(j, length - 1)];
2094
+ const coeff = depthCoeffs[partIndex];
2095
+ floatMix[2 * j + 1] = coeff[0] * positions[4 * j + 0] + coeff[1] * positions[4 * j + 1] + coeff[2] * positions[4 * j + 2] + coeff[3];
2096
+ // instead of using minus to sort back to front, we use bitwise not operator to invert the order of indices
2097
+ // might not be faster but a minus sign implies a reference value that may not be enough and will decrease floatting precision
2098
+ indices[2 * j + 1] = ~indices[2 * j + 1];
2099
+ }
2002
2100
  }
2003
- }
2004
- else {
2005
- // Compute depth coefficients from global world matrix
2006
- const [a, b, c, d] = computeDepthCoeffs(globalWorldMatrix);
2007
- for (let j = 0; j < vertexCountPadded; j++) {
2008
- floatMix[2 * j + 1] = a * positions[4 * j + 0] + b * positions[4 * j + 1] + c * positions[4 * j + 2] + d;
2009
- indices[2 * j + 1] = ~indices[2 * j + 1];
2101
+ else {
2102
+ // Compute depth coefficients from global world matrix
2103
+ const [a, b, c, d] = computeDepthCoeffs(globalWorldMatrix);
2104
+ for (let j = 0; j < vertexCountPadded; j++) {
2105
+ floatMix[2 * j + 1] = a * positions[4 * j + 0] + b * positions[4 * j + 1] + c * positions[4 * j + 2] + d;
2106
+ indices[2 * j + 1] = ~indices[2 * j + 1];
2107
+ }
2010
2108
  }
2109
+ depthMix.sort();
2110
+ }
2111
+ catch (sortError) {
2112
+ // Transient data inconsistency (e.g. partIndices/partMatrices mismatch during addPart/removePart rebuild).
2113
+ // Return the buffer unsorted so the main thread can unlock _canPostToWorker and retry next frame.
2114
+ // Logger is unavailable inside the worker — console is the only option.
2115
+ // eslint-disable-next-line no-console
2116
+ console.error("Gaussian splat sort worker encountered an error (will retry next frame):", sortError);
2011
2117
  }
2012
- depthMix.sort();
2013
2118
  self.postMessage({ depthMix, cameraId }, [depthMix.buffer]);
2014
2119
  }
2015
2120
  };