@babylonjs/core 8.12.1 → 8.13.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 (159) hide show
  1. package/AudioV2/abstractAudio/abstractAudioBus.d.ts +4 -21
  2. package/AudioV2/abstractAudio/abstractAudioBus.js +2 -34
  3. package/AudioV2/abstractAudio/abstractAudioBus.js.map +1 -1
  4. package/AudioV2/abstractAudio/abstractAudioOutNode.d.ts +40 -0
  5. package/AudioV2/abstractAudio/abstractAudioOutNode.js +56 -0
  6. package/AudioV2/abstractAudio/abstractAudioOutNode.js.map +1 -0
  7. package/AudioV2/abstractAudio/abstractSoundSource.d.ts +5 -16
  8. package/AudioV2/abstractAudio/abstractSoundSource.js +2 -27
  9. package/AudioV2/abstractAudio/abstractSoundSource.js.map +1 -1
  10. package/AudioV2/abstractAudio/audioEngineV2.d.ts +13 -0
  11. package/AudioV2/abstractAudio/audioEngineV2.js +4 -0
  12. package/AudioV2/abstractAudio/audioEngineV2.js.map +1 -1
  13. package/AudioV2/abstractAudio/index.d.ts +1 -0
  14. package/AudioV2/abstractAudio/index.js +1 -0
  15. package/AudioV2/abstractAudio/index.js.map +1 -1
  16. package/AudioV2/abstractAudio/subNodes/volumeAudioSubNode.d.ts +3 -0
  17. package/AudioV2/abstractAudio/subNodes/volumeAudioSubNode.js.map +1 -1
  18. package/AudioV2/audioParameter.d.ts +31 -0
  19. package/AudioV2/audioParameter.js +19 -0
  20. package/AudioV2/audioParameter.js.map +1 -0
  21. package/AudioV2/audioUtils.d.ts +3 -0
  22. package/AudioV2/audioUtils.js +61 -0
  23. package/AudioV2/audioUtils.js.map +1 -1
  24. package/AudioV2/index.d.ts +1 -0
  25. package/AudioV2/index.js +1 -0
  26. package/AudioV2/index.js.map +1 -1
  27. package/AudioV2/webAudio/components/webAudioParameterComponent.d.ts +37 -0
  28. package/AudioV2/webAudio/components/webAudioParameterComponent.js +89 -0
  29. package/AudioV2/webAudio/components/webAudioParameterComponent.js.map +1 -0
  30. package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.d.ts +8 -0
  31. package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.js +24 -6
  32. package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.js.map +1 -1
  33. package/AudioV2/webAudio/subNodes/stereoWebAudioSubNode.d.ts +2 -0
  34. package/AudioV2/webAudio/subNodes/stereoWebAudioSubNode.js +9 -4
  35. package/AudioV2/webAudio/subNodes/stereoWebAudioSubNode.js.map +1 -1
  36. package/AudioV2/webAudio/subNodes/volumeWebAudioSubNode.d.ts +7 -1
  37. package/AudioV2/webAudio/subNodes/volumeWebAudioSubNode.js +14 -5
  38. package/AudioV2/webAudio/subNodes/volumeWebAudioSubNode.js.map +1 -1
  39. package/AudioV2/webAudio/subProperties/spatialWebAudioListener.js +92 -30
  40. package/AudioV2/webAudio/subProperties/spatialWebAudioListener.js.map +1 -1
  41. package/AudioV2/webAudio/webAudioEngine.d.ts +4 -2
  42. package/AudioV2/webAudio/webAudioEngine.js +9 -4
  43. package/AudioV2/webAudio/webAudioEngine.js.map +1 -1
  44. package/AudioV2/webAudio/webAudioMainOut.d.ts +6 -2
  45. package/AudioV2/webAudio/webAudioMainOut.js +15 -10
  46. package/AudioV2/webAudio/webAudioMainOut.js.map +1 -1
  47. package/AudioV2/webAudio/webAudioStaticSound.d.ts +4 -2
  48. package/AudioV2/webAudio/webAudioStaticSound.js +17 -14
  49. package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -1
  50. package/BakedVertexAnimation/vertexAnimationBaker.d.ts +10 -2
  51. package/BakedVertexAnimation/vertexAnimationBaker.js +48 -2
  52. package/BakedVertexAnimation/vertexAnimationBaker.js.map +1 -1
  53. package/Behaviors/Meshes/pointerDragBehavior.d.ts +5 -0
  54. package/Behaviors/Meshes/pointerDragBehavior.js +7 -1
  55. package/Behaviors/Meshes/pointerDragBehavior.js.map +1 -1
  56. package/Cameras/camera.d.ts +6 -0
  57. package/Cameras/camera.js +8 -0
  58. package/Cameras/camera.js.map +1 -1
  59. package/Engines/abstractEngine.js +2 -2
  60. package/Engines/abstractEngine.js.map +1 -1
  61. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.d.ts +1 -1
  62. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.js +27 -18
  63. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.js.map +1 -1
  64. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.d.ts +55 -3
  65. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.js +83 -2
  66. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.js.map +1 -1
  67. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js.map +1 -1
  68. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js.map +1 -1
  69. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.js.map +1 -1
  70. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js.map +1 -1
  71. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.js.map +1 -1
  72. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.d.ts +1 -0
  73. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js +23 -2
  74. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js.map +1 -1
  75. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js +5 -5
  76. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js.map +1 -1
  77. package/FlowGraph/Blocks/flowGraphBlockFactory.js +10 -0
  78. package/FlowGraph/Blocks/flowGraphBlockFactory.js.map +1 -1
  79. package/FlowGraph/Blocks/flowGraphBlockNames.d.ts +5 -0
  80. package/FlowGraph/Blocks/flowGraphBlockNames.js +5 -0
  81. package/FlowGraph/Blocks/flowGraphBlockNames.js.map +1 -1
  82. package/FlowGraph/flowGraphRichTypes.js +10 -8
  83. package/FlowGraph/flowGraphRichTypes.js.map +1 -1
  84. package/FlowGraph/utils.d.ts +3 -3
  85. package/FlowGraph/utils.js +5 -4
  86. package/FlowGraph/utils.js.map +1 -1
  87. package/Gizmos/boundingBoxGizmo.d.ts +6 -0
  88. package/Gizmos/boundingBoxGizmo.js +16 -1
  89. package/Gizmos/boundingBoxGizmo.js.map +1 -1
  90. package/Instrumentation/engineInstrumentation.d.ts +2 -2
  91. package/Instrumentation/engineInstrumentation.js +5 -0
  92. package/Instrumentation/engineInstrumentation.js.map +1 -1
  93. package/Instrumentation/sceneInstrumentation.d.ts +1 -0
  94. package/Instrumentation/sceneInstrumentation.js +5 -0
  95. package/Instrumentation/sceneInstrumentation.js.map +1 -1
  96. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +2 -0
  97. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
  98. package/Materials/Node/Blocks/Dual/smartFilterTextureBlock.d.ts +2 -5
  99. package/Materials/Node/Blocks/Dual/smartFilterTextureBlock.js +8 -71
  100. package/Materials/Node/Blocks/Dual/smartFilterTextureBlock.js.map +1 -1
  101. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.d.ts +2 -0
  102. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +7 -8
  103. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
  104. package/Materials/Node/Blocks/Fragment/index.d.ts +1 -0
  105. package/Materials/Node/Blocks/Fragment/index.js +1 -0
  106. package/Materials/Node/Blocks/Fragment/index.js.map +1 -1
  107. package/Materials/Node/Blocks/Fragment/smartFilterFragmentOutputBlock.d.ts +29 -0
  108. package/Materials/Node/Blocks/Fragment/smartFilterFragmentOutputBlock.js +100 -0
  109. package/Materials/Node/Blocks/Fragment/smartFilterFragmentOutputBlock.js.map +1 -0
  110. package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js +3 -1
  111. package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js.map +1 -1
  112. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +1 -0
  113. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  114. package/Materials/Node/Blocks/PBR/subSurfaceBlock.js +5 -5
  115. package/Materials/Node/Blocks/PBR/subSurfaceBlock.js.map +1 -1
  116. package/Materials/Node/nodeMaterial.js +1 -1
  117. package/Materials/Node/nodeMaterial.js.map +1 -1
  118. package/Materials/Node/nodeMaterialBuildState.d.ts +0 -2
  119. package/Materials/Node/nodeMaterialBuildState.js +0 -2
  120. package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
  121. package/Materials/Node/nodeMaterialDefault.js +2 -1
  122. package/Materials/Node/nodeMaterialDefault.js.map +1 -1
  123. package/Materials/PBR/pbrSubSurfaceConfiguration.d.ts +10 -3
  124. package/Materials/PBR/pbrSubSurfaceConfiguration.js +16 -5
  125. package/Materials/PBR/pbrSubSurfaceConfiguration.js.map +1 -1
  126. package/Maths/math.vector.d.ts +14 -0
  127. package/Maths/math.vector.functions.d.ts +25 -1
  128. package/Maths/math.vector.functions.js +35 -0
  129. package/Maths/math.vector.functions.js.map +1 -1
  130. package/Maths/math.vector.js +28 -0
  131. package/Maths/math.vector.js.map +1 -1
  132. package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +6 -0
  133. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +11 -4
  134. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  135. package/Meshes/csg2.js +1 -1
  136. package/Meshes/csg2.js.map +1 -1
  137. package/Meshes/linesMesh.d.ts +4 -12
  138. package/Meshes/linesMesh.js +15 -24
  139. package/Meshes/linesMesh.js.map +1 -1
  140. package/Misc/environmentTextureTools.d.ts +4 -1
  141. package/Misc/environmentTextureTools.js +9 -2
  142. package/Misc/environmentTextureTools.js.map +1 -1
  143. package/Morph/morphTargetManager.d.ts +5 -0
  144. package/Morph/morphTargetManager.js +8 -0
  145. package/Morph/morphTargetManager.js.map +1 -1
  146. package/Particles/Node/Blocks/particleDebugBlock.d.ts +6 -0
  147. package/Particles/Node/Blocks/particleDebugBlock.js +10 -0
  148. package/Particles/Node/Blocks/particleDebugBlock.js.map +1 -1
  149. package/Shaders/ShadersInclude/hdrFilteringFunctions.js +16 -2
  150. package/Shaders/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
  151. package/Shaders/gaussianSplatting.vertex.js +2 -3
  152. package/Shaders/gaussianSplatting.vertex.js.map +1 -1
  153. package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js +17 -2
  154. package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
  155. package/ShadersWGSL/gaussianSplatting.vertex.js +2 -3
  156. package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
  157. package/XR/features/WebXRControllerPointerSelection.js +3 -3
  158. package/XR/features/WebXRControllerPointerSelection.js.map +1 -1
  159. package/package.json +1 -1
