@babylonjs/core 9.2.2 → 9.3.1

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 (76) hide show
  1. package/Engines/abstractEngine.js +2 -2
  2. package/Engines/abstractEngine.js.map +1 -1
  3. package/Engines/engine.d.ts +49 -1118
  4. package/FlowGraph/flowGraph.d.ts +11 -0
  5. package/FlowGraph/flowGraph.js +20 -0
  6. package/FlowGraph/flowGraph.js.map +1 -1
  7. package/FlowGraph/flowGraphContext.d.ts +30 -0
  8. package/FlowGraph/flowGraphContext.js +42 -0
  9. package/FlowGraph/flowGraphContext.js.map +1 -1
  10. package/FlowGraph/flowGraphParser.js +13 -0
  11. package/FlowGraph/flowGraphParser.js.map +1 -1
  12. package/FlowGraph/typeDefinitions.d.ts +16 -0
  13. package/FlowGraph/typeDefinitions.js.map +1 -1
  14. package/Layers/thinSelectionOutlineLayer.js +25 -1
  15. package/Layers/thinSelectionOutlineLayer.js.map +1 -1
  16. package/Materials/GaussianSplatting/gaussianSplattingMaterial.d.ts +18 -0
  17. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +110 -1
  18. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
  19. package/Materials/Textures/baseTexture.d.ts +1 -0
  20. package/Materials/Textures/baseTexture.js +1 -0
  21. package/Materials/Textures/baseTexture.js.map +1 -1
  22. package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +5 -1
  23. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +14 -4
  24. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  25. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.d.ts +24 -0
  26. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.js +128 -0
  27. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.js.map +1 -1
  28. package/Misc/tools.js +1 -1
  29. package/Misc/tools.js.map +1 -1
  30. package/Particles/IParticleSystem.d.ts +7 -1
  31. package/Particles/IParticleSystem.js.map +1 -1
  32. package/Particles/baseParticleSystem.d.ts +18 -2
  33. package/Particles/baseParticleSystem.js +53 -11
  34. package/Particles/baseParticleSystem.js.map +1 -1
  35. package/Particles/computeShaderParticleSystem.js +16 -0
  36. package/Particles/computeShaderParticleSystem.js.map +1 -1
  37. package/Particles/gpuParticleSystem.d.ts +14 -72
  38. package/Particles/gpuParticleSystem.js +130 -106
  39. package/Particles/gpuParticleSystem.js.map +1 -1
  40. package/Particles/particleSystem.d.ts +0 -80
  41. package/Particles/particleSystem.functions.d.ts +16 -0
  42. package/Particles/particleSystem.functions.js +18 -0
  43. package/Particles/particleSystem.functions.js.map +1 -1
  44. package/Particles/particleSystem.js +0 -114
  45. package/Particles/particleSystem.js.map +1 -1
  46. package/Particles/webgl2ParticleSystem.js +12 -0
  47. package/Particles/webgl2ParticleSystem.js.map +1 -1
  48. package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +17 -0
  49. package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
  50. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.d.ts +10 -0
  51. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js +146 -24
  52. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js.map +1 -1
  53. package/Rendering/objectRenderer.d.ts +2 -0
  54. package/Rendering/objectRenderer.js +10 -0
  55. package/Rendering/objectRenderer.js.map +1 -1
  56. package/Shaders/ShadersInclude/gaussianSplatting.js +21 -1
  57. package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -1
  58. package/Shaders/gaussianSplattingVoxel.fragment.d.ts +5 -0
  59. package/Shaders/gaussianSplattingVoxel.fragment.js +27 -0
  60. package/Shaders/gaussianSplattingVoxel.fragment.js.map +1 -0
  61. package/Shaders/gaussianSplattingVoxel.vertex.d.ts +8 -0
  62. package/Shaders/gaussianSplattingVoxel.vertex.js +31 -0
  63. package/Shaders/gaussianSplattingVoxel.vertex.js.map +1 -0
  64. package/Shaders/gpuUpdateParticles.vertex.js +13 -0
  65. package/Shaders/gpuUpdateParticles.vertex.js.map +1 -1
  66. package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +21 -1
  67. package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -1
  68. package/ShadersWGSL/gaussianSplattingVoxel.fragment.d.ts +5 -0
  69. package/ShadersWGSL/gaussianSplattingVoxel.fragment.js +22 -0
  70. package/ShadersWGSL/gaussianSplattingVoxel.fragment.js.map +1 -0
  71. package/ShadersWGSL/gaussianSplattingVoxel.vertex.d.ts +8 -0
  72. package/ShadersWGSL/gaussianSplattingVoxel.vertex.js +42 -0
  73. package/ShadersWGSL/gaussianSplattingVoxel.vertex.js.map +1 -0
  74. package/ShadersWGSL/gpuUpdateParticles.compute.js +19 -0
  75. package/ShadersWGSL/gpuUpdateParticles.compute.js.map +1 -1
  76. package/package.json +1 -1