@@ -4,6 +4,7 @@ import { Vector2ToFixed, Vector3ToFixed } from "../../../Maths/math.vector.funct
4
4
  import { RegisterClass } from "../../../Misc/typeStore.js";
5
5
  import { NodeParticleBlockConnectionPointTypes } from "../Enums/nodeParticleBlockConnectionPointTypes.js";
6
6
  import { NodeParticleBlock } from "../nodeParticleBlock.js";
7
+ import { Observable } from "../../../Misc/observable.js";
7
8
  /**
8
9
  * Defines a block used to debug values going through it
9
10
  */
@@ -22,6 +23,10 @@ export class ParticleDebugBlock extends NodeParticleBlock {
22
23
  * Gets or sets the number of logs to keep
23
24
  */
24
25
  this.stackSize = 10;
26
+ /**
27
+ * Observable raised when data is collected
28
+ */
29
+ this.onDataCollectedObservable = new Observable(undefined, true);
25
30
  this._isDebug = true;
26
31
  this.registerInput("input", NodeParticleBlockConnectionPointTypes.AutoDetect);
27
32
  this.registerOutput("output", NodeParticleBlockConnectionPointTypes.BasedOnInput);
@@ -83,6 +88,7 @@ export class ParticleDebugBlock extends NodeParticleBlock {
83
88
  this.log.push([input.toString(), input.toString()]);
84
89
  break;
85
90
  }
91
+ this.onDataCollectedObservable.notifyObservers(this);
86
92
  return input;
87
93
  };
88
94
  if (this.output.isConnected) {
@@ -101,6 +107,10 @@ export class ParticleDebugBlock extends NodeParticleBlock {
101
107
  super._deserialize(serializationObject);
102
108
  this.stackSize = serializationObject.stackSize;
103
109
  }
110
+ dispose() {
111
+ this.onDataCollectedObservable.clear();
112
+ super.dispose();
113
+ }
104
114
  }
105
115
  __decorate([
106
116
  editableInPropertyPage("Reference", 2 /* PropertyTypeForEdition.Int */, "ADVANCED", { embedded: false, notifiers: { rebuild: true }, min: 1, max: 100 })
@@ -1 +1 @@
1
- {"version":3,"file":"particleDebugBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/particleDebugBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,sBAAsB,EAA0B,6CAAsC;AAC/F,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AACvG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAIzD;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,iBAAiB;IAYrD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAhBhB;;WAEG;QACI,QAAG,GAAe,EAAE,CAAC;QAE5B;;WAEG;QAEI,cAAS,GAAG,EAAE,CAAC;QASlB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QAErB,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,qCAAqC,CAAC,UAAU,CAAC,CAAC;QAC9E,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,qCAAqC,CAAC,YAAY,CAAC,CAAC;QAElF,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CA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AC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;oBAC3I,MAAM;gBACV;oBACI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;oBACpD,MAAM;YACd,CAAC;YAED,OAAO,KAAK,CAAC;QACjB,CAAC,CAAC;QAEF,IAAI,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;YAC1B,IAAI,CAAC,MAAM,CAAC,eAAe,GAAG,IAAI,CAAC;QACvC,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3C,CAAC;IACL,CAAC;IAEe,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAE/C,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,SAAS,GAAG,mBAAmB,CAAC,SAAS,CAAC;IACnD,CAAC;CACJ;AAxGU;IADN,sBAAsB,CAAC,WAAW,sCAA8B,UAAU,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;qDAC3H;AA0G1B,aAAa,CAAC,4BAA4B,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import { editableInPropertyPage, PropertyTypeForEdition } from \"core/Decorators/nodeDecorator\";\r\nimport { Vector2ToFixed, Vector3ToFixed } from \"../../../Maths/math.vector.functions\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleBlock } from \"../nodeParticleBlock\";\r\nimport type { NodeParticleConnectionPoint } from \"../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../nodeParticleBuildState\";\r\n\r\n/**\r\n * Defines a block used to debug values going through it\r\n */\r\nexport class ParticleDebugBlock extends NodeParticleBlock {\r\n /**\r\n * Gets the log entries\r\n */\r\n public log: string[][] = [];\r\n\r\n /**\r\n * Gets or sets the number of logs to keep\r\n */\r\n @editableInPropertyPage(\"Reference\", PropertyTypeForEdition.Int, \"ADVANCED\", { embedded: false, notifiers: { rebuild: true }, min: 1, max: 100 })\r\n public stackSize = 10;\r\n\r\n /**\r\n * Create a new ParticleDebugBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this._isDebug = true;\r\n\r\n this.registerInput(\"input\", NodeParticleBlockConnectionPointTypes.AutoDetect);\r\n this.registerOutput(\"output\", NodeParticleBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.FloatGradient);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Vector2Gradient);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Vector3Gradient);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Color4Gradient);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.System);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Particle);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Texture);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"ParticleDebugBlock\";\r\n }\r\n\r\n /**\r\n * Gets the input component\r\n */\r\n public get input(): NodeParticleConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n public override _build(state: NodeParticleBuildState) {\r\n if (!this.input.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n this.log = [];\r\n const func = (state: NodeParticleBuildState) => {\r\n const input = this.input.getConnectedValue(state);\r\n\r\n if (this.log.length >= this.stackSize) {\r\n return input;\r\n }\r\n\r\n if (input === null || input === undefined) {\r\n this.log.push([\"null\", \"\"]);\r\n return input;\r\n }\r\n\r\n switch (this.input.type) {\r\n case NodeParticleBlockConnectionPointTypes.Vector2:\r\n this.log.push([Vector2ToFixed(input, 4), input.toString()]);\r\n break;\r\n case NodeParticleBlockConnectionPointTypes.Vector3:\r\n this.log.push([Vector3ToFixed(input, 4), input.toString()]);\r\n break;\r\n case NodeParticleBlockConnectionPointTypes.Color4:\r\n this.log.push([`{R: ${input.r.toFixed(4)} G: ${input.g.toFixed(4)} B: ${input.b.toFixed(4)} A: ${input.a.toFixed(4)}}`, input.toString()]);\r\n break;\r\n default:\r\n this.log.push([input.toString(), input.toString()]);\r\n break;\r\n }\r\n\r\n return input;\r\n };\r\n\r\n if (this.output.isConnected) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedValue = func(state);\r\n }\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.stackSize = this.stackSize;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.stackSize = serializationObject.stackSize;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ParticleDebugBlock\", ParticleDebugBlock);\r\n"]}
1
+ {"version":3,"file":"particle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C,CAAC;YAErD,OAAO,KAAK,CAAC;QACjB,CAAC,CAAC;QAEF,IAAI,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;YAC1B,IAAI,CAAC,MAAM,CAAC,eAAe,GAAG,IAAI,CAAC;QACvC,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3C,CAAC;IACL,CAAC;IAEe,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAE/C,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,SAAS,GAAG,mBAAmB,CAAC,SAAS,CAAC;IACnD,CAAC;IAEe,OAAO;QACnB,IAAI,CAAC,yBAAyB,CAAC,KAAK,EAAE,CAAC;QACvC,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;CACJ;AApHU;IADN,sBAAsB,CAAC,WAAW,sCAA8B,UAAU,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;qDAC3H;AAsH1B,aAAa,CAAC,4BAA4B,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import { editableInPropertyPage, PropertyTypeForEdition } from \"core/Decorators/nodeDecorator\";\r\nimport { Vector2ToFixed, Vector3ToFixed } from \"../../../Maths/math.vector.functions\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleBlock } from \"../nodeParticleBlock\";\r\nimport type { NodeParticleConnectionPoint } from \"../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../nodeParticleBuildState\";\r\nimport { Observable } from \"core/Misc/observable\";\r\n\r\n/**\r\n * Defines a block used to debug values going through it\r\n */\r\nexport class ParticleDebugBlock extends NodeParticleBlock {\r\n /**\r\n * Gets the log entries\r\n */\r\n public log: string[][] = [];\r\n\r\n /**\r\n * Gets or sets the number of logs to keep\r\n */\r\n @editableInPropertyPage(\"Reference\", PropertyTypeForEdition.Int, \"ADVANCED\", { embedded: false, notifiers: { rebuild: true }, min: 1, max: 100 })\r\n public stackSize = 10;\r\n\r\n /**\r\n * Create a new ParticleDebugBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this._isDebug = true;\r\n\r\n this.registerInput(\"input\", NodeParticleBlockConnectionPointTypes.AutoDetect);\r\n this.registerOutput(\"output\", NodeParticleBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.FloatGradient);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Vector2Gradient);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Vector3Gradient);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Color4Gradient);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.System);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Particle);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Texture);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"ParticleDebugBlock\";\r\n }\r\n\r\n /**\r\n * Gets the input component\r\n */\r\n public get input(): NodeParticleConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Observable raised when data is collected\r\n */\r\n public onDataCollectedObservable = new Observable<ParticleDebugBlock>(undefined, true);\r\n\r\n public override _build(state: NodeParticleBuildState) {\r\n if (!this.input.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n this.log = [];\r\n const func = (state: NodeParticleBuildState) => {\r\n const input = this.input.getConnectedValue(state);\r\n\r\n if (this.log.length >= this.stackSize) {\r\n return input;\r\n }\r\n\r\n if (input === null || input === undefined) {\r\n this.log.push([\"null\", \"\"]);\r\n return input;\r\n }\r\n\r\n switch (this.input.type) {\r\n case NodeParticleBlockConnectionPointTypes.Vector2:\r\n this.log.push([Vector2ToFixed(input, 4), input.toString()]);\r\n break;\r\n case NodeParticleBlockConnectionPointTypes.Vector3:\r\n this.log.push([Vector3ToFixed(input, 4), input.toString()]);\r\n break;\r\n case NodeParticleBlockConnectionPointTypes.Color4:\r\n this.log.push([`{R: ${input.r.toFixed(4)} G: ${input.g.toFixed(4)} B: ${input.b.toFixed(4)} A: ${input.a.toFixed(4)}}`, input.toString()]);\r\n break;\r\n default:\r\n this.log.push([input.toString(), input.toString()]);\r\n break;\r\n }\r\n\r\n this.onDataCollectedObservable.notifyObservers(this);\r\n\r\n return input;\r\n };\r\n\r\n if (this.output.isConnected) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedValue = func(state);\r\n }\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.stackSize = this.stackSize;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.stackSize = serializationObject.stackSize;\r\n }\r\n\r\n public override dispose(): void {\r\n this.onDataCollectedObservable.clear();\r\n super.dispose();\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ParticleDebugBlock\", ParticleDebugBlock);\r\n"]}
@@ -21,7 +21,16 @@ float log4(float x) {return log2(x)/2.;}
21
21
  vec3 uv_to_normal(vec2 uv) {vec3 N;vec2 uvRange=uv;float theta=uvRange.x*2.*PI;float phi=uvRange.y*PI;float sinPhi=sin(phi);N.x=cos(theta)*sinPhi;N.z=sin(theta)*sinPhi;N.y=cos(phi);return N;}
22
22
  const float NUM_SAMPLES_FLOAT=float(NUM_SAMPLES);const float NUM_SAMPLES_FLOAT_INVERSED=1./NUM_SAMPLES_FLOAT;const float K=4.;
23
23
  #define inline
24
- vec3 irradiance(samplerCube inputTexture,vec3 inputN,vec2 filteringInfo,float diffuseRoughness,vec3 surfaceAlbedo,vec3 inputV
24
+ vec3 irradiance(
25
+ #ifdef CUSTOM_IRRADIANCE_FILTERING_INPUT
26
+ CUSTOM_IRRADIANCE_FILTERING_INPUT
27
+ #else
28
+ samplerCube inputTexture,
29
+ #endif
30
+ vec3 inputN,vec2 filteringInfo,
31
+ float diffuseRoughness,
32
+ vec3 surfaceAlbedo,
33
+ vec3 inputV
25
34
  #if IBL_CDF_FILTERING
26
35
  ,sampler2D icdfSampler
27
36
  #endif
@@ -57,7 +66,12 @@ if (NoL>0.) {
57
66
  #if IBL_CDF_FILTERING
58
67
  float pdf=texture2D(icdfSampler,T).z;vec3 c=textureCubeLodEXT(inputTexture,Ls,0.).rgb;
59
68
  #else
60
- float pdf_inversed=PI/NoL;float omegaS=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;float l=log4(omegaS)-log4(omegaP)+log4(K);float mipLevel=clamp(l,0.,maxLevel);vec3 c=textureCubeLodEXT(inputTexture,tbn*Ls,mipLevel).rgb;
69
+ float pdf_inversed=PI/NoL;float omegaS=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;float l=log4(omegaS)-log4(omegaP)+log4(K);float mipLevel=clamp(l,0.,maxLevel);
70
+ #ifdef CUSTOM_IRRADIANCE_FILTERING_FUNCTION
71
+ CUSTOM_IRRADIANCE_FILTERING_FUNCTION
72
+ #else
73
+ vec3 c=textureCubeLodEXT(inputTexture,tbn*Ls,mipLevel).rgb;
74
+ #endif
61
75
  #endif
62
76
  #if GAMMA_INPUT
63
77
  c=toLinearSpace(c);
@@ -1 +1 @@
1
- {"version":3,"file":"hdrFilteringFunctions.js","sourceRoot":"","sources":["../../../../../dev/core/src/Shaders/ShadersInclude/hdrFilteringFunctions.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,IAAI,GAAG,uBAAuB,CAAC;AACrC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmGd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC;IAC1C,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACpD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\n\nconst name = \"hdrFilteringFunctions\";\nconst shader = `#if NUM_SAMPLES\n#if NUM_SAMPLES>0\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\nfloat radicalInverse_VdC(uint bits) \n{bits=(bits<<16u) | (bits>>16u);bits=((bits & 0x55555555u)<<1u) | ((bits & 0xAAAAAAAAu)>>1u);bits=((bits & 0x33333333u)<<2u) | ((bits & 0xCCCCCCCCu)>>2u);bits=((bits & 0x0F0F0F0Fu)<<4u) | ((bits & 0xF0F0F0F0u)>>4u);bits=((bits & 0x00FF00FFu)<<8u) | ((bits & 0xFF00FF00u)>>8u);return float(bits)*2.3283064365386963e-10; }\nvec2 hammersley(uint i,uint N)\n{return vec2(float(i)/float(N),radicalInverse_VdC(i));}\n#else\nfloat vanDerCorpus(int n,int base)\n{float invBase=1.0/float(base);float denom =1.0;float result =0.0;for(int i=0; i<32; ++i)\n{if(n>0)\n{denom =mod(float(n),2.0);result+=denom*invBase;invBase=invBase/2.0;n =int(float(n)/2.0);}}\nreturn result;}\nvec2 hammersley(int i,int N)\n{return vec2(float(i)/float(N),vanDerCorpus(i,2));}\n#endif\nfloat log4(float x) {return log2(x)/2.;}\nvec3 uv_to_normal(vec2 uv) {vec3 N;vec2 uvRange=uv;float theta=uvRange.x*2.*PI;float phi=uvRange.y*PI;float sinPhi=sin(phi);N.x=cos(theta)*sinPhi;N.z=sin(theta)*sinPhi;N.y=cos(phi);return N;}\nconst float NUM_SAMPLES_FLOAT=float(NUM_SAMPLES);const float NUM_SAMPLES_FLOAT_INVERSED=1./NUM_SAMPLES_FLOAT;const float K=4.;\n#define inline\nvec3 irradiance(samplerCube inputTexture,vec3 inputN,vec2 filteringInfo,float diffuseRoughness,vec3 surfaceAlbedo,vec3 inputV\n#if IBL_CDF_FILTERING\n,sampler2D icdfSampler\n#endif\n)\n{vec3 n=normalize(inputN);vec3 result=vec3(0.);\n#ifndef IBL_CDF_FILTERING\nvec3 tangent=abs(n.z)<0.999 ? vec3(0.,0.,1.) : vec3(1.,0.,0.);tangent=normalize(cross(tangent,n));vec3 bitangent=cross(n,tangent);mat3 tbn=mat3(tangent,bitangent,n);mat3 tbnInverse=mat3(tangent.x,bitangent.x,n.x,tangent.y,bitangent.y,n.y,tangent.z,bitangent.z,n.z);\n#endif\nfloat maxLevel=filteringInfo.y;float dim0=filteringInfo.x;float omegaP=(4.*PI)/(6.*dim0*dim0);vec3 clampedAlbedo=clamp(surfaceAlbedo,vec3(0.1),vec3(1.0));\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\nfor(uint i=0u; i<NUM_SAMPLES; ++i)\n#else\nfor(int i=0; i<NUM_SAMPLES; ++i)\n#endif\n{vec2 Xi=hammersley(i,NUM_SAMPLES);\n#if IBL_CDF_FILTERING\nvec2 T;T.x=texture2D(icdfSampler,vec2(Xi.x,0.)).x;T.y=texture2D(icdfSampler,vec2(T.x,Xi.y)).y;vec3 Ls=uv_to_normal(vec2(1.0-fract(T.x+0.25),T.y));float NoL=dot(n,Ls);float NoV=dot(n,inputV);\n#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON\nfloat LoV=dot (Ls,inputV);\n#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY\nvec3 H=(inputV+Ls)*0.5;float VoH=dot(inputV,H);\n#endif\n#else\nvec3 Ls=hemisphereCosSample(Xi);Ls=normalize(Ls);float NoL=Ls.z; \nvec3 V=tbnInverse*inputV;float NoV=V.z; \n#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON\nfloat LoV=dot (Ls,V);\n#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY\nvec3 H=(V+Ls)*0.5;float VoH=dot(V,H);\n#endif\n#endif\nif (NoL>0.) {\n#if IBL_CDF_FILTERING\nfloat pdf=texture2D(icdfSampler,T).z;vec3 c=textureCubeLodEXT(inputTexture,Ls,0.).rgb;\n#else\nfloat pdf_inversed=PI/NoL;float omegaS=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;float l=log4(omegaS)-log4(omegaP)+log4(K);float mipLevel=clamp(l,0.,maxLevel);vec3 c=textureCubeLodEXT(inputTexture,tbn*Ls,mipLevel).rgb;\n#endif\n#if GAMMA_INPUT\nc=toLinearSpace(c);\n#endif\nvec3 diffuseRoughnessTerm=vec3(1.0);\n#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON\ndiffuseRoughnessTerm=diffuseBRDF_EON(clampedAlbedo,diffuseRoughness,NoL,NoV,LoV)*PI;\n#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY\ndiffuseRoughnessTerm=vec3(diffuseBRDF_Burley(NoL,NoV,VoH,diffuseRoughness)*PI);\n#endif\n#if IBL_CDF_FILTERING\nvec3 light=pdf<1e-6 ? vec3(0.0) : vec3(1.0)/vec3(pdf)*c;result+=NoL*diffuseRoughnessTerm*light;\n#else\nresult+=c*diffuseRoughnessTerm;\n#endif\n}}\nresult=result*NUM_SAMPLES_FLOAT_INVERSED;\n#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON\nresult=result/clampedAlbedo;\n#endif\nreturn result;}\n#define inline\nvec3 radiance(float alphaG,samplerCube inputTexture,vec3 inputN,vec2 filteringInfo)\n{vec3 n=normalize(inputN);vec3 c=textureCube(inputTexture,n).rgb; \nif (alphaG==0.) {\n#if GAMMA_INPUT\nc=toLinearSpace(c);\n#endif\nreturn c;} else {vec3 result=vec3(0.);vec3 tangent=abs(n.z)<0.999 ? vec3(0.,0.,1.) : vec3(1.,0.,0.);tangent=normalize(cross(tangent,n));vec3 bitangent=cross(n,tangent);mat3 tbn=mat3(tangent,bitangent,n);float maxLevel=filteringInfo.y;float dim0=filteringInfo.x;float omegaP=(4.*PI)/(6.*dim0*dim0);float weight=0.;\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\nfor(uint i=0u; i<NUM_SAMPLES; ++i)\n#else\nfor(int i=0; i<NUM_SAMPLES; ++i)\n#endif\n{vec2 Xi=hammersley(i,NUM_SAMPLES);vec3 H=hemisphereImportanceSampleDggx(Xi,alphaG);float NoV=1.;float NoH=H.z;float NoH2=H.z*H.z;float NoL=2.*NoH2-1.;vec3 L=vec3(2.*NoH*H.x,2.*NoH*H.y,NoL);L=normalize(L);if (NoL>0.) {float pdf_inversed=4./normalDistributionFunction_TrowbridgeReitzGGX(NoH,alphaG);float omegaS=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;float l=log4(omegaS)-log4(omegaP)+log4(K);float mipLevel=clamp(float(l),0.0,maxLevel);weight+=NoL;vec3 c=textureCubeLodEXT(inputTexture,tbn*L,mipLevel).rgb;\n#if GAMMA_INPUT\nc=toLinearSpace(c);\n#endif\nresult+=c*NoL;}}\nresult=result/weight;return result;}}\n#endif\n#endif\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStore[name]) {\n ShaderStore.IncludesShadersStore[name] = shader;\n}\n/** @internal */\nexport const hdrFilteringFunctions = { name, shader };\n"]}
1
+ {"version":3,"file":"hdrFilteringFunctions.js","sourceRoot":"","sources":["../../../../../dev/core/src/Shaders/ShadersInclude/hdrFilteringFunctions.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,IAAI,GAAG,uBAAuB,CAAC;AACrC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiHd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC;IAC1C,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACpD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\n\nconst name = \"hdrFilteringFunctions\";\nconst shader = `#if NUM_SAMPLES\n#if NUM_SAMPLES>0\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\nfloat radicalInverse_VdC(uint bits) \n{bits=(bits<<16u) | (bits>>16u);bits=((bits & 0x55555555u)<<1u) | ((bits & 0xAAAAAAAAu)>>1u);bits=((bits & 0x33333333u)<<2u) | ((bits & 0xCCCCCCCCu)>>2u);bits=((bits & 0x0F0F0F0Fu)<<4u) | ((bits & 0xF0F0F0F0u)>>4u);bits=((bits & 0x00FF00FFu)<<8u) | ((bits & 0xFF00FF00u)>>8u);return float(bits)*2.3283064365386963e-10; }\nvec2 hammersley(uint i,uint N)\n{return vec2(float(i)/float(N),radicalInverse_VdC(i));}\n#else\nfloat vanDerCorpus(int n,int base)\n{float invBase=1.0/float(base);float denom =1.0;float result =0.0;for(int i=0; i<32; ++i)\n{if(n>0)\n{denom =mod(float(n),2.0);result+=denom*invBase;invBase=invBase/2.0;n =int(float(n)/2.0);}}\nreturn result;}\nvec2 hammersley(int i,int N)\n{return vec2(float(i)/float(N),vanDerCorpus(i,2));}\n#endif\nfloat log4(float x) {return log2(x)/2.;}\nvec3 uv_to_normal(vec2 uv) {vec3 N;vec2 uvRange=uv;float theta=uvRange.x*2.*PI;float phi=uvRange.y*PI;float sinPhi=sin(phi);N.x=cos(theta)*sinPhi;N.z=sin(theta)*sinPhi;N.y=cos(phi);return N;}\nconst float NUM_SAMPLES_FLOAT=float(NUM_SAMPLES);const float NUM_SAMPLES_FLOAT_INVERSED=1./NUM_SAMPLES_FLOAT;const float K=4.;\n#define inline\nvec3 irradiance(\n#ifdef CUSTOM_IRRADIANCE_FILTERING_INPUT\nCUSTOM_IRRADIANCE_FILTERING_INPUT\n#else\nsamplerCube inputTexture,\n#endif\nvec3 inputN,vec2 filteringInfo,\nfloat diffuseRoughness,\nvec3 surfaceAlbedo,\nvec3 inputV\n#if IBL_CDF_FILTERING\n,sampler2D icdfSampler\n#endif\n)\n{vec3 n=normalize(inputN);vec3 result=vec3(0.);\n#ifndef IBL_CDF_FILTERING\nvec3 tangent=abs(n.z)<0.999 ? vec3(0.,0.,1.) : vec3(1.,0.,0.);tangent=normalize(cross(tangent,n));vec3 bitangent=cross(n,tangent);mat3 tbn=mat3(tangent,bitangent,n);mat3 tbnInverse=mat3(tangent.x,bitangent.x,n.x,tangent.y,bitangent.y,n.y,tangent.z,bitangent.z,n.z);\n#endif\nfloat maxLevel=filteringInfo.y;float dim0=filteringInfo.x;float omegaP=(4.*PI)/(6.*dim0*dim0);vec3 clampedAlbedo=clamp(surfaceAlbedo,vec3(0.1),vec3(1.0));\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\nfor(uint i=0u; i<NUM_SAMPLES; ++i)\n#else\nfor(int i=0; i<NUM_SAMPLES; ++i)\n#endif\n{vec2 Xi=hammersley(i,NUM_SAMPLES);\n#if IBL_CDF_FILTERING\nvec2 T;T.x=texture2D(icdfSampler,vec2(Xi.x,0.)).x;T.y=texture2D(icdfSampler,vec2(T.x,Xi.y)).y;vec3 Ls=uv_to_normal(vec2(1.0-fract(T.x+0.25),T.y));float NoL=dot(n,Ls);float NoV=dot(n,inputV);\n#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON\nfloat LoV=dot (Ls,inputV);\n#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY\nvec3 H=(inputV+Ls)*0.5;float VoH=dot(inputV,H);\n#endif\n#else\nvec3 Ls=hemisphereCosSample(Xi);Ls=normalize(Ls);float NoL=Ls.z; \nvec3 V=tbnInverse*inputV;float NoV=V.z; \n#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON\nfloat LoV=dot (Ls,V);\n#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY\nvec3 H=(V+Ls)*0.5;float VoH=dot(V,H);\n#endif\n#endif\nif (NoL>0.) {\n#if IBL_CDF_FILTERING\nfloat pdf=texture2D(icdfSampler,T).z;vec3 c=textureCubeLodEXT(inputTexture,Ls,0.).rgb;\n#else\nfloat pdf_inversed=PI/NoL;float omegaS=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;float l=log4(omegaS)-log4(omegaP)+log4(K);float mipLevel=clamp(l,0.,maxLevel);\n#ifdef CUSTOM_IRRADIANCE_FILTERING_FUNCTION\nCUSTOM_IRRADIANCE_FILTERING_FUNCTION\n#else\nvec3 c=textureCubeLodEXT(inputTexture,tbn*Ls,mipLevel).rgb;\n#endif\n#endif\n#if GAMMA_INPUT\nc=toLinearSpace(c);\n#endif\nvec3 diffuseRoughnessTerm=vec3(1.0);\n#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON\ndiffuseRoughnessTerm=diffuseBRDF_EON(clampedAlbedo,diffuseRoughness,NoL,NoV,LoV)*PI;\n#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY\ndiffuseRoughnessTerm=vec3(diffuseBRDF_Burley(NoL,NoV,VoH,diffuseRoughness)*PI);\n#endif\n#if IBL_CDF_FILTERING\nvec3 light=pdf<1e-6 ? vec3(0.0) : vec3(1.0)/vec3(pdf)*c;result+=NoL*diffuseRoughnessTerm*light;\n#else\nresult+=c*diffuseRoughnessTerm;\n#endif\n}}\nresult=result*NUM_SAMPLES_FLOAT_INVERSED;\n#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON\nresult=result/clampedAlbedo;\n#endif\nreturn result;}\n#define inline\nvec3 radiance(float alphaG,samplerCube inputTexture,vec3 inputN,vec2 filteringInfo)\n{vec3 n=normalize(inputN);vec3 c=textureCube(inputTexture,n).rgb; \nif (alphaG==0.) {\n#if GAMMA_INPUT\nc=toLinearSpace(c);\n#endif\nreturn c;} else {vec3 result=vec3(0.);vec3 tangent=abs(n.z)<0.999 ? vec3(0.,0.,1.) : vec3(1.,0.,0.);tangent=normalize(cross(tangent,n));vec3 bitangent=cross(n,tangent);mat3 tbn=mat3(tangent,bitangent,n);float maxLevel=filteringInfo.y;float dim0=filteringInfo.x;float omegaP=(4.*PI)/(6.*dim0*dim0);float weight=0.;\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\nfor(uint i=0u; i<NUM_SAMPLES; ++i)\n#else\nfor(int i=0; i<NUM_SAMPLES; ++i)\n#endif\n{vec2 Xi=hammersley(i,NUM_SAMPLES);vec3 H=hemisphereImportanceSampleDggx(Xi,alphaG);float NoV=1.;float NoH=H.z;float NoH2=H.z*H.z;float NoL=2.*NoH2-1.;vec3 L=vec3(2.*NoH*H.x,2.*NoH*H.y,NoL);L=normalize(L);if (NoL>0.) {float pdf_inversed=4./normalDistributionFunction_TrowbridgeReitzGGX(NoH,alphaG);float omegaS=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;float l=log4(omegaS)-log4(omegaP)+log4(K);float mipLevel=clamp(float(l),0.0,maxLevel);weight+=NoL;vec3 c=textureCubeLodEXT(inputTexture,tbn*L,mipLevel).rgb;\n#if GAMMA_INPUT\nc=toLinearSpace(c);\n#endif\nresult+=c*NoL;}}\nresult=result/weight;return result;}}\n#endif\n#endif\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStore[name]) {\n ShaderStore.IncludesShadersStore[name] = shader;\n}\n/** @internal */\nexport const hdrFilteringFunctions = { name, shader };\n"]}
@@ -19,7 +19,7 @@ const shader = `#include<__decl__gaussianSplattingVertex>
19
19
  #include<fogVertexDeclaration>
20
20
  #include<logDepthDeclaration>
21
21
  #include<helperFunctions>
22
- attribute float splatIndex;uniform vec2 invViewport;uniform vec2 dataTextureSize;uniform vec2 focal;uniform float kernelSize;uniform vec3 eyePosition;uniform sampler2D covariancesATexture;uniform sampler2D covariancesBTexture;uniform sampler2D centersTexture;uniform sampler2D colorsTexture;
22
+ attribute float splatIndex;uniform vec2 invViewport;uniform vec2 dataTextureSize;uniform vec2 focal;uniform float kernelSize;uniform vec3 eyePosition;uniform vec3 viewDirectionFactor;uniform sampler2D covariancesATexture;uniform sampler2D covariancesBTexture;uniform sampler2D centersTexture;uniform sampler2D colorsTexture;
23
23
  #if SH_DEGREE>0
24
24
  uniform highp usampler2D shTexture0;
25
25
  #endif
@@ -33,8 +33,7 @@ varying vec4 vColor;varying vec2 vPosition;
33
33
  #include<gaussianSplatting>
34
34
  void main () {Splat splat=readSplat(splatIndex);vec3 covA=splat.covA.xyz;vec3 covB=vec3(splat.covA.w,splat.covB.xy);vec4 worldPos=world*vec4(splat.center.xyz,1.0);vColor=splat.color;vPosition=position;
35
35
  #if SH_DEGREE>0
36
- mat3 worldRot=mat3(world);mat3 normWorldRot=inverseMat3(worldRot);vec3 dir=normalize(normWorldRot*(worldPos.xyz-eyePosition));dir*=vec3(1.,1.,-1.);
37
- vColor.xyz=splat.color.xyz+computeSH(splat,dir);
36
+ mat3 worldRot=mat3(world);mat3 normWorldRot=inverseMat3(worldRot);vec3 dir=normalize(normWorldRot*(worldPos.xyz-eyePosition));dir*=viewDirectionFactor;vColor.xyz=splat.color.xyz+computeSH(splat,dir);
38
37
  #endif
39
38
  gl_Position=gaussianSplatting(position,worldPos.xyz,vec2(1.,1.),covA,covB,world,view,projection);
40
39
  #include<clipPlaneVertex>
@@ -1 +1 @@
1
- {"version":3,"file":"gaussianSplatting.vertex.js","sourceRoot":"","sources":["../../../../dev/core/src/Shaders/gaussianSplatting.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,qDAAqD,CAAC;AAC7D,OAAO,kDAAkD,CAAC;AAC1D,OAAO,6CAA6C,CAAC;AACrD,OAAO,uCAAuC,CAAC;AAC/C,OAAO,sCAAsC,CAAC;AAC9C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,oCAAoC,CAAC;AAC5C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,4BAA4B,CAAC;AACpC,OAAO,iCAAiC,CAAC;AAEzC,MAAM,IAAI,GAAG,+BAA+B,CAAC;AAC7C,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8Bd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;IAClC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAC5C,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,6BAA6B,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\nimport \"./ShadersInclude/gaussianSplattingVertexDeclaration\";\nimport \"./ShadersInclude/gaussianSplattingUboDeclaration\";\nimport \"./ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"./ShadersInclude/fogVertexDeclaration\";\nimport \"./ShadersInclude/logDepthDeclaration\";\nimport \"./ShadersInclude/helperFunctions\";\nimport \"./ShadersInclude/gaussianSplatting\";\nimport \"./ShadersInclude/clipPlaneVertex\";\nimport \"./ShadersInclude/fogVertex\";\nimport \"./ShadersInclude/logDepthVertex\";\n\nconst name = \"gaussianSplattingVertexShader\";\nconst shader = `#include<__decl__gaussianSplattingVertex>\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<logDepthDeclaration>\n#include<helperFunctions>\nattribute float splatIndex;uniform vec2 invViewport;uniform vec2 dataTextureSize;uniform vec2 focal;uniform float kernelSize;uniform vec3 eyePosition;uniform sampler2D covariancesATexture;uniform sampler2D covariancesBTexture;uniform sampler2D centersTexture;uniform sampler2D colorsTexture;\n#if SH_DEGREE>0\nuniform highp usampler2D shTexture0;\n#endif\n#if SH_DEGREE>1\nuniform highp usampler2D shTexture1;\n#endif\n#if SH_DEGREE>2\nuniform highp usampler2D shTexture2;\n#endif\nvarying vec4 vColor;varying vec2 vPosition;\n#include<gaussianSplatting>\nvoid main () {Splat splat=readSplat(splatIndex);vec3 covA=splat.covA.xyz;vec3 covB=vec3(splat.covA.w,splat.covB.xy);vec4 worldPos=world*vec4(splat.center.xyz,1.0);vColor=splat.color;vPosition=position;\n#if SH_DEGREE>0\nmat3 worldRot=mat3(world);mat3 normWorldRot=inverseMat3(worldRot);vec3 dir=normalize(normWorldRot*(worldPos.xyz-eyePosition));dir*=vec3(1.,1.,-1.); \nvColor.xyz=splat.color.xyz+computeSH(splat,dir);\n#endif\ngl_Position=gaussianSplatting(position,worldPos.xyz,vec2(1.,1.),covA,covB,world,view,projection);\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<logDepthVertex>\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStore[name]) {\n ShaderStore.ShadersStore[name] = shader;\n}\n/** @internal */\nexport const gaussianSplattingVertexShader = { name, shader };\n"]}
1
+ {"version":3,"file":"gaussianSplatting.vertex.js","sourceRoot":"","sources":["../../../../dev/core/src/Shaders/gaussianSplatting.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,qDAAqD,CAAC;AAC7D,OAAO,kDAAkD,CAAC;AAC1D,OAAO,6CAA6C,CAAC;AACrD,OAAO,uCAAuC,CAAC;AAC/C,OAAO,sCAAsC,CAAC;AAC9C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,oCAAoC,CAAC;AAC5C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,4BAA4B,CAAC;AACpC,OAAO,iCAAiC,CAAC;AAEzC,MAAM,IAAI,GAAG,+BAA+B,CAAC;AAC7C,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6Bd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;IAClC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAC5C,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,6BAA6B,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\nimport \"./ShadersInclude/gaussianSplattingVertexDeclaration\";\nimport \"./ShadersInclude/gaussianSplattingUboDeclaration\";\nimport \"./ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"./ShadersInclude/fogVertexDeclaration\";\nimport \"./ShadersInclude/logDepthDeclaration\";\nimport \"./ShadersInclude/helperFunctions\";\nimport \"./ShadersInclude/gaussianSplatting\";\nimport \"./ShadersInclude/clipPlaneVertex\";\nimport \"./ShadersInclude/fogVertex\";\nimport \"./ShadersInclude/logDepthVertex\";\n\nconst name = \"gaussianSplattingVertexShader\";\nconst shader = `#include<__decl__gaussianSplattingVertex>\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<logDepthDeclaration>\n#include<helperFunctions>\nattribute float splatIndex;uniform vec2 invViewport;uniform vec2 dataTextureSize;uniform vec2 focal;uniform float kernelSize;uniform vec3 eyePosition;uniform vec3 viewDirectionFactor;uniform sampler2D covariancesATexture;uniform sampler2D covariancesBTexture;uniform sampler2D centersTexture;uniform sampler2D colorsTexture;\n#if SH_DEGREE>0\nuniform highp usampler2D shTexture0;\n#endif\n#if SH_DEGREE>1\nuniform highp usampler2D shTexture1;\n#endif\n#if SH_DEGREE>2\nuniform highp usampler2D shTexture2;\n#endif\nvarying vec4 vColor;varying vec2 vPosition;\n#include<gaussianSplatting>\nvoid main () {Splat splat=readSplat(splatIndex);vec3 covA=splat.covA.xyz;vec3 covB=vec3(splat.covA.w,splat.covB.xy);vec4 worldPos=world*vec4(splat.center.xyz,1.0);vColor=splat.color;vPosition=position;\n#if SH_DEGREE>0\nmat3 worldRot=mat3(world);mat3 normWorldRot=inverseMat3(worldRot);vec3 dir=normalize(normWorldRot*(worldPos.xyz-eyePosition));dir*=viewDirectionFactor;vColor.xyz=splat.color.xyz+computeSH(splat,dir);\n#endif\ngl_Position=gaussianSplatting(position,worldPos.xyz,vec2(1.,1.),covA,covB,world,view,projection);\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<logDepthVertex>\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStore[name]) {\n ShaderStore.ShadersStore[name] = shader;\n}\n/** @internal */\nexport const gaussianSplattingVertexShader = { name, shader };\n"]}
@@ -9,7 +9,17 @@ fn hammersley(i: u32,N: u32)->vec2f
9
9
  {return vec2f( f32(i)/ f32(N),radicalInverse_VdC(i));}
10
10
  fn log4(x: f32)->f32 {return log2(x)/2.;}
11
11
  fn uv_to_normal(uv: vec2f)->vec3f {var N: vec3f;var uvRange: vec2f=uv;var theta: f32=uvRange.x*2.0*PI;var phi: f32=uvRange.y*PI;N.x=cos(theta)*sin(phi);N.z=sin(theta)*sin(phi);N.y=cos(phi);return N;}
12
- const NUM_SAMPLES_FLOAT: f32= f32(NUM_SAMPLES);const NUM_SAMPLES_FLOAT_INVERSED: f32=1./NUM_SAMPLES_FLOAT;const K: f32=4.;fn irradiance(inputTexture: texture_cube<f32>,inputSampler: sampler,inputN: vec3f,filteringInfo: vec2f,diffuseRoughness: f32,surfaceAlbedo: vec3f,inputV: vec3f
12
+ const NUM_SAMPLES_FLOAT: f32= f32(NUM_SAMPLES);const NUM_SAMPLES_FLOAT_INVERSED: f32=1./NUM_SAMPLES_FLOAT;const K: f32=4.;fn irradiance(
13
+ #ifdef CUSTOM_IRRADIANCE_FILTERING_INPUT
14
+ CUSTOM_IRRADIANCE_FILTERING_INPUT
15
+ #else
16
+ inputTexture: texture_cube<f32>,inputSampler: sampler,
17
+ #endif
18
+ inputN: vec3f,
19
+ filteringInfo: vec2f,
20
+ diffuseRoughness: f32,
21
+ surfaceAlbedo: vec3f,
22
+ inputV: vec3f
13
23
  #ifdef IBL_CDF_FILTERING
14
24
  ,icdfSampler: texture_2d<f32>,icdfSamplerSampler: sampler
15
25
  #endif
@@ -39,7 +49,12 @@ if (NoL>0.) {
39
49
  #ifdef IBL_CDF_FILTERING
40
50
  var pdf: f32=textureSampleLevel(icdfSampler,icdfSamplerSampler,T,0.0).z;var c: vec3f=textureSampleLevel(inputTexture,inputSampler,Ls,0.0).rgb;
41
51
  #else
42
- var pdf_inversed: f32=PI/NoL;var omegaS: f32=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;var l: f32=log4(omegaS)-log4(omegaP)+log4(K);var mipLevel: f32=clamp(l,0.0,maxLevel);var c: vec3f=textureSampleLevel(inputTexture,inputSampler,tbn*Ls,mipLevel).rgb;
52
+ var pdf_inversed: f32=PI/NoL;var omegaS: f32=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;var l: f32=log4(omegaS)-log4(omegaP)+log4(K);var mipLevel: f32=clamp(l,0.0,maxLevel);
53
+ #ifdef CUSTOM_IRRADIANCE_FILTERING_FUNCTION
54
+ CUSTOM_IRRADIANCE_FILTERING_FUNCTION
55
+ #else
56
+ var c: vec3f=textureSampleLevel(inputTexture,inputSampler,tbn*Ls,mipLevel).rgb;
57
+ #endif
43
58
  #endif
44
59
  #ifdef GAMMA_INPUT
45
60
  c=toLinearSpaceVec3(c);
@@ -1 +1 @@
1
- {"version":3,"file":"hdrFilteringFunctions.js","sourceRoot":"","sources":["../../../../../dev/core/src/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,IAAI,GAAG,uBAAuB,CAAC;AACrC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4Ed,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,wBAAwB,CAAC,IAAI,CAAC,EAAE,CAAC;IAC9C,WAAW,CAAC,wBAAwB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\n\nconst name = \"hdrFilteringFunctions\";\nconst shader = `#ifdef NUM_SAMPLES\n#if NUM_SAMPLES>0\nfn radicalInverse_VdC(value: u32)->f32 \n{var bits=(value<<16u) | (value>>16u);bits=((bits & 0x55555555u)<<1u) | ((bits & 0xAAAAAAAAu)>>1u);bits=((bits & 0x33333333u)<<2u) | ((bits & 0xCCCCCCCCu)>>2u);bits=((bits & 0x0F0F0F0Fu)<<4u) | ((bits & 0xF0F0F0F0u)>>4u);bits=((bits & 0x00FF00FFu)<<8u) | ((bits & 0xFF00FF00u)>>8u);return f32(bits)*2.3283064365386963e-10; }\nfn hammersley(i: u32,N: u32)->vec2f\n{return vec2f( f32(i)/ f32(N),radicalInverse_VdC(i));}\nfn log4(x: f32)->f32 {return log2(x)/2.;}\nfn uv_to_normal(uv: vec2f)->vec3f {var N: vec3f;var uvRange: vec2f=uv;var theta: f32=uvRange.x*2.0*PI;var phi: f32=uvRange.y*PI;N.x=cos(theta)*sin(phi);N.z=sin(theta)*sin(phi);N.y=cos(phi);return N;}\nconst NUM_SAMPLES_FLOAT: f32= f32(NUM_SAMPLES);const NUM_SAMPLES_FLOAT_INVERSED: f32=1./NUM_SAMPLES_FLOAT;const K: f32=4.;fn irradiance(inputTexture: texture_cube<f32>,inputSampler: sampler,inputN: vec3f,filteringInfo: vec2f,diffuseRoughness: f32,surfaceAlbedo: vec3f,inputV: vec3f\n#ifdef IBL_CDF_FILTERING\n,icdfSampler: texture_2d<f32>,icdfSamplerSampler: sampler\n#endif\n)->vec3f\n{var n: vec3f=normalize(inputN);var result: vec3f= vec3f(0.0);\n#ifndef IBL_CDF_FILTERING\nvar tangent: vec3f=select(vec3f(1.,0.,0.),vec3f(0.,0.,1.),abs(n.z)<0.999);tangent=normalize(cross(tangent,n));var bitangent: vec3f=cross(n,tangent);var tbn: mat3x3f= mat3x3f(tangent,bitangent,n);var tbnInverse: mat3x3f=transpose(tbn);\n#endif\nvar maxLevel: f32=filteringInfo.y;var dim0: f32=filteringInfo.x;var omegaP: f32=(4.*PI)/(6.*dim0*dim0);var clampedAlbedo: vec3f=clamp(surfaceAlbedo,vec3f(0.1),vec3f(1.0));for(var i: u32=0u; i<NUM_SAMPLES; i++)\n{var Xi: vec2f=hammersley(i,NUM_SAMPLES);\n#ifdef IBL_CDF_FILTERING\nvar T: vec2f;T.x=textureSampleLevel(icdfSampler,icdfSamplerSampler,vec2(Xi.x,0.0),0.0).x;T.y=textureSampleLevel(icdfSampler,icdfSamplerSampler,vec2(T.x,Xi.y),0.0).y;var Ls: vec3f=uv_to_normal(vec2f(1.0-fract(T.x+0.25),T.y));var NoL: f32=dot(n,Ls);var NoV: f32=dot(n,inputV);\n#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON\nvar LoV: f32=dot(Ls,inputV);\n#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY\nvar H: vec3f=(inputV+Ls)*0.5;var VoH: f32=dot(inputV,H);\n#endif \n#else\nvar Ls: vec3f=hemisphereCosSample(Xi);Ls=normalize(Ls);var Ns: vec3f= vec3f(0.,0.,1.);var NoL: f32=dot(Ns,Ls);var V: vec3f=tbnInverse*inputV;var NoV: f32=dot(Ns,V);\n#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON\nvar LoV: f32=dot(Ls,V);\n#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY\nvar H: vec3f=(V+Ls)*0.5;var VoH: f32=dot(V,H);\n#endif\n#endif\nif (NoL>0.) {\n#ifdef IBL_CDF_FILTERING\nvar pdf: f32=textureSampleLevel(icdfSampler,icdfSamplerSampler,T,0.0).z;var c: vec3f=textureSampleLevel(inputTexture,inputSampler,Ls,0.0).rgb;\n#else\nvar pdf_inversed: f32=PI/NoL;var omegaS: f32=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;var l: f32=log4(omegaS)-log4(omegaP)+log4(K);var mipLevel: f32=clamp(l,0.0,maxLevel);var c: vec3f=textureSampleLevel(inputTexture,inputSampler,tbn*Ls,mipLevel).rgb;\n#endif\n#ifdef GAMMA_INPUT\nc=toLinearSpaceVec3(c);\n#endif\nvar diffuseRoughnessTerm: vec3f=vec3f(1.0);\n#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON\ndiffuseRoughnessTerm=diffuseBRDF_EON(clampedAlbedo,diffuseRoughness,NoL,NoV,LoV)*PI;\n#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY\ndiffuseRoughnessTerm=vec3f(diffuseBRDF_Burley(NoL,NoV,VoH,diffuseRoughness)*PI);\n#endif\n#ifdef IBL_CDF_FILTERING\nvar light: vec3f=vec3f(0.0);if (pdf>1e-6) {light=vec3f(1.0)/vec3f(pdf)*c;}\nresult+=NoL*diffuseRoughnessTerm*light;\n#else\nresult+=c*diffuseRoughnessTerm;\n#endif\n}}\nresult=result*NUM_SAMPLES_FLOAT_INVERSED;\n#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON\nresult=result/clampedAlbedo;\n#endif\nreturn result;}\nfn radiance(alphaG: f32,inputTexture: texture_cube<f32>,inputSampler: sampler,inputN: vec3f,filteringInfo: vec2f)->vec3f\n{var n: vec3f=normalize(inputN);var c: vec3f=textureSample(inputTexture,inputSampler,n).rgb; \nif (alphaG==0.) {\n#ifdef GAMMA_INPUT\nc=toLinearSpace(c);\n#endif\nreturn c;} else {var result: vec3f= vec3f(0.);var tangent: vec3f=select(vec3f(1.,0.,0.),vec3f(0.,0.,1.),abs(n.z)<0.999);tangent=normalize(cross(tangent,n));var bitangent: vec3f=cross(n,tangent);var tbn: mat3x3f= mat3x3f(tangent,bitangent,n);var maxLevel: f32=filteringInfo.y;var dim0: f32=filteringInfo.x;var omegaP: f32=(4.*PI)/(6.*dim0*dim0);var weight: f32=0.;for(var i: u32=0u; i<NUM_SAMPLES; i++)\n{var Xi: vec2f=hammersley(i,NUM_SAMPLES);var H: vec3f=hemisphereImportanceSampleDggx(Xi,alphaG);var NoV: f32=1.;var NoH: f32=H.z;var NoH2: f32=H.z*H.z;var NoL: f32=2.*NoH2-1.;var L: vec3f= vec3f(2.*NoH*H.x,2.*NoH*H.y,NoL);L=normalize(L);if (NoL>0.) {var pdf_inversed: f32=4./normalDistributionFunction_TrowbridgeReitzGGX(NoH,alphaG);var omegaS: f32=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;var l: f32=log4(omegaS)-log4(omegaP)+log4(K);var mipLevel: f32=clamp( f32(l),0.0,maxLevel);weight+=NoL;var c: vec3f=textureSampleLevel(inputTexture,inputSampler,tbn*L,mipLevel).rgb;\n#ifdef GAMMA_INPUT\nc=toLinearSpace(c);\n#endif\nresult+=c*NoL;}}\nresult=result/weight;return result;}}\n#endif\n#endif\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStoreWGSL[name]) {\n ShaderStore.IncludesShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const hdrFilteringFunctionsWGSL = { name, shader };\n"]}
1
+ {"version":3,"file":"hdrFilteringFunctions.js","sourceRoot":"","sources":["../../../../../dev/core/src/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,IAAI,GAAG,uBAAuB,CAAC;AACrC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2Fd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,wBAAwB,CAAC,IAAI,CAAC,EAAE,CAAC;IAC9C,WAAW,CAAC,wBAAwB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\n\nconst name = \"hdrFilteringFunctions\";\nconst shader = `#ifdef NUM_SAMPLES\n#if NUM_SAMPLES>0\nfn radicalInverse_VdC(value: u32)->f32 \n{var bits=(value<<16u) | (value>>16u);bits=((bits & 0x55555555u)<<1u) | ((bits & 0xAAAAAAAAu)>>1u);bits=((bits & 0x33333333u)<<2u) | ((bits & 0xCCCCCCCCu)>>2u);bits=((bits & 0x0F0F0F0Fu)<<4u) | ((bits & 0xF0F0F0F0u)>>4u);bits=((bits & 0x00FF00FFu)<<8u) | ((bits & 0xFF00FF00u)>>8u);return f32(bits)*2.3283064365386963e-10; }\nfn hammersley(i: u32,N: u32)->vec2f\n{return vec2f( f32(i)/ f32(N),radicalInverse_VdC(i));}\nfn log4(x: f32)->f32 {return log2(x)/2.;}\nfn uv_to_normal(uv: vec2f)->vec3f {var N: vec3f;var uvRange: vec2f=uv;var theta: f32=uvRange.x*2.0*PI;var phi: f32=uvRange.y*PI;N.x=cos(theta)*sin(phi);N.z=sin(theta)*sin(phi);N.y=cos(phi);return N;}\nconst NUM_SAMPLES_FLOAT: f32= f32(NUM_SAMPLES);const NUM_SAMPLES_FLOAT_INVERSED: f32=1./NUM_SAMPLES_FLOAT;const K: f32=4.;fn irradiance(\n#ifdef CUSTOM_IRRADIANCE_FILTERING_INPUT\nCUSTOM_IRRADIANCE_FILTERING_INPUT\n#else\ninputTexture: texture_cube<f32>,inputSampler: sampler,\n#endif\ninputN: vec3f,\nfilteringInfo: vec2f,\ndiffuseRoughness: f32,\nsurfaceAlbedo: vec3f,\ninputV: vec3f\n#ifdef IBL_CDF_FILTERING\n,icdfSampler: texture_2d<f32>,icdfSamplerSampler: sampler\n#endif\n)->vec3f\n{var n: vec3f=normalize(inputN);var result: vec3f= vec3f(0.0);\n#ifndef IBL_CDF_FILTERING\nvar tangent: vec3f=select(vec3f(1.,0.,0.),vec3f(0.,0.,1.),abs(n.z)<0.999);tangent=normalize(cross(tangent,n));var bitangent: vec3f=cross(n,tangent);var tbn: mat3x3f= mat3x3f(tangent,bitangent,n);var tbnInverse: mat3x3f=transpose(tbn);\n#endif\nvar maxLevel: f32=filteringInfo.y;var dim0: f32=filteringInfo.x;var omegaP: f32=(4.*PI)/(6.*dim0*dim0);var clampedAlbedo: vec3f=clamp(surfaceAlbedo,vec3f(0.1),vec3f(1.0));for(var i: u32=0u; i<NUM_SAMPLES; i++)\n{var Xi: vec2f=hammersley(i,NUM_SAMPLES);\n#ifdef IBL_CDF_FILTERING\nvar T: vec2f;T.x=textureSampleLevel(icdfSampler,icdfSamplerSampler,vec2(Xi.x,0.0),0.0).x;T.y=textureSampleLevel(icdfSampler,icdfSamplerSampler,vec2(T.x,Xi.y),0.0).y;var Ls: vec3f=uv_to_normal(vec2f(1.0-fract(T.x+0.25),T.y));var NoL: f32=dot(n,Ls);var NoV: f32=dot(n,inputV);\n#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON\nvar LoV: f32=dot(Ls,inputV);\n#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY\nvar H: vec3f=(inputV+Ls)*0.5;var VoH: f32=dot(inputV,H);\n#endif \n#else\nvar Ls: vec3f=hemisphereCosSample(Xi);Ls=normalize(Ls);var Ns: vec3f= vec3f(0.,0.,1.);var NoL: f32=dot(Ns,Ls);var V: vec3f=tbnInverse*inputV;var NoV: f32=dot(Ns,V);\n#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON\nvar LoV: f32=dot(Ls,V);\n#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY\nvar H: vec3f=(V+Ls)*0.5;var VoH: f32=dot(V,H);\n#endif\n#endif\nif (NoL>0.) {\n#ifdef IBL_CDF_FILTERING\nvar pdf: f32=textureSampleLevel(icdfSampler,icdfSamplerSampler,T,0.0).z;var c: vec3f=textureSampleLevel(inputTexture,inputSampler,Ls,0.0).rgb;\n#else\nvar pdf_inversed: f32=PI/NoL;var omegaS: f32=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;var l: f32=log4(omegaS)-log4(omegaP)+log4(K);var mipLevel: f32=clamp(l,0.0,maxLevel);\n#ifdef CUSTOM_IRRADIANCE_FILTERING_FUNCTION\nCUSTOM_IRRADIANCE_FILTERING_FUNCTION\n#else\nvar c: vec3f=textureSampleLevel(inputTexture,inputSampler,tbn*Ls,mipLevel).rgb;\n#endif\n#endif\n#ifdef GAMMA_INPUT\nc=toLinearSpaceVec3(c);\n#endif\nvar diffuseRoughnessTerm: vec3f=vec3f(1.0);\n#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON\ndiffuseRoughnessTerm=diffuseBRDF_EON(clampedAlbedo,diffuseRoughness,NoL,NoV,LoV)*PI;\n#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY\ndiffuseRoughnessTerm=vec3f(diffuseBRDF_Burley(NoL,NoV,VoH,diffuseRoughness)*PI);\n#endif\n#ifdef IBL_CDF_FILTERING\nvar light: vec3f=vec3f(0.0);if (pdf>1e-6) {light=vec3f(1.0)/vec3f(pdf)*c;}\nresult+=NoL*diffuseRoughnessTerm*light;\n#else\nresult+=c*diffuseRoughnessTerm;\n#endif\n}}\nresult=result*NUM_SAMPLES_FLOAT_INVERSED;\n#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON\nresult=result/clampedAlbedo;\n#endif\nreturn result;}\nfn radiance(alphaG: f32,inputTexture: texture_cube<f32>,inputSampler: sampler,inputN: vec3f,filteringInfo: vec2f)->vec3f\n{var n: vec3f=normalize(inputN);var c: vec3f=textureSample(inputTexture,inputSampler,n).rgb; \nif (alphaG==0.) {\n#ifdef GAMMA_INPUT\nc=toLinearSpace(c);\n#endif\nreturn c;} else {var result: vec3f= vec3f(0.);var tangent: vec3f=select(vec3f(1.,0.,0.),vec3f(0.,0.,1.),abs(n.z)<0.999);tangent=normalize(cross(tangent,n));var bitangent: vec3f=cross(n,tangent);var tbn: mat3x3f= mat3x3f(tangent,bitangent,n);var maxLevel: f32=filteringInfo.y;var dim0: f32=filteringInfo.x;var omegaP: f32=(4.*PI)/(6.*dim0*dim0);var weight: f32=0.;for(var i: u32=0u; i<NUM_SAMPLES; i++)\n{var Xi: vec2f=hammersley(i,NUM_SAMPLES);var H: vec3f=hemisphereImportanceSampleDggx(Xi,alphaG);var NoV: f32=1.;var NoH: f32=H.z;var NoH2: f32=H.z*H.z;var NoL: f32=2.*NoH2-1.;var L: vec3f= vec3f(2.*NoH*H.x,2.*NoH*H.y,NoL);L=normalize(L);if (NoL>0.) {var pdf_inversed: f32=4./normalDistributionFunction_TrowbridgeReitzGGX(NoH,alphaG);var omegaS: f32=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;var l: f32=log4(omegaS)-log4(omegaP)+log4(K);var mipLevel: f32=clamp( f32(l),0.0,maxLevel);weight+=NoL;var c: vec3f=textureSampleLevel(inputTexture,inputSampler,tbn*L,mipLevel).rgb;\n#ifdef GAMMA_INPUT\nc=toLinearSpace(c);\n#endif\nresult+=c*NoL;}}\nresult=result/weight;return result;}}\n#endif\n#endif\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStoreWGSL[name]) {\n ShaderStore.IncludesShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const hdrFilteringFunctionsWGSL = { name, shader };\n"]}
@@ -17,7 +17,7 @@ const shader = `#include<sceneUboDeclaration>
17
17
  #include<clipPlaneVertexDeclaration>
18
18
  #include<fogVertexDeclaration>
19
19
  #include<logDepthDeclaration>
20
- attribute splatIndex: f32;attribute position: vec2f;uniform invViewport: vec2f;uniform dataTextureSize: vec2f;uniform focal: vec2f;uniform kernelSize: f32;uniform eyePosition: vec3f;var covariancesATexture: texture_2d<f32>;var covariancesBTexture: texture_2d<f32>;var centersTexture: texture_2d<f32>;var colorsTexture: texture_2d<f32>;
20
+ attribute splatIndex: f32;attribute position: vec2f;uniform invViewport: vec2f;uniform dataTextureSize: vec2f;uniform focal: vec2f;uniform kernelSize: f32;uniform eyePosition: vec3f;uniform viewDirectionFactor: vec3f;var covariancesATexture: texture_2d<f32>;var covariancesBTexture: texture_2d<f32>;var centersTexture: texture_2d<f32>;var colorsTexture: texture_2d<f32>;
21
21
  #if SH_DEGREE>0
22
22
  var shTexture0: texture_2d<u32>;
23
23
  #endif
@@ -32,8 +32,7 @@ varying vColor: vec4f;varying vPosition: vec2f;
32
32
  @vertex
33
33
  fn main(input : VertexInputs)->FragmentInputs {var splat: Splat=readSplat(input.splatIndex,uniforms.dataTextureSize);var covA: vec3f=splat.covA.xyz;var covB: vec3f=vec3f(splat.covA.w,splat.covB.xy);let worldPos: vec4f=mesh.world*vec4f(splat.center.xyz,1.0);vertexOutputs.vPosition=input.position;
34
34
  #if SH_DEGREE>0
35
- let worldRot: mat3x3f= mat3x3f(mesh.world[0].xyz,mesh.world[1].xyz,mesh.world[2].xyz);let normWorldRot: mat3x3f=inverseMat3(worldRot);var dir: vec3f=normalize(normWorldRot*(worldPos.xyz-uniforms.eyePosition.xyz));dir*=vec3f(1.,1.,-1.);
36
- vertexOutputs.vColor=vec4f(splat.color.xyz+computeSH(splat,dir),splat.color.w);
35
+ let worldRot: mat3x3f= mat3x3f(mesh.world[0].xyz,mesh.world[1].xyz,mesh.world[2].xyz);let normWorldRot: mat3x3f=inverseMat3(worldRot);var dir: vec3f=normalize(normWorldRot*(worldPos.xyz-uniforms.eyePosition.xyz));dir*=viewDirectionFactor;vertexOutputs.vColor=vec4f(splat.color.xyz+computeSH(splat,dir),splat.color.w);
37
36
  #else
38
37
  vertexOutputs.vColor=splat.color;
39
38
  #endif
@@ -1 +1 @@
1
- {"version":3,"file":"gaussianSplatting.vertex.js","sourceRoot":"","sources":["../../../../dev/core/src/ShadersWGSL/gaussianSplatting.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,sCAAsC,CAAC;AAC9C,OAAO,qCAAqC,CAAC;AAC7C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,6CAA6C,CAAC;AACrD,OAAO,uCAAuC,CAAC;AAC/C,OAAO,sCAAsC,CAAC;AAC9C,OAAO,oCAAoC,CAAC;AAC5C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,4BAA4B,CAAC;AACpC,OAAO,iCAAiC,CAAC;AAEzC,MAAM,IAAI,GAAG,+BAA+B,CAAC;AAC7C,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+Bd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;IACtC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,iCAAiC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\nimport \"./ShadersInclude/sceneUboDeclaration\";\nimport \"./ShadersInclude/meshUboDeclaration\";\nimport \"./ShadersInclude/helperFunctions\";\nimport \"./ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"./ShadersInclude/fogVertexDeclaration\";\nimport \"./ShadersInclude/logDepthDeclaration\";\nimport \"./ShadersInclude/gaussianSplatting\";\nimport \"./ShadersInclude/clipPlaneVertex\";\nimport \"./ShadersInclude/fogVertex\";\nimport \"./ShadersInclude/logDepthVertex\";\n\nconst name = \"gaussianSplattingVertexShader\";\nconst shader = `#include<sceneUboDeclaration>\n#include<meshUboDeclaration>\n#include<helperFunctions>\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<logDepthDeclaration>\nattribute splatIndex: f32;attribute position: vec2f;uniform invViewport: vec2f;uniform dataTextureSize: vec2f;uniform focal: vec2f;uniform kernelSize: f32;uniform eyePosition: vec3f;var covariancesATexture: texture_2d<f32>;var covariancesBTexture: texture_2d<f32>;var centersTexture: texture_2d<f32>;var colorsTexture: texture_2d<f32>;\n#if SH_DEGREE>0\nvar shTexture0: texture_2d<u32>;\n#endif\n#if SH_DEGREE>1\nvar shTexture1: texture_2d<u32>;\n#endif\n#if SH_DEGREE>2\nvar shTexture2: texture_2d<u32>;\n#endif\nvarying vColor: vec4f;varying vPosition: vec2f;\n#include<gaussianSplatting>\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {var splat: Splat=readSplat(input.splatIndex,uniforms.dataTextureSize);var covA: vec3f=splat.covA.xyz;var covB: vec3f=vec3f(splat.covA.w,splat.covB.xy);let worldPos: vec4f=mesh.world*vec4f(splat.center.xyz,1.0);vertexOutputs.vPosition=input.position;\n#if SH_DEGREE>0\nlet worldRot: mat3x3f= mat3x3f(mesh.world[0].xyz,mesh.world[1].xyz,mesh.world[2].xyz);let normWorldRot: mat3x3f=inverseMat3(worldRot);var dir: vec3f=normalize(normWorldRot*(worldPos.xyz-uniforms.eyePosition.xyz));dir*=vec3f(1.,1.,-1.); \nvertexOutputs.vColor=vec4f(splat.color.xyz+computeSH(splat,dir),splat.color.w);\n#else\nvertexOutputs.vColor=splat.color;\n#endif\nvertexOutputs.position=gaussianSplatting(input.position,worldPos.xyz,vec2f(1.0,1.0),covA,covB,mesh.world,scene.view,scene.projection,uniforms.focal,uniforms.invViewport,uniforms.kernelSize);\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<logDepthVertex>\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const gaussianSplattingVertexShaderWGSL = { name, shader };\n"]}
1
+ {"version":3,"file":"gaussianSplatting.vertex.js","sourceRoot":"","sources":["../../../../dev/core/src/ShadersWGSL/gaussianSplatting.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,sCAAsC,CAAC;AAC9C,OAAO,qCAAqC,CAAC;AAC7C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,6CAA6C,CAAC;AACrD,OAAO,uCAAuC,CAAC;AAC/C,OAAO,sCAAsC,CAAC;AAC9C,OAAO,oCAAoC,CAAC;AAC5C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,4BAA4B,CAAC;AACpC,OAAO,iCAAiC,CAAC;AAEzC,MAAM,IAAI,GAAG,+BAA+B,CAAC;AAC7C,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8Bd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;IACtC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,iCAAiC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\nimport \"./ShadersInclude/sceneUboDeclaration\";\nimport \"./ShadersInclude/meshUboDeclaration\";\nimport \"./ShadersInclude/helperFunctions\";\nimport \"./ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"./ShadersInclude/fogVertexDeclaration\";\nimport \"./ShadersInclude/logDepthDeclaration\";\nimport \"./ShadersInclude/gaussianSplatting\";\nimport \"./ShadersInclude/clipPlaneVertex\";\nimport \"./ShadersInclude/fogVertex\";\nimport \"./ShadersInclude/logDepthVertex\";\n\nconst name = \"gaussianSplattingVertexShader\";\nconst shader = `#include<sceneUboDeclaration>\n#include<meshUboDeclaration>\n#include<helperFunctions>\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<logDepthDeclaration>\nattribute splatIndex: f32;attribute position: vec2f;uniform invViewport: vec2f;uniform dataTextureSize: vec2f;uniform focal: vec2f;uniform kernelSize: f32;uniform eyePosition: vec3f;uniform viewDirectionFactor: vec3f;var covariancesATexture: texture_2d<f32>;var covariancesBTexture: texture_2d<f32>;var centersTexture: texture_2d<f32>;var colorsTexture: texture_2d<f32>;\n#if SH_DEGREE>0\nvar shTexture0: texture_2d<u32>;\n#endif\n#if SH_DEGREE>1\nvar shTexture1: texture_2d<u32>;\n#endif\n#if SH_DEGREE>2\nvar shTexture2: texture_2d<u32>;\n#endif\nvarying vColor: vec4f;varying vPosition: vec2f;\n#include<gaussianSplatting>\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {var splat: Splat=readSplat(input.splatIndex,uniforms.dataTextureSize);var covA: vec3f=splat.covA.xyz;var covB: vec3f=vec3f(splat.covA.w,splat.covB.xy);let worldPos: vec4f=mesh.world*vec4f(splat.center.xyz,1.0);vertexOutputs.vPosition=input.position;\n#if SH_DEGREE>0\nlet worldRot: mat3x3f= mat3x3f(mesh.world[0].xyz,mesh.world[1].xyz,mesh.world[2].xyz);let normWorldRot: mat3x3f=inverseMat3(worldRot);var dir: vec3f=normalize(normWorldRot*(worldPos.xyz-uniforms.eyePosition.xyz));dir*=viewDirectionFactor;vertexOutputs.vColor=vec4f(splat.color.xyz+computeSH(splat,dir),splat.color.w);\n#else\nvertexOutputs.vColor=splat.color;\n#endif\nvertexOutputs.position=gaussianSplatting(input.position,worldPos.xyz,vec2f(1.0,1.0),covA,covB,mesh.world,scene.view,scene.projection,uniforms.focal,uniforms.invViewport,uniforms.kernelSize);\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<logDepthVertex>\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const gaussianSplattingVertexShaderWGSL = { name, shader };\n"]}
@@ -223,13 +223,13 @@ export class WebXRControllerPointerSelection extends WebXRAbstractFeature {
223
223
  // only do this for the selected pointer
224
224
  const controllerData = this._controllers[id];
225
225
  if (this._options.lookAndPickMode && controllerData.xrController?.inputSource.targetRayMode !== "transient-pointer") {
226
- return;
226
+ continue;
227
227
  }
228
228
  if ((!this._options.enablePointerSelectionOnAllControllers && id !== this._attachedController) || controllerData.disabledByNearInteraction) {
229
229
  controllerData.selectionMesh.isVisible = false;
230
230
  controllerData.laserPointer.isVisible = false;
231
231
  controllerData.pick = null;
232
- return;
232
+ continue;
233
233
  }
234
234
  controllerData.laserPointer.isVisible = this.displayLaserPointer;
235
235
  let controllerGlobalPosition;
@@ -246,7 +246,7 @@ export class WebXRControllerPointerSelection extends WebXRAbstractFeature {
246
246
  controllerData.webXRCamera.getForwardRayToRef(controllerData.tmpRay);
247
247
  }
248
248
  else {
249
- return;
249
+ continue;
250
250
  }
251
251
  if (this._options.maxPointerDistance) {
252
252
  controllerData.tmpRay.length = this._options.maxPointerDistance;