@@ -282,6 +282,45 @@ export class GaussianSplattingMeshBase extends Mesh {
282
282
  get colorsTexture() {
283
283
  return this._colorsTexture;
284
284
  }
285
+ /**
286
+ * Gets the rotation matrix A texture (rotation elements m[0],m[1],m[2],m[4])
287
+ */
288
+ get rotationsATexture() {
289
+ return this._rotationsATexture;
290
+ }
291
+ /**
292
+ * Gets the rotation matrix B texture (rotation elements m[5],m[6],m[8],m[9])
293
+ */
294
+ get rotationsBTexture() {
295
+ return this._rotationsBTexture;
296
+ }
297
+ /**
298
+ * Gets the rotation scale texture (rotation element m[10] followed by scale diagonal sx,sy,sz)
299
+ */
300
+ get rotationScaleTexture() {
301
+ return this._rotationScaleTexture;
302
+ }
303
+ /**
304
+ * Enables or disables generation of rotation and scale matrix textures, required for voxel-based IBL shadows.
305
+ */
306
+ get needsRotationScaleTextures() {
307
+ return this._needsRotationScaleTextures;
308
+ }
309
+ set needsRotationScaleTextures(value) {
310
+ if (this._needsRotationScaleTextures === value) {
311
+ return;
312
+ }
313
+ this._needsRotationScaleTextures = value;
314
+ if (value && this._covariancesATexture) {
315
+ if (this._splatsData) {
316
+ this.updateData(this._splatsData, this._shData ?? undefined, { flipY: false });
317
+ }
318
+ else {
319
+ Logger.Error("GaussianSplattingMeshBase: needsRotationScaleTextures was enabled after the mesh was already loaded, but the splat data is not kept in RAM. " +
320
+ "The rotation and scale matrix textures cannot be initialized. Please reload the mesh data via updateData() or construct with keepInRam=true.");
321
+ }
322
+ }
323
+ }
285
324
  /**
286
325
  * Gets the SH textures
287
326
  */
@@ -358,6 +397,13 @@ export class GaussianSplattingMeshBase extends Mesh {
358
397
  this._covariancesBTexture = null;
359
398
  this._centersTexture = null;
360
399
  this._colorsTexture = null;
400
+ this._rotationsATexture = null;
401
+ this._rotationsBTexture = null;
402
+ this._rotationScaleTexture = null;
403
+ this._rotationDataA = null;
404
+ this._rotationDataB = null;
405
+ this._rotationScaleData = null;
406
+ this._needsRotationScaleTextures = false;
361
407
  this._splatPositions = null;
362
408
  this._splatIndex = null;
363
409
  this._shTextures = null;
@@ -1355,6 +1401,15 @@ export class GaussianSplattingMeshBase extends Mesh {
1355
1401
  shTexture.dispose();
1356
1402
  }
1357
1403
  }
1404
+ this._rotationsATexture?.dispose();
1405
+ this._rotationsBTexture?.dispose();
1406
+ this._rotationScaleTexture?.dispose();
1407
+ this._rotationsATexture = null;
1408
+ this._rotationsBTexture = null;
1409
+ this._rotationScaleTexture = null;
1410
+ this._rotationDataA = null;
1411
+ this._rotationDataB = null;
1412
+ this._rotationScaleData = null;
1358
1413
  this._covariancesATexture = null;
1359
1414
  this._covariancesBTexture = null;
1360
1415
  this._centersTexture = null;
@@ -1384,6 +1439,11 @@ export class GaussianSplattingMeshBase extends Mesh {
1384
1439
  this._shTextures?.push(shTexture.clone());
1385
1440
  }
1386
1441
  }
1442
+ if (source._rotationsATexture) {
1443
+ this._rotationsATexture = source._rotationsATexture.clone();
1444
+ this._rotationsBTexture = source._rotationsBTexture?.clone();
1445
+ this._rotationScaleTexture = source._rotationScaleTexture?.clone();
1446
+ }
1387
1447
  }
1388
1448
  /**
1389
1449
  * Returns a new Mesh object generated from the current mesh properties.
@@ -1452,6 +1512,30 @@ export class GaussianSplattingMeshBase extends Mesh {
1452
1512
  quaternion.normalize();
1453
1513
  quaternion.toRotationMatrix(matrixRotation);
1454
1514
  Matrix.ScalingToRef(fBuffer[8 * srcIndex + 3 + 0] * 2, fBuffer[8 * srcIndex + 3 + 1] * 2, fBuffer[8 * srcIndex + 3 + 2] * 2, matrixScale);
1515
+ if (this._needsRotationScaleTextures) {
1516
+ if (!this._rotationDataA || this._rotationDataA.length < covA.length) {
1517
+ this._rotationDataA = new Uint16Array(covA.length);
1518
+ this._rotationDataB = new Uint16Array(covA.length);
1519
+ this._rotationScaleData = new Uint16Array(covA.length);
1520
+ }
1521
+ const rotDataA = this._rotationDataA;
1522
+ const rotDataB = this._rotationDataB;
1523
+ const rotScaleData = this._rotationScaleData;
1524
+ const rm = matrixRotation.m;
1525
+ const sm = matrixScale.m;
1526
+ rotDataA[dstIndex * 4 + 0] = ToHalfFloat(rm[0]);
1527
+ rotDataA[dstIndex * 4 + 1] = ToHalfFloat(rm[1]);
1528
+ rotDataA[dstIndex * 4 + 2] = ToHalfFloat(rm[2]);
1529
+ rotDataA[dstIndex * 4 + 3] = ToHalfFloat(rm[4]);
1530
+ rotDataB[dstIndex * 4 + 0] = ToHalfFloat(rm[5]);
1531
+ rotDataB[dstIndex * 4 + 1] = ToHalfFloat(rm[6]);
1532
+ rotDataB[dstIndex * 4 + 2] = ToHalfFloat(rm[8]);
1533
+ rotDataB[dstIndex * 4 + 3] = ToHalfFloat(rm[9]);
1534
+ rotScaleData[dstIndex * 4 + 0] = ToHalfFloat(rm[10]);
1535
+ rotScaleData[dstIndex * 4 + 1] = ToHalfFloat(sm[0]);
1536
+ rotScaleData[dstIndex * 4 + 2] = ToHalfFloat(sm[5]);
1537
+ rotScaleData[dstIndex * 4 + 3] = ToHalfFloat(sm[10]);
1538
+ }
1455
1539
  const m = matrixRotation.multiplyToRef(matrixScale, TmpVectors.Matrix[0]).m;
1456
1540
  const covariances = this._tmpCovariances;
1457
1541
  covariances[0] = m[0] * m[0] + m[1] * m[1] + m[2] * m[2];
@@ -1544,6 +1628,25 @@ export class GaussianSplattingMeshBase extends Mesh {
1544
1628
  this._shTextures.push(shTexture);
1545
1629
  }
1546
1630
  }
1631
+ if (this._needsRotationScaleTextures && this._rotationDataA) {
1632
+ if (this._rotationsATexture) {
1633
+ this._updateTextureFromData(this._rotationsATexture, this._rotationDataA, textureSize.x, 0, textureSize.y);
1634
+ this._updateTextureFromData(this._rotationsBTexture, this._rotationDataB, textureSize.x, 0, textureSize.y);
1635
+ this._updateTextureFromData(this._rotationScaleTexture, this._rotationScaleData, textureSize.x, 0, textureSize.y);
1636
+ }
1637
+ else {
1638
+ // Rotation textures not yet created (needsRotationScaleTextures was enabled after initial load).
1639
+ this._rotationsATexture = createTextureFromDataF16(this._rotationDataA, textureSize.x, textureSize.y, 5);
1640
+ this._rotationsBTexture = createTextureFromDataF16(this._rotationDataB, textureSize.x, textureSize.y, 5);
1641
+ this._rotationScaleTexture = createTextureFromDataF16(this._rotationScaleData, textureSize.x, textureSize.y, 5);
1642
+ this._rotationsATexture.wrapU = 0;
1643
+ this._rotationsATexture.wrapV = 0;
1644
+ this._rotationsBTexture.wrapU = 0;
1645
+ this._rotationsBTexture.wrapV = 0;
1646
+ this._rotationScaleTexture.wrapU = 0;
1647
+ this._rotationScaleTexture.wrapV = 0;
1648
+ }
1649
+ }
1547
1650
  this._onUpdateTextures(textureSize);
1548
1651
  this._postToWorker(true);
1549
1652
  }
@@ -1563,6 +1666,23 @@ export class GaussianSplattingMeshBase extends Mesh {
1563
1666
  this._shTextures.push(shTexture);
1564
1667
  }
1565
1668
  }
1669
+ if (this._needsRotationScaleTextures) {
1670
+ const rotDataA = this._rotationDataA ?? new Uint16Array(covA.length);
1671
+ const rotDataB = this._rotationDataB ?? new Uint16Array(covA.length);
1672
+ const rotScaleData = this._rotationScaleData ?? new Uint16Array(covA.length);
1673
+ this._rotationsATexture?.dispose();
1674
+ this._rotationsBTexture?.dispose();
1675
+ this._rotationScaleTexture?.dispose();
1676
+ this._rotationsATexture = createTextureFromDataF16(rotDataA, textureSize.x, textureSize.y, 5);
1677
+ this._rotationsBTexture = createTextureFromDataF16(rotDataB, textureSize.x, textureSize.y, 5);
1678
+ this._rotationScaleTexture = createTextureFromDataF16(rotScaleData, textureSize.x, textureSize.y, 5);
1679
+ this._rotationsATexture.wrapU = 0;
1680
+ this._rotationsATexture.wrapV = 0;
1681
+ this._rotationsBTexture.wrapU = 0;
1682
+ this._rotationsBTexture.wrapV = 0;
1683
+ this._rotationScaleTexture.wrapU = 0;
1684
+ this._rotationScaleTexture.wrapV = 0;
1685
+ }
1566
1686
  this._onUpdateTextures(textureSize);
1567
1687
  if (firstTime) {
1568
1688
  this._instantiateWorker();
@@ -1800,6 +1920,14 @@ export class GaussianSplattingMeshBase extends Mesh {
1800
1920
  this._updateTextureFromData(this._covariancesBTexture, covBView, textureSize.x, lineStart, lineCount);
1801
1921
  this._updateTextureFromData(this._centersTexture, centersView, textureSize.x, lineStart, lineCount);
1802
1922
  this._updateTextureFromData(this._colorsTexture, colorsView, textureSize.x, lineStart, lineCount);
1923
+ if (this._rotationsATexture && this._rotationDataA) {
1924
+ const rotAView = new Uint16Array(this._rotationDataA.buffer, texelStart * 4 * Uint16Array.BYTES_PER_ELEMENT, texelCount * 4);
1925
+ const rotBView = new Uint16Array(this._rotationDataB.buffer, texelStart * 4 * Uint16Array.BYTES_PER_ELEMENT, texelCount * 4);
1926
+ const rotScaleView = new Uint16Array(this._rotationScaleData.buffer, texelStart * 4 * Uint16Array.BYTES_PER_ELEMENT, texelCount * 4);
1927
+ this._updateTextureFromData(this._rotationsATexture, rotAView, textureSize.x, lineStart, lineCount);
1928
+ this._updateTextureFromData(this._rotationsBTexture, rotBView, textureSize.x, lineStart, lineCount);
1929
+ this._updateTextureFromData(this._rotationScaleTexture, rotScaleView, textureSize.x, lineStart, lineCount);
1930
+ }
1803
1931
  if (sh) {
1804
1932
  for (let i = 0; i < sh.length; i++) {
1805
1933
  const componentCount = 4;