@onerjs/core 8.51.6 → 8.51.7
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.
- package/Cameras/inputMapper.js +13 -9
- package/Cameras/inputMapper.js.map +1 -1
- package/Engines/AbstractEngine/abstractEngine.views.pure.js.map +1 -1
- package/Engines/AbstractEngine/abstractEngine.views.types.d.ts +2 -1
- package/Engines/AbstractEngine/abstractEngine.views.types.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingDebugMaterialPlugin.d.ts +5 -0
- package/Materials/GaussianSplatting/gaussianSplattingDebugMaterialPlugin.js +8 -0
- package/Materials/GaussianSplatting/gaussianSplattingDebugMaterialPlugin.js.map +1 -0
- package/Materials/GaussianSplatting/gaussianSplattingDebugMaterialPlugin.pure.d.ts +278 -0
- package/Materials/GaussianSplatting/gaussianSplattingDebugMaterialPlugin.pure.js +718 -0
- package/Materials/GaussianSplatting/gaussianSplattingDebugMaterialPlugin.pure.js.map +1 -0
- package/Materials/GaussianSplatting/pure.d.ts +1 -0
- package/Materials/GaussianSplatting/pure.js +1 -0
- package/Materials/GaussianSplatting/pure.js.map +1 -1
- package/Materials/Textures/internalTexture.js +7 -0
- package/Materials/Textures/internalTexture.js.map +1 -1
- package/Materials/index.d.ts +1 -0
- package/Materials/index.js +1 -0
- package/Materials/index.js.map +1 -1
- package/Materials/pure.d.ts +1 -0
- package/Materials/pure.js +1 -0
- package/Materials/pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingDebugger.d.ts +7 -0
- package/Meshes/GaussianSplatting/gaussianSplattingDebugger.js +8 -0
- package/Meshes/GaussianSplatting/gaussianSplattingDebugger.js.map +1 -0
- package/Meshes/GaussianSplatting/gaussianSplattingDebugger.pure.d.ts +147 -0
- package/Meshes/GaussianSplatting/gaussianSplattingDebugger.pure.js +257 -0
- package/Meshes/GaussianSplatting/gaussianSplattingDebugger.pure.js.map +1 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +11 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +31 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/pure.d.ts +1 -0
- package/Meshes/GaussianSplatting/pure.js +1 -0
- package/Meshes/GaussianSplatting/pure.js.map +1 -1
- package/Meshes/abstractMesh.pure.js +3 -0
- package/Meshes/abstractMesh.pure.js.map +1 -1
- package/Meshes/index.d.ts +1 -0
- package/Meshes/index.js +1 -0
- package/Meshes/index.js.map +1 -1
- package/Meshes/pure.d.ts +1 -0
- package/Meshes/pure.js +1 -0
- package/Meshes/pure.js.map +1 -1
- package/Shaders/ShadersInclude/gaussianSplatting.js +33 -10
- package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/Shaders/gaussianSplatting.vertex.js +20 -1
- package/Shaders/gaussianSplatting.vertex.js.map +1 -1
- package/Shaders/picking.fragment.js +4 -1
- package/Shaders/picking.fragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +33 -10
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/ShadersWGSL/gaussianSplatting.vertex.js +21 -2
- package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
- package/package.json +1 -1
- package/scene.pure.js.map +1 -1
package/Meshes/index.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ export * from "./Node/index.js";
|
|
|
37
37
|
export * from "./GaussianSplatting/gaussianSplattingMeshBase.js";
|
|
38
38
|
export * from "./GaussianSplatting/gaussianSplattingMesh.js";
|
|
39
39
|
export * from "./GaussianSplatting/gaussianSplattingCompoundMesh.js";
|
|
40
|
+
export * from "./GaussianSplatting/gaussianSplattingDebugger.js";
|
|
40
41
|
export * from "../Shaders/color.fragment.js";
|
|
41
42
|
export * from "../Shaders/color.vertex.js";
|
|
42
43
|
export * from "../ShadersWGSL/color.fragment.js";
|
package/Meshes/index.js
CHANGED
|
@@ -38,6 +38,7 @@ export * from "./Node/index.js";
|
|
|
38
38
|
export * from "./GaussianSplatting/gaussianSplattingMeshBase.js";
|
|
39
39
|
export * from "./GaussianSplatting/gaussianSplattingMesh.js";
|
|
40
40
|
export * from "./GaussianSplatting/gaussianSplattingCompoundMesh.js";
|
|
41
|
+
export * from "./GaussianSplatting/gaussianSplattingDebugger.js";
|
|
41
42
|
// LineMesh
|
|
42
43
|
export * from "../Shaders/color.fragment.js";
|
|
43
44
|
export * from "../Shaders/color.vertex.js";
|
package/Meshes/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/Meshes/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,OAAO,CAAC;AACtB,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qCAAqC,CAAC;AACpD,cAAc,mCAAmC,CAAC;AAClD,cAAc,QAAQ,CAAC;AACvB,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,+CAA+C,CAAC;AAC9D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,mDAAmD,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/Meshes/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,OAAO,CAAC;AACtB,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qCAAqC,CAAC;AACpD,cAAc,mCAAmC,CAAC;AAClD,cAAc,QAAQ,CAAC;AACvB,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,+CAA+C,CAAC;AAC9D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,mDAAmD,CAAC;AAClE,cAAc,+CAA+C,CAAC;AAE9D,WAAW;AACX,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAE5C,sBAAsB;AACtB,cAAc,uCAAuC,CAAC;AACtD,cAAc,yCAAyC,CAAC;AACxD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,kDAAkD,CAAC;AACjE,cAAc,gDAAgD,CAAC;AAC/D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,iDAAiD,CAAC;AAChE,cAAc,mDAAmD,CAAC;AAClE,cAAc,sDAAsD,CAAC;AACrE,cAAc,oDAAoD,CAAC;AAEnE,OAAO,yBAAyB,CAAC;AACjC,OAAO,oBAAoB,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nexport * from \"./abstractMesh\";\r\nexport * from \"./abstractMesh.hotSpot\";\r\nexport * from \"./Compression/index\";\r\nexport * from \"./csg\";\r\nexport * from \"./meshUVSpaceRenderer\";\r\nexport * from \"./geometry\";\r\nexport * from \"./groundMesh\";\r\nexport * from \"./goldbergMesh\";\r\nexport * from \"./trailMesh\";\r\nexport * from \"./instancedMesh\";\r\nexport * from \"./linesMesh\";\r\nexport * from \"./mesh\";\r\nexport * from \"./mesh.vertexData\";\r\nexport * from \"./meshBuilder\";\r\nexport * from \"./meshSimplification\";\r\nexport * from \"./meshSimplificationSceneComponent\";\r\nexport * from \"./meshUtils\";\r\nexport * from \"./polygonMesh\";\r\nexport * from \"./geodesicMesh\";\r\nexport * from \"./subMesh\";\r\nexport * from \"./subMesh.project\";\r\nexport * from \"./lattice\";\r\nexport * from \"./lattice.material\";\r\nexport * from \"./meshLODLevel\";\r\nexport * from \"./transformNode\";\r\nexport * from \"./Builders/index\";\r\nexport * from \"./WebGL/webGLDataBuffer\";\r\nexport * from \"./WebGPU/webgpuDataBuffer\";\r\nexport * from \"./GreasedLine/greasedLineMesh\";\r\nexport * from \"./GreasedLine/greasedLineRibbonMesh\";\r\nexport * from \"./GreasedLine/greasedLineBaseMesh\";\r\nexport * from \"./csg2\";\r\nexport * from \"./mesh.vertexData.functions\";\r\nexport * from \"./mesh.vertexData.subdivide\";\r\nexport * from \"./thinInstanceMesh\";\r\nexport * from \"./Node/index\";\r\nexport * from \"./GaussianSplatting/gaussianSplattingMeshBase\";\r\nexport * from \"./GaussianSplatting/gaussianSplattingMesh\";\r\nexport * from \"./GaussianSplatting/gaussianSplattingCompoundMesh\";\r\nexport * from \"./GaussianSplatting/gaussianSplattingDebugger\";\r\n\r\n// LineMesh\r\nexport * from \"../Shaders/color.fragment\";\r\nexport * from \"../Shaders/color.vertex\";\r\nexport * from \"../ShadersWGSL/color.fragment\";\r\nexport * from \"../ShadersWGSL/color.vertex\";\r\n\r\n// MeshUVSPaceRenderer\r\nexport * from \"../Shaders/meshUVSpaceRenderer.vertex\";\r\nexport * from \"../Shaders/meshUVSpaceRenderer.fragment\";\r\nexport * from \"../Shaders/meshUVSpaceRendererMasker.vertex\";\r\nexport * from \"../Shaders/meshUVSpaceRendererMasker.fragment\";\r\nexport * from \"../Shaders/meshUVSpaceRendererFinaliser.fragment\";\r\nexport * from \"../Shaders/meshUVSpaceRendererFinaliser.vertex\";\r\nexport * from \"../ShadersWGSL/meshUVSpaceRenderer.vertex\";\r\nexport * from \"../ShadersWGSL/meshUVSpaceRenderer.fragment\";\r\nexport * from \"../ShadersWGSL/meshUVSpaceRendererMasker.vertex\";\r\nexport * from \"../ShadersWGSL/meshUVSpaceRendererMasker.fragment\";\r\nexport * from \"../ShadersWGSL/meshUVSpaceRendererFinaliser.fragment\";\r\nexport * from \"../ShadersWGSL/meshUVSpaceRendererFinaliser.vertex\";\r\n\r\nimport \"./abstractMesh.decalMap\";\r\nimport \"./thinInstanceMesh\";\r\n"]}
|
package/Meshes/pure.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ export * from "./Node/pure.js";
|
|
|
38
38
|
export * from "./GaussianSplatting/gaussianSplattingMeshBase.pure.js";
|
|
39
39
|
export * from "./GaussianSplatting/gaussianSplattingMesh.pure.js";
|
|
40
40
|
export * from "./GaussianSplatting/gaussianSplattingCompoundMesh.pure.js";
|
|
41
|
+
export * from "./GaussianSplatting/gaussianSplattingDebugger.pure.js";
|
|
41
42
|
export * from "./abstractMesh.decalMap.pure.js";
|
|
42
43
|
export * from "./GaussianSplatting/pure.js";
|
|
43
44
|
export * from "./GreasedLine/pure.js";
|
package/Meshes/pure.js
CHANGED
|
@@ -39,6 +39,7 @@ export * from "./Node/pure.js";
|
|
|
39
39
|
export * from "./GaussianSplatting/gaussianSplattingMeshBase.pure.js";
|
|
40
40
|
export * from "./GaussianSplatting/gaussianSplattingMesh.pure.js";
|
|
41
41
|
export * from "./GaussianSplatting/gaussianSplattingCompoundMesh.pure.js";
|
|
42
|
+
export * from "./GaussianSplatting/gaussianSplattingDebugger.pure.js";
|
|
42
43
|
export * from "./abstractMesh.decalMap.pure.js";
|
|
43
44
|
export * from "./GaussianSplatting/pure.js";
|
|
44
45
|
export * from "./GreasedLine/pure.js";
|
package/Meshes/pure.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pure.js","sourceRoot":"","sources":["../../../../dev/core/src/Meshes/pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,6DAA6D;AAC7D,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,OAAO,CAAC;AACtB,cAAc,4BAA4B,CAAC;AAC3C,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,yCAAyC,CAAC;AACxD,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oCAAoC,CAAC;AACnD,cAAc,0CAA0C,CAAC;AACzD,cAAc,mCAAmC,CAAC;AAClD,cAAc,QAAQ,CAAC;AACvB,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC;AAC5B,cAAc,oDAAoD,CAAC;AACnE,cAAc,gDAAgD,CAAC;AAC/D,cAAc,wDAAwD,CAAC;AACvE,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC","sourcesContent":["/** Pure barrel — re-exports only side-effect-free modules */\n/* eslint-disable @typescript-eslint/no-restricted-imports */\nexport * from \"./abstractMesh.pure\";\nexport * from \"./abstractMesh.hotSpot\";\nexport * from \"./Compression/pure\";\nexport * from \"./csg\";\nexport * from \"./meshUVSpaceRenderer.pure\";\nexport * from \"./geometry\";\nexport * from \"./groundMesh.pure\";\nexport * from \"./goldbergMesh.pure\";\nexport * from \"./trailMesh.pure\";\nexport * from \"./instancedMesh.pure\";\nexport * from \"./linesMesh.pure\";\nexport * from \"./mesh.pure\";\nexport * from \"./mesh.vertexData\";\nexport * from \"./meshBuilder\";\nexport * from \"./meshSimplification\";\nexport * from \"./meshSimplificationSceneComponent.pure\";\nexport * from \"./meshUtils\";\nexport * from \"./polygonMesh\";\nexport * from \"./geodesicMesh\";\nexport * from \"./subMesh.pure\";\nexport * from \"./subMesh.project.pure\";\nexport * from \"./lattice\";\nexport * from \"./lattice.material\";\nexport * from \"./meshLODLevel\";\nexport * from \"./transformNode.pure\";\nexport * from \"./Builders/pure\";\nexport * from \"./WebGL/webGLDataBuffer\";\nexport * from \"./WebGPU/webgpuDataBuffer\";\nexport * from \"./GreasedLine/greasedLineMesh.pure\";\nexport * from \"./GreasedLine/greasedLineRibbonMesh.pure\";\nexport * from \"./GreasedLine/greasedLineBaseMesh\";\nexport * from \"./csg2\";\nexport * from \"./mesh.vertexData.functions\";\nexport * from \"./mesh.vertexData.subdivide\";\nexport * from \"./thinInstanceMesh.pure\";\nexport * from \"./Node/pure\";\nexport * from \"./GaussianSplatting/gaussianSplattingMeshBase.pure\";\nexport * from \"./GaussianSplatting/gaussianSplattingMesh.pure\";\nexport * from \"./GaussianSplatting/gaussianSplattingCompoundMesh.pure\";\nexport * from \"./abstractMesh.decalMap.pure\";\nexport * from \"./GaussianSplatting/pure\";\nexport * from \"./GreasedLine/pure\";\n"]}
|
|
1
|
+
{"version":3,"file":"pure.js","sourceRoot":"","sources":["../../../../dev/core/src/Meshes/pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,6DAA6D;AAC7D,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,OAAO,CAAC;AACtB,cAAc,4BAA4B,CAAC;AAC3C,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,yCAAyC,CAAC;AACxD,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oCAAoC,CAAC;AACnD,cAAc,0CAA0C,CAAC;AACzD,cAAc,mCAAmC,CAAC;AAClD,cAAc,QAAQ,CAAC;AACvB,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC;AAC5B,cAAc,oDAAoD,CAAC;AACnE,cAAc,gDAAgD,CAAC;AAC/D,cAAc,wDAAwD,CAAC;AACvE,cAAc,oDAAoD,CAAC;AACnE,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC","sourcesContent":["/** Pure barrel — re-exports only side-effect-free modules */\n/* eslint-disable @typescript-eslint/no-restricted-imports */\nexport * from \"./abstractMesh.pure\";\nexport * from \"./abstractMesh.hotSpot\";\nexport * from \"./Compression/pure\";\nexport * from \"./csg\";\nexport * from \"./meshUVSpaceRenderer.pure\";\nexport * from \"./geometry\";\nexport * from \"./groundMesh.pure\";\nexport * from \"./goldbergMesh.pure\";\nexport * from \"./trailMesh.pure\";\nexport * from \"./instancedMesh.pure\";\nexport * from \"./linesMesh.pure\";\nexport * from \"./mesh.pure\";\nexport * from \"./mesh.vertexData\";\nexport * from \"./meshBuilder\";\nexport * from \"./meshSimplification\";\nexport * from \"./meshSimplificationSceneComponent.pure\";\nexport * from \"./meshUtils\";\nexport * from \"./polygonMesh\";\nexport * from \"./geodesicMesh\";\nexport * from \"./subMesh.pure\";\nexport * from \"./subMesh.project.pure\";\nexport * from \"./lattice\";\nexport * from \"./lattice.material\";\nexport * from \"./meshLODLevel\";\nexport * from \"./transformNode.pure\";\nexport * from \"./Builders/pure\";\nexport * from \"./WebGL/webGLDataBuffer\";\nexport * from \"./WebGPU/webgpuDataBuffer\";\nexport * from \"./GreasedLine/greasedLineMesh.pure\";\nexport * from \"./GreasedLine/greasedLineRibbonMesh.pure\";\nexport * from \"./GreasedLine/greasedLineBaseMesh\";\nexport * from \"./csg2\";\nexport * from \"./mesh.vertexData.functions\";\nexport * from \"./mesh.vertexData.subdivide\";\nexport * from \"./thinInstanceMesh.pure\";\nexport * from \"./Node/pure\";\nexport * from \"./GaussianSplatting/gaussianSplattingMeshBase.pure\";\nexport * from \"./GaussianSplatting/gaussianSplattingMesh.pure\";\nexport * from \"./GaussianSplatting/gaussianSplattingCompoundMesh.pure\";\nexport * from \"./GaussianSplatting/gaussianSplattingDebugger.pure\";\nexport * from \"./abstractMesh.decalMap.pure\";\nexport * from \"./GaussianSplatting/pure\";\nexport * from \"./GreasedLine/pure\";\n"]}
|
|
@@ -61,28 +61,28 @@ splat.rotationA=texture2D(rotationsATexture,splatUV);splat.rotationB=texture2D(r
|
|
|
61
61
|
#endif
|
|
62
62
|
return splat;}
|
|
63
63
|
#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)
|
|
64
|
-
vec3 computeColorFromSHDegree(vec3 dir,const vec3 sh[25])
|
|
64
|
+
vec3 computeColorFromSHDegree(vec3 dir,const vec3 sh[25],float _so1,float _so2,float _so3,float _so4)
|
|
65
65
|
{const float SH_C0=0.28209479;const float SH_C1=0.48860251;float SH_C2[5];SH_C2[0]=1.092548430;SH_C2[1]=-1.09254843;SH_C2[2]=0.315391565;SH_C2[3]=-1.09254843;SH_C2[4]=0.546274215;float SH_C3[7];SH_C3[0]=-0.59004358;SH_C3[1]=2.890611442;SH_C3[2]=-0.45704579;SH_C3[3]=0.373176332;SH_C3[4]=-0.45704579;SH_C3[5]=1.445305721;SH_C3[6]=-0.59004358;float SH_C4[9];SH_C4[0]= 2.5033429418;SH_C4[1]=-1.7701307698;SH_C4[2]= 0.9461746958;SH_C4[3]=-0.6690465436;SH_C4[4]= 0.1057855469;SH_C4[5]=-0.6690465436;SH_C4[6]= 0.4730873479;SH_C4[7]=-1.7701307698;SH_C4[8]= 0.6258357354;vec3 result=/*SH_C0**/sh[0];
|
|
66
66
|
#if SH_DEGREE>0
|
|
67
|
-
float x=dir.x;float y=dir.y;float z=dir.z;result
|
|
67
|
+
float x=dir.x;float y=dir.y;float z=dir.z;result+=_so1*(- SH_C1*y*sh[1]+SH_C1*z*sh[2]-SH_C1*x*sh[3]);
|
|
68
68
|
#if SH_DEGREE>1
|
|
69
|
-
float xx=x*x,yy=y*y,zz=z*z;float xy=x*y,yz=y*z,xz=x*z;result+=
|
|
69
|
+
float xx=x*x,yy=y*y,zz=z*z;float xy=x*y,yz=y*z,xz=x*z;result+=_so2*(
|
|
70
70
|
SH_C2[0]*xy*sh[4] +
|
|
71
71
|
SH_C2[1]*yz*sh[5] +
|
|
72
72
|
SH_C2[2]*(2.0*zz-xx-yy)*sh[6] +
|
|
73
73
|
SH_C2[3]*xz*sh[7] +
|
|
74
|
-
SH_C2[4]*(xx-yy)*sh[8];
|
|
74
|
+
SH_C2[4]*(xx-yy)*sh[8]);
|
|
75
75
|
#if SH_DEGREE>2
|
|
76
|
-
result+=
|
|
76
|
+
result+=_so3*(
|
|
77
77
|
SH_C3[0]*y*(3.0*xx-yy)*sh[9] +
|
|
78
78
|
SH_C3[1]*xy*z*sh[10] +
|
|
79
79
|
SH_C3[2]*y*(4.0*zz-xx-yy)*sh[11] +
|
|
80
80
|
SH_C3[3]*z*(2.0*zz-3.0*xx-3.0*yy)*sh[12] +
|
|
81
81
|
SH_C3[4]*x*(4.0*zz-xx-yy)*sh[13] +
|
|
82
82
|
SH_C3[5]*z*(xx-yy)*sh[14] +
|
|
83
|
-
SH_C3[6]*x*(xx-3.0*yy)*sh[15];
|
|
83
|
+
SH_C3[6]*x*(xx-3.0*yy)*sh[15]);
|
|
84
84
|
#if SH_DEGREE>3
|
|
85
|
-
result
|
|
85
|
+
result+=_so4*(
|
|
86
86
|
SH_C4[0]*x*y*(xx-yy)*sh[16] +
|
|
87
87
|
SH_C4[1]*y*z*(3.0*xx-yy)*sh[17] +
|
|
88
88
|
SH_C4[2]*x*y*(7.0*zz-1.0)*sh[18] +
|
|
@@ -91,7 +91,7 @@ SH_C4[4]*(zz*(35.0*zz-30.0)+3.0)*sh[20] +
|
|
|
91
91
|
SH_C4[5]*x*z*(7.0*zz-3.0)*sh[21] +
|
|
92
92
|
SH_C4[6]*(xx-yy)*(7.0*zz-1.0)*sh[22] +
|
|
93
93
|
SH_C4[7]*x*z*(xx-3.0*yy)*sh[23] +
|
|
94
|
-
SH_C4[8]*(xx*(xx-3.0*yy)-yy*(3.0*xx-yy))*sh[24];
|
|
94
|
+
SH_C4[8]*(xx*(xx-3.0*yy)-yy*(3.0*xx-yy))*sh[24]);
|
|
95
95
|
#endif
|
|
96
96
|
#endif
|
|
97
97
|
#endif
|
|
@@ -103,7 +103,7 @@ float((value ) & 255u),
|
|
|
103
103
|
float((value>>uint( 8)) & 255u),
|
|
104
104
|
float((value>>uint(16)) & 255u),
|
|
105
105
|
float((value>>uint(24)) & 255u));return components*vec4(2./255.)-vec4(1.);}
|
|
106
|
-
vec3
|
|
106
|
+
vec3 computeSHWeighted(Splat splat,vec3 dir,float _so1,float _so2,float _so3,float _so4)
|
|
107
107
|
{vec3 sh[25];sh[0]=vec3(0.,0.,0.);
|
|
108
108
|
#if SH_DEGREE>0
|
|
109
109
|
vec4 sh00=decompose(splat.sh0.x);vec4 sh01=decompose(splat.sh0.y);vec4 sh02=decompose(splat.sh0.z);sh[1]=vec3(sh00.x,sh00.y,sh00.z);sh[2]=vec3(sh00.w,sh01.x,sh01.y);sh[3]=vec3(sh01.z,sh01.w,sh02.x);
|
|
@@ -117,7 +117,30 @@ vec4 sh06=decompose(splat.sh1.z);vec4 sh07=decompose(splat.sh1.w);vec4 sh08=deco
|
|
|
117
117
|
#if SH_DEGREE>3
|
|
118
118
|
vec4 sh12=decompose(splat.sh3.x);vec4 sh13=decompose(splat.sh3.y);vec4 sh14=decompose(splat.sh3.z);vec4 sh15=decompose(splat.sh3.w);vec4 sh16=decompose(splat.sh4.x);vec4 sh17=decompose(splat.sh4.y);sh[16]=vec3(sh11.y,sh11.z,sh11.w);sh[17]=vec3(sh12.x,sh12.y,sh12.z);sh[18]=vec3(sh12.w,sh13.x,sh13.y);sh[19]=vec3(sh13.z,sh13.w,sh14.x);sh[20]=vec3(sh14.y,sh14.z,sh14.w);sh[21]=vec3(sh15.x,sh15.y,sh15.z);sh[22]=vec3(sh15.w,sh16.x,sh16.y);sh[23]=vec3(sh16.z,sh16.w,sh17.x);sh[24]=vec3(sh17.y,sh17.z,sh17.w);
|
|
119
119
|
#endif
|
|
120
|
-
return computeColorFromSHDegree(dir,sh);}
|
|
120
|
+
return computeColorFromSHDegree(dir,sh,_so1,_so2,_so3,_so4);}
|
|
121
|
+
vec3 computeSH(Splat splat,vec3 dir)
|
|
122
|
+
{
|
|
123
|
+
#if !defined(GS_DBG_ENABLED) || GS_DBG_SH_ORDER1==1
|
|
124
|
+
float _w1=1.0;
|
|
125
|
+
#else
|
|
126
|
+
float _w1=0.0;
|
|
127
|
+
#endif
|
|
128
|
+
#if !defined(GS_DBG_ENABLED) || GS_DBG_SH_ORDER2==1
|
|
129
|
+
float _w2=1.0;
|
|
130
|
+
#else
|
|
131
|
+
float _w2=0.0;
|
|
132
|
+
#endif
|
|
133
|
+
#if !defined(GS_DBG_ENABLED) || GS_DBG_SH_ORDER3==1
|
|
134
|
+
float _w3=1.0;
|
|
135
|
+
#else
|
|
136
|
+
float _w3=0.0;
|
|
137
|
+
#endif
|
|
138
|
+
#if !defined(GS_DBG_ENABLED) || GS_DBG_SH_ORDER4==1
|
|
139
|
+
float _w4=1.0;
|
|
140
|
+
#else
|
|
141
|
+
float _w4=0.0;
|
|
142
|
+
#endif
|
|
143
|
+
return computeSHWeighted(splat,dir,_w1,_w2,_w3,_w4);}
|
|
121
144
|
#else
|
|
122
145
|
vec3 computeSH(Splat splat,vec3 dir)
|
|
123
146
|
{return vec3(0.,0.,0.);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gaussianSplatting.js","sourceRoot":"","sources":["../../../../../dev/core/src/Shaders/ShadersInclude/gaussianSplatting.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,MAAM,IAAI,GAAG,mBAAmB,CAAC;AACjC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqKd,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,iBAAiB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\nconst name = \"gaussianSplatting\";\nconst shader = `#if !defined(WEBGL2) && !defined(WEBGPU) && !defined(NATIVE)\nmat3 transpose(mat3 matrix) {return mat3(matrix[0][0],matrix[1][0],matrix[2][0],\nmatrix[0][1],matrix[1][1],matrix[2][1],\nmatrix[0][2],matrix[1][2],matrix[2][2]);}\n#endif\nvec2 getDataUV(float index,vec2 textureSize) {float y=floor(index/textureSize.x);float x=index-y*textureSize.x;return vec2((x+0.5)/textureSize.x,(y+0.5)/textureSize.y);}\n#if SH_DEGREE>0 || IS_COMPOUND\nivec2 getDataUVint(float index,vec2 textureSize) {float y=floor(index/textureSize.x);float x=index-y*textureSize.x;return ivec2(uint(x+0.5),uint(y+0.5));}\n#endif\nstruct Splat {vec4 center;vec4 color;vec4 covA;vec4 covB;\n#if SH_DEGREE>0\nuvec4 sh0; \n#endif\n#if SH_DEGREE>1\nuvec4 sh1;\n#endif\n#if SH_DEGREE>2\nuvec4 sh2;\n#endif\n#if SH_DEGREE>3\nuvec4 sh3;uvec4 sh4;\n#endif\n#if IS_COMPOUND\nuint partIndex;\n#endif\n#if defined(IS_FOR_VOXELIZATION)\nvec4 rotationA;vec4 rotationB;vec4 rotationScale;\n#endif\n};float getSplatIndex(int localIndex)\n{float splatIndex;switch (localIndex)\n{case 0: splatIndex=splatIndex0.x; break;case 1: splatIndex=splatIndex0.y; break;case 2: splatIndex=splatIndex0.z; break;case 3: splatIndex=splatIndex0.w; break;case 4: splatIndex=splatIndex1.x; break;case 5: splatIndex=splatIndex1.y; break;case 6: splatIndex=splatIndex1.z; break;case 7: splatIndex=splatIndex1.w; break;case 8: splatIndex=splatIndex2.x; break;case 9: splatIndex=splatIndex2.y; break;case 10: splatIndex=splatIndex2.z; break;case 11: splatIndex=splatIndex2.w; break;case 12: splatIndex=splatIndex3.x; break;case 13: splatIndex=splatIndex3.y; break;case 14: splatIndex=splatIndex3.z; break;case 15: splatIndex=splatIndex3.w; break;}\nreturn splatIndex;}\nSplat readSplat(float splatIndex)\n{Splat splat;vec2 splatUV=getDataUV(splatIndex,dataTextureSize);splat.center=texture2D(centersTexture,splatUV);splat.color=texture2D(colorsTexture,splatUV);\n#if !defined(IS_FOR_VOXELIZATION)\nsplat.covA=texture2D(covariancesATexture,splatUV)*splat.center.w;splat.covB=texture2D(covariancesBTexture,splatUV)*splat.center.w;\n#endif\n#if SH_DEGREE>0 || IS_COMPOUND\nivec2 splatUVint=getDataUVint(splatIndex,dataTextureSize);\n#endif\n#if SH_DEGREE>0\nsplat.sh0=texelFetch(shTexture0,splatUVint,0);\n#endif\n#if SH_DEGREE>1\nsplat.sh1=texelFetch(shTexture1,splatUVint,0);\n#endif\n#if SH_DEGREE>2\nsplat.sh2=texelFetch(shTexture2,splatUVint,0);\n#endif\n#if SH_DEGREE>3\nsplat.sh3=texelFetch(shTexture3,splatUVint,0);splat.sh4=texelFetch(shTexture4,splatUVint,0);\n#endif\n#if IS_COMPOUND\nsplat.partIndex=uint(texture2D(partIndicesTexture,splatUV).r*255.0+0.5);\n#endif\n#if defined(IS_FOR_VOXELIZATION)\nsplat.rotationA=texture2D(rotationsATexture,splatUV);splat.rotationB=texture2D(rotationsBTexture,splatUV);splat.rotationScale=texture2D(rotationScaleTexture,splatUV);\n#endif\nreturn splat;}\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\nvec3 computeColorFromSHDegree(vec3 dir,const vec3 sh[25])\n{const float SH_C0=0.28209479;const float SH_C1=0.48860251;float SH_C2[5];SH_C2[0]=1.092548430;SH_C2[1]=-1.09254843;SH_C2[2]=0.315391565;SH_C2[3]=-1.09254843;SH_C2[4]=0.546274215;float SH_C3[7];SH_C3[0]=-0.59004358;SH_C3[1]=2.890611442;SH_C3[2]=-0.45704579;SH_C3[3]=0.373176332;SH_C3[4]=-0.45704579;SH_C3[5]=1.445305721;SH_C3[6]=-0.59004358;float SH_C4[9];SH_C4[0]= 2.5033429418;SH_C4[1]=-1.7701307698;SH_C4[2]= 0.9461746958;SH_C4[3]=-0.6690465436;SH_C4[4]= 0.1057855469;SH_C4[5]=-0.6690465436;SH_C4[6]= 0.4730873479;SH_C4[7]=-1.7701307698;SH_C4[8]= 0.6258357354;vec3 result=/*SH_C0**/sh[0];\n#if SH_DEGREE>0\nfloat x=dir.x;float y=dir.y;float z=dir.z;result+=- SH_C1*y*sh[1]+SH_C1*z*sh[2]-SH_C1*x*sh[3];\n#if SH_DEGREE>1\nfloat xx=x*x,yy=y*y,zz=z*z;float xy=x*y,yz=y*z,xz=x*z;result+=\nSH_C2[0]*xy*sh[4] +\nSH_C2[1]*yz*sh[5] +\nSH_C2[2]*(2.0*zz-xx-yy)*sh[6] +\nSH_C2[3]*xz*sh[7] +\nSH_C2[4]*(xx-yy)*sh[8];\n#if SH_DEGREE>2\nresult+=\nSH_C3[0]*y*(3.0*xx-yy)*sh[9] +\nSH_C3[1]*xy*z*sh[10] +\nSH_C3[2]*y*(4.0*zz-xx-yy)*sh[11] +\nSH_C3[3]*z*(2.0*zz-3.0*xx-3.0*yy)*sh[12] +\nSH_C3[4]*x*(4.0*zz-xx-yy)*sh[13] +\nSH_C3[5]*z*(xx-yy)*sh[14] +\nSH_C3[6]*x*(xx-3.0*yy)*sh[15];\n#if SH_DEGREE>3\nresult +=\nSH_C4[0]*x*y*(xx-yy)*sh[16] +\nSH_C4[1]*y*z*(3.0*xx-yy)*sh[17] +\nSH_C4[2]*x*y*(7.0*zz-1.0)*sh[18] +\nSH_C4[3]*y*z*(7.0*zz-3.0)*sh[19] +\nSH_C4[4]*(zz*(35.0*zz-30.0)+3.0)*sh[20] +\nSH_C4[5]*x*z*(7.0*zz-3.0)*sh[21] +\nSH_C4[6]*(xx-yy)*(7.0*zz-1.0)*sh[22] +\nSH_C4[7]*x*z*(xx-3.0*yy)*sh[23] +\nSH_C4[8]*(xx*(xx-3.0*yy)-yy*(3.0*xx-yy))*sh[24];\n#endif\n#endif\n#endif\n#endif\nreturn result;}\nvec4 decompose(uint value)\n{vec4 components=vec4(\nfloat((value ) & 255u),\nfloat((value>>uint( 8)) & 255u),\nfloat((value>>uint(16)) & 255u),\nfloat((value>>uint(24)) & 255u));return components*vec4(2./255.)-vec4(1.);}\nvec3 computeSH(Splat splat,vec3 dir)\n{vec3 sh[25];sh[0]=vec3(0.,0.,0.);\n#if SH_DEGREE>0\nvec4 sh00=decompose(splat.sh0.x);vec4 sh01=decompose(splat.sh0.y);vec4 sh02=decompose(splat.sh0.z);sh[1]=vec3(sh00.x,sh00.y,sh00.z);sh[2]=vec3(sh00.w,sh01.x,sh01.y);sh[3]=vec3(sh01.z,sh01.w,sh02.x);\n#endif\n#if SH_DEGREE>1\nvec4 sh03=decompose(splat.sh0.w);vec4 sh04=decompose(splat.sh1.x);vec4 sh05=decompose(splat.sh1.y);sh[4]=vec3(sh02.y,sh02.z,sh02.w);sh[5]=vec3(sh03.x,sh03.y,sh03.z);sh[6]=vec3(sh03.w,sh04.x,sh04.y);sh[7]=vec3(sh04.z,sh04.w,sh05.x);sh[8]=vec3(sh05.y,sh05.z,sh05.w);\n#endif\n#if SH_DEGREE>2\nvec4 sh06=decompose(splat.sh1.z);vec4 sh07=decompose(splat.sh1.w);vec4 sh08=decompose(splat.sh2.x);vec4 sh09=decompose(splat.sh2.y);vec4 sh10=decompose(splat.sh2.z);vec4 sh11=decompose(splat.sh2.w);sh[9]=vec3(sh06.x,sh06.y,sh06.z);sh[10]=vec3(sh06.w,sh07.x,sh07.y);sh[11]=vec3(sh07.z,sh07.w,sh08.x);sh[12]=vec3(sh08.y,sh08.z,sh08.w);sh[13]=vec3(sh09.x,sh09.y,sh09.z);sh[14]=vec3(sh09.w,sh10.x,sh10.y);sh[15]=vec3(sh10.z,sh10.w,sh11.x);\n#endif\n#if SH_DEGREE>3\nvec4 sh12=decompose(splat.sh3.x);vec4 sh13=decompose(splat.sh3.y);vec4 sh14=decompose(splat.sh3.z);vec4 sh15=decompose(splat.sh3.w);vec4 sh16=decompose(splat.sh4.x);vec4 sh17=decompose(splat.sh4.y);sh[16]=vec3(sh11.y,sh11.z,sh11.w);sh[17]=vec3(sh12.x,sh12.y,sh12.z);sh[18]=vec3(sh12.w,sh13.x,sh13.y);sh[19]=vec3(sh13.z,sh13.w,sh14.x);sh[20]=vec3(sh14.y,sh14.z,sh14.w);sh[21]=vec3(sh15.x,sh15.y,sh15.z);sh[22]=vec3(sh15.w,sh16.x,sh16.y);sh[23]=vec3(sh16.z,sh16.w,sh17.x);sh[24]=vec3(sh17.y,sh17.z,sh17.w);\n#endif\nreturn computeColorFromSHDegree(dir,sh);}\n#else\nvec3 computeSH(Splat splat,vec3 dir)\n{return vec3(0.,0.,0.);}\n#endif\n#if !defined(IS_FOR_VOXELIZATION)\nvec4 gaussianSplatting(vec2 meshPos,vec3 worldPos,vec2 scale,vec3 covA,vec3 covB,mat4 worldMatrix,mat4 viewMatrix,mat4 projectionMatrix)\n{mat4 modelView=viewMatrix*worldMatrix;vec4 camspace=viewMatrix*vec4(worldPos,1.);vec4 pos2d=projectionMatrix*camspace;float bounds=1.2*pos2d.w;if (pos2d.z<-pos2d.w || pos2d.x<-bounds || pos2d.x>bounds\n|| pos2d.y<-bounds || pos2d.y>bounds) {return vec4(0.0,0.0,2.0,1.0);}\nmat3 Vrk=mat3(\ncovA.x,covA.y,covA.z,\ncovA.y,covB.x,covB.y,\ncovA.z,covB.y,covB.z\n);bool isOrtho=abs(projectionMatrix[3][3]-1.0)<0.001;mat3 J;if (isOrtho) {J=mat3(\nfocal.x,0.,0.,\n0.,focal.y,0.,\n0.,0.,0.\n);} else {J=mat3(\nfocal.x/camspace.z,0.,-(focal.x*camspace.x)/(camspace.z*camspace.z),\n0.,focal.y/camspace.z,-(focal.y*camspace.y)/(camspace.z*camspace.z),\n0.,0.,0.\n);}\nmat3 T=transpose(mat3(modelView))*J;mat3 cov2d=transpose(T)*Vrk*T;\n#if COMPENSATION\nfloat c00=cov2d[0][0];float c11=cov2d[1][1];float c01=cov2d[0][1];float detOrig=c00*c11-c01*c01;\n#endif\ncov2d[0][0]+=kernelSize;cov2d[1][1]+=kernelSize;\n#if COMPENSATION\nvec3 c2d=vec3(cov2d[0][0],c01,cov2d[1][1]);float detBlur=c2d.x*c2d.z-c2d.y*c2d.y;float compensation=sqrt(max(0.,detOrig/detBlur));vColor.w*=compensation;\n#endif\nfloat mid=(cov2d[0][0]+cov2d[1][1])/2.0;float radius=length(vec2((cov2d[0][0]-cov2d[1][1])/2.0,cov2d[0][1]));float epsilon=0.0001;float lambda1=mid+radius+epsilon,lambda2=mid-radius+epsilon;if (lambda2<0.0)\n{return vec4(0.0,0.0,2.0,1.0);}\nvec2 diagonalVector=normalize(vec2(cov2d[0][1],lambda1-cov2d[0][0]));vec2 majorAxis=min(sqrt(2.0*lambda1),1024.0)*diagonalVector;vec2 minorAxis=min(sqrt(2.0*lambda2),1024.0)*vec2(diagonalVector.y,-diagonalVector.x);vec2 vCenter=vec2(pos2d);float scaleFactor=isOrtho ? 1.0 : pos2d.w;return vec4(\nvCenter \n+ ((meshPos.x*majorAxis\n+ meshPos.y*minorAxis)*invViewport*scaleFactor)*scale,pos2d.zw);}\n#endif\n#if IS_COMPOUND\nmat4 getPartWorld(uint partIndex) {return partWorld[partIndex];}\n#endif\n#if defined(IS_FOR_VOXELIZATION)\nvec4 computeVoxelSplatWorldPos(vec4 rotationA,vec4 rotationB,vec4 rotationScale,vec3 center,mat4 splatWorld,mat4 viewMatrix,mat4 invWorldScale,vec2 quadPos) {mat3 splatRotation=mat3(\nvec3(rotationA.x,rotationA.y,rotationA.z),\nvec3(rotationA.w,rotationB.x,rotationB.y),\nvec3(rotationB.z,rotationB.w,rotationScale.x)\n);vec3 splatScale=vec3(rotationScale.y,rotationScale.z,rotationScale.w);mat3 rotToView=mat3(viewMatrix)*mat3(invWorldScale)*mat3(splatWorld)*splatRotation;vec3 axisLengthInViewZ=abs(vec3(rotToView[0][2],rotToView[1][2],rotToView[2][2]));float gaussianSplatCutoffStddev=1.4142135624/2.0; \nvec3 offsetSplatSpace;if (axisLengthInViewZ.x>axisLengthInViewZ.y && axisLengthInViewZ.x>axisLengthInViewZ.z) {offsetSplatSpace=vec3(0.0,quadPos.x,quadPos.y)*splatScale*gaussianSplatCutoffStddev;} else if (axisLengthInViewZ.y>axisLengthInViewZ.z) {offsetSplatSpace=vec3(quadPos.x,0.0,quadPos.y)*splatScale*gaussianSplatCutoffStddev;} else {offsetSplatSpace=vec3(quadPos.x,quadPos.y,0.0)*splatScale*gaussianSplatCutoffStddev;}\nvec3 vertexObjectSpace=center+splatRotation*offsetSplatSpace;return splatWorld*vec4(vertexObjectSpace,1.0);}\n#endif\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStore[name]) {\n ShaderStore.IncludesShadersStore[name] = shader;\n}\n/** @internal */\nexport const gaussianSplatting = { name, shader };\n"]}
|
|
1
|
+
{"version":3,"file":"gaussianSplatting.js","sourceRoot":"","sources":["../../../../../dev/core/src/Shaders/ShadersInclude/gaussianSplatting.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,MAAM,IAAI,GAAG,mBAAmB,CAAC;AACjC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4Ld,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,iBAAiB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\nconst name = \"gaussianSplatting\";\nconst shader = `#if !defined(WEBGL2) && !defined(WEBGPU) && !defined(NATIVE)\nmat3 transpose(mat3 matrix) {return mat3(matrix[0][0],matrix[1][0],matrix[2][0],\nmatrix[0][1],matrix[1][1],matrix[2][1],\nmatrix[0][2],matrix[1][2],matrix[2][2]);}\n#endif\nvec2 getDataUV(float index,vec2 textureSize) {float y=floor(index/textureSize.x);float x=index-y*textureSize.x;return vec2((x+0.5)/textureSize.x,(y+0.5)/textureSize.y);}\n#if SH_DEGREE>0 || IS_COMPOUND\nivec2 getDataUVint(float index,vec2 textureSize) {float y=floor(index/textureSize.x);float x=index-y*textureSize.x;return ivec2(uint(x+0.5),uint(y+0.5));}\n#endif\nstruct Splat {vec4 center;vec4 color;vec4 covA;vec4 covB;\n#if SH_DEGREE>0\nuvec4 sh0; \n#endif\n#if SH_DEGREE>1\nuvec4 sh1;\n#endif\n#if SH_DEGREE>2\nuvec4 sh2;\n#endif\n#if SH_DEGREE>3\nuvec4 sh3;uvec4 sh4;\n#endif\n#if IS_COMPOUND\nuint partIndex;\n#endif\n#if defined(IS_FOR_VOXELIZATION)\nvec4 rotationA;vec4 rotationB;vec4 rotationScale;\n#endif\n};float getSplatIndex(int localIndex)\n{float splatIndex;switch (localIndex)\n{case 0: splatIndex=splatIndex0.x; break;case 1: splatIndex=splatIndex0.y; break;case 2: splatIndex=splatIndex0.z; break;case 3: splatIndex=splatIndex0.w; break;case 4: splatIndex=splatIndex1.x; break;case 5: splatIndex=splatIndex1.y; break;case 6: splatIndex=splatIndex1.z; break;case 7: splatIndex=splatIndex1.w; break;case 8: splatIndex=splatIndex2.x; break;case 9: splatIndex=splatIndex2.y; break;case 10: splatIndex=splatIndex2.z; break;case 11: splatIndex=splatIndex2.w; break;case 12: splatIndex=splatIndex3.x; break;case 13: splatIndex=splatIndex3.y; break;case 14: splatIndex=splatIndex3.z; break;case 15: splatIndex=splatIndex3.w; break;}\nreturn splatIndex;}\nSplat readSplat(float splatIndex)\n{Splat splat;vec2 splatUV=getDataUV(splatIndex,dataTextureSize);splat.center=texture2D(centersTexture,splatUV);splat.color=texture2D(colorsTexture,splatUV);\n#if !defined(IS_FOR_VOXELIZATION)\nsplat.covA=texture2D(covariancesATexture,splatUV)*splat.center.w;splat.covB=texture2D(covariancesBTexture,splatUV)*splat.center.w;\n#endif\n#if SH_DEGREE>0 || IS_COMPOUND\nivec2 splatUVint=getDataUVint(splatIndex,dataTextureSize);\n#endif\n#if SH_DEGREE>0\nsplat.sh0=texelFetch(shTexture0,splatUVint,0);\n#endif\n#if SH_DEGREE>1\nsplat.sh1=texelFetch(shTexture1,splatUVint,0);\n#endif\n#if SH_DEGREE>2\nsplat.sh2=texelFetch(shTexture2,splatUVint,0);\n#endif\n#if SH_DEGREE>3\nsplat.sh3=texelFetch(shTexture3,splatUVint,0);splat.sh4=texelFetch(shTexture4,splatUVint,0);\n#endif\n#if IS_COMPOUND\nsplat.partIndex=uint(texture2D(partIndicesTexture,splatUV).r*255.0+0.5);\n#endif\n#if defined(IS_FOR_VOXELIZATION)\nsplat.rotationA=texture2D(rotationsATexture,splatUV);splat.rotationB=texture2D(rotationsBTexture,splatUV);splat.rotationScale=texture2D(rotationScaleTexture,splatUV);\n#endif\nreturn splat;}\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\nvec3 computeColorFromSHDegree(vec3 dir,const vec3 sh[25],float _so1,float _so2,float _so3,float _so4)\n{const float SH_C0=0.28209479;const float SH_C1=0.48860251;float SH_C2[5];SH_C2[0]=1.092548430;SH_C2[1]=-1.09254843;SH_C2[2]=0.315391565;SH_C2[3]=-1.09254843;SH_C2[4]=0.546274215;float SH_C3[7];SH_C3[0]=-0.59004358;SH_C3[1]=2.890611442;SH_C3[2]=-0.45704579;SH_C3[3]=0.373176332;SH_C3[4]=-0.45704579;SH_C3[5]=1.445305721;SH_C3[6]=-0.59004358;float SH_C4[9];SH_C4[0]= 2.5033429418;SH_C4[1]=-1.7701307698;SH_C4[2]= 0.9461746958;SH_C4[3]=-0.6690465436;SH_C4[4]= 0.1057855469;SH_C4[5]=-0.6690465436;SH_C4[6]= 0.4730873479;SH_C4[7]=-1.7701307698;SH_C4[8]= 0.6258357354;vec3 result=/*SH_C0**/sh[0];\n#if SH_DEGREE>0\nfloat x=dir.x;float y=dir.y;float z=dir.z;result+=_so1*(- SH_C1*y*sh[1]+SH_C1*z*sh[2]-SH_C1*x*sh[3]);\n#if SH_DEGREE>1\nfloat xx=x*x,yy=y*y,zz=z*z;float xy=x*y,yz=y*z,xz=x*z;result+=_so2*(\nSH_C2[0]*xy*sh[4] +\nSH_C2[1]*yz*sh[5] +\nSH_C2[2]*(2.0*zz-xx-yy)*sh[6] +\nSH_C2[3]*xz*sh[7] +\nSH_C2[4]*(xx-yy)*sh[8]);\n#if SH_DEGREE>2\nresult+=_so3*(\nSH_C3[0]*y*(3.0*xx-yy)*sh[9] +\nSH_C3[1]*xy*z*sh[10] +\nSH_C3[2]*y*(4.0*zz-xx-yy)*sh[11] +\nSH_C3[3]*z*(2.0*zz-3.0*xx-3.0*yy)*sh[12] +\nSH_C3[4]*x*(4.0*zz-xx-yy)*sh[13] +\nSH_C3[5]*z*(xx-yy)*sh[14] +\nSH_C3[6]*x*(xx-3.0*yy)*sh[15]);\n#if SH_DEGREE>3\nresult+=_so4*(\nSH_C4[0]*x*y*(xx-yy)*sh[16] +\nSH_C4[1]*y*z*(3.0*xx-yy)*sh[17] +\nSH_C4[2]*x*y*(7.0*zz-1.0)*sh[18] +\nSH_C4[3]*y*z*(7.0*zz-3.0)*sh[19] +\nSH_C4[4]*(zz*(35.0*zz-30.0)+3.0)*sh[20] +\nSH_C4[5]*x*z*(7.0*zz-3.0)*sh[21] +\nSH_C4[6]*(xx-yy)*(7.0*zz-1.0)*sh[22] +\nSH_C4[7]*x*z*(xx-3.0*yy)*sh[23] +\nSH_C4[8]*(xx*(xx-3.0*yy)-yy*(3.0*xx-yy))*sh[24]);\n#endif\n#endif\n#endif\n#endif\nreturn result;}\nvec4 decompose(uint value)\n{vec4 components=vec4(\nfloat((value ) & 255u),\nfloat((value>>uint( 8)) & 255u),\nfloat((value>>uint(16)) & 255u),\nfloat((value>>uint(24)) & 255u));return components*vec4(2./255.)-vec4(1.);}\nvec3 computeSHWeighted(Splat splat,vec3 dir,float _so1,float _so2,float _so3,float _so4)\n{vec3 sh[25];sh[0]=vec3(0.,0.,0.);\n#if SH_DEGREE>0\nvec4 sh00=decompose(splat.sh0.x);vec4 sh01=decompose(splat.sh0.y);vec4 sh02=decompose(splat.sh0.z);sh[1]=vec3(sh00.x,sh00.y,sh00.z);sh[2]=vec3(sh00.w,sh01.x,sh01.y);sh[3]=vec3(sh01.z,sh01.w,sh02.x);\n#endif\n#if SH_DEGREE>1\nvec4 sh03=decompose(splat.sh0.w);vec4 sh04=decompose(splat.sh1.x);vec4 sh05=decompose(splat.sh1.y);sh[4]=vec3(sh02.y,sh02.z,sh02.w);sh[5]=vec3(sh03.x,sh03.y,sh03.z);sh[6]=vec3(sh03.w,sh04.x,sh04.y);sh[7]=vec3(sh04.z,sh04.w,sh05.x);sh[8]=vec3(sh05.y,sh05.z,sh05.w);\n#endif\n#if SH_DEGREE>2\nvec4 sh06=decompose(splat.sh1.z);vec4 sh07=decompose(splat.sh1.w);vec4 sh08=decompose(splat.sh2.x);vec4 sh09=decompose(splat.sh2.y);vec4 sh10=decompose(splat.sh2.z);vec4 sh11=decompose(splat.sh2.w);sh[9]=vec3(sh06.x,sh06.y,sh06.z);sh[10]=vec3(sh06.w,sh07.x,sh07.y);sh[11]=vec3(sh07.z,sh07.w,sh08.x);sh[12]=vec3(sh08.y,sh08.z,sh08.w);sh[13]=vec3(sh09.x,sh09.y,sh09.z);sh[14]=vec3(sh09.w,sh10.x,sh10.y);sh[15]=vec3(sh10.z,sh10.w,sh11.x);\n#endif\n#if SH_DEGREE>3\nvec4 sh12=decompose(splat.sh3.x);vec4 sh13=decompose(splat.sh3.y);vec4 sh14=decompose(splat.sh3.z);vec4 sh15=decompose(splat.sh3.w);vec4 sh16=decompose(splat.sh4.x);vec4 sh17=decompose(splat.sh4.y);sh[16]=vec3(sh11.y,sh11.z,sh11.w);sh[17]=vec3(sh12.x,sh12.y,sh12.z);sh[18]=vec3(sh12.w,sh13.x,sh13.y);sh[19]=vec3(sh13.z,sh13.w,sh14.x);sh[20]=vec3(sh14.y,sh14.z,sh14.w);sh[21]=vec3(sh15.x,sh15.y,sh15.z);sh[22]=vec3(sh15.w,sh16.x,sh16.y);sh[23]=vec3(sh16.z,sh16.w,sh17.x);sh[24]=vec3(sh17.y,sh17.z,sh17.w);\n#endif\nreturn computeColorFromSHDegree(dir,sh,_so1,_so2,_so3,_so4);}\nvec3 computeSH(Splat splat,vec3 dir)\n{\n#if !defined(GS_DBG_ENABLED) || GS_DBG_SH_ORDER1==1\nfloat _w1=1.0;\n#else\nfloat _w1=0.0;\n#endif\n#if !defined(GS_DBG_ENABLED) || GS_DBG_SH_ORDER2==1\nfloat _w2=1.0;\n#else\nfloat _w2=0.0;\n#endif\n#if !defined(GS_DBG_ENABLED) || GS_DBG_SH_ORDER3==1\nfloat _w3=1.0;\n#else\nfloat _w3=0.0;\n#endif\n#if !defined(GS_DBG_ENABLED) || GS_DBG_SH_ORDER4==1\nfloat _w4=1.0;\n#else\nfloat _w4=0.0;\n#endif\nreturn computeSHWeighted(splat,dir,_w1,_w2,_w3,_w4);}\n#else\nvec3 computeSH(Splat splat,vec3 dir)\n{return vec3(0.,0.,0.);}\n#endif\n#if !defined(IS_FOR_VOXELIZATION)\nvec4 gaussianSplatting(vec2 meshPos,vec3 worldPos,vec2 scale,vec3 covA,vec3 covB,mat4 worldMatrix,mat4 viewMatrix,mat4 projectionMatrix)\n{mat4 modelView=viewMatrix*worldMatrix;vec4 camspace=viewMatrix*vec4(worldPos,1.);vec4 pos2d=projectionMatrix*camspace;float bounds=1.2*pos2d.w;if (pos2d.z<-pos2d.w || pos2d.x<-bounds || pos2d.x>bounds\n|| pos2d.y<-bounds || pos2d.y>bounds) {return vec4(0.0,0.0,2.0,1.0);}\nmat3 Vrk=mat3(\ncovA.x,covA.y,covA.z,\ncovA.y,covB.x,covB.y,\ncovA.z,covB.y,covB.z\n);bool isOrtho=abs(projectionMatrix[3][3]-1.0)<0.001;mat3 J;if (isOrtho) {J=mat3(\nfocal.x,0.,0.,\n0.,focal.y,0.,\n0.,0.,0.\n);} else {J=mat3(\nfocal.x/camspace.z,0.,-(focal.x*camspace.x)/(camspace.z*camspace.z),\n0.,focal.y/camspace.z,-(focal.y*camspace.y)/(camspace.z*camspace.z),\n0.,0.,0.\n);}\nmat3 T=transpose(mat3(modelView))*J;mat3 cov2d=transpose(T)*Vrk*T;\n#if COMPENSATION\nfloat c00=cov2d[0][0];float c11=cov2d[1][1];float c01=cov2d[0][1];float detOrig=c00*c11-c01*c01;\n#endif\ncov2d[0][0]+=kernelSize;cov2d[1][1]+=kernelSize;\n#if COMPENSATION\nvec3 c2d=vec3(cov2d[0][0],c01,cov2d[1][1]);float detBlur=c2d.x*c2d.z-c2d.y*c2d.y;float compensation=sqrt(max(0.,detOrig/detBlur));vColor.w*=compensation;\n#endif\nfloat mid=(cov2d[0][0]+cov2d[1][1])/2.0;float radius=length(vec2((cov2d[0][0]-cov2d[1][1])/2.0,cov2d[0][1]));float epsilon=0.0001;float lambda1=mid+radius+epsilon,lambda2=mid-radius+epsilon;if (lambda2<0.0)\n{return vec4(0.0,0.0,2.0,1.0);}\nvec2 diagonalVector=normalize(vec2(cov2d[0][1],lambda1-cov2d[0][0]));vec2 majorAxis=min(sqrt(2.0*lambda1),1024.0)*diagonalVector;vec2 minorAxis=min(sqrt(2.0*lambda2),1024.0)*vec2(diagonalVector.y,-diagonalVector.x);vec2 vCenter=vec2(pos2d);float scaleFactor=isOrtho ? 1.0 : pos2d.w;return vec4(\nvCenter \n+ ((meshPos.x*majorAxis\n+ meshPos.y*minorAxis)*invViewport*scaleFactor)*scale,pos2d.zw);}\n#endif\n#if IS_COMPOUND\nmat4 getPartWorld(uint partIndex) {return partWorld[partIndex];}\n#endif\n#if defined(IS_FOR_VOXELIZATION)\nvec4 computeVoxelSplatWorldPos(vec4 rotationA,vec4 rotationB,vec4 rotationScale,vec3 center,mat4 splatWorld,mat4 viewMatrix,mat4 invWorldScale,vec2 quadPos) {mat3 splatRotation=mat3(\nvec3(rotationA.x,rotationA.y,rotationA.z),\nvec3(rotationA.w,rotationB.x,rotationB.y),\nvec3(rotationB.z,rotationB.w,rotationScale.x)\n);vec3 splatScale=vec3(rotationScale.y,rotationScale.z,rotationScale.w);mat3 rotToView=mat3(viewMatrix)*mat3(invWorldScale)*mat3(splatWorld)*splatRotation;vec3 axisLengthInViewZ=abs(vec3(rotToView[0][2],rotToView[1][2],rotToView[2][2]));float gaussianSplatCutoffStddev=1.4142135624/2.0; \nvec3 offsetSplatSpace;if (axisLengthInViewZ.x>axisLengthInViewZ.y && axisLengthInViewZ.x>axisLengthInViewZ.z) {offsetSplatSpace=vec3(0.0,quadPos.x,quadPos.y)*splatScale*gaussianSplatCutoffStddev;} else if (axisLengthInViewZ.y>axisLengthInViewZ.z) {offsetSplatSpace=vec3(quadPos.x,0.0,quadPos.y)*splatScale*gaussianSplatCutoffStddev;} else {offsetSplatSpace=vec3(quadPos.x,quadPos.y,0.0)*splatScale*gaussianSplatCutoffStddev;}\nvec3 vertexObjectSpace=center+splatRotation*offsetSplatSpace;return splatWorld*vec4(vertexObjectSpace,1.0);}\n#endif\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStore[name]) {\n ShaderStore.IncludesShadersStore[name] = shader;\n}\n/** @internal */\nexport const gaussianSplatting = { name, shader };\n"]}
|
|
@@ -54,7 +54,26 @@ mat4 splatWorld=world;
|
|
|
54
54
|
#endif
|
|
55
55
|
vec4 worldPos=splatWorld*vec4(splat.center.xyz,1.0);vColor=splat.color;vPosition=position.xy;
|
|
56
56
|
#if SH_DEGREE>0
|
|
57
|
-
mat3 worldRot=mat3(splatWorld);mat3 normWorldRot=inverseMat3(worldRot);vec3 eyeToSplatLocalSpace=normalize(normWorldRot*(worldPos.xyz-eyePosition));
|
|
57
|
+
mat3 worldRot=mat3(splatWorld);mat3 normWorldRot=inverseMat3(worldRot);vec3 eyeToSplatLocalSpace=normalize(normWorldRot*(worldPos.xyz-eyePosition));
|
|
58
|
+
#if defined(GS_DBG_ENABLED) && IS_COMPOUND
|
|
59
|
+
{vec4 _row3=texelFetch(dbgPartData,ivec2(int(splat.partIndex),3),0);
|
|
60
|
+
#if SH_DEGREE>3
|
|
61
|
+
float _so4=texelFetch(dbgPartData,ivec2(int(splat.partIndex),4),0).x;
|
|
62
|
+
#else
|
|
63
|
+
float _so4=1.0;
|
|
64
|
+
#endif
|
|
65
|
+
vColor.xyz=_row3.x*splat.color.xyz+computeSHWeighted(splat,eyeToSplatLocalSpace,_row3.y,_row3.z,_row3.w,_so4);}
|
|
66
|
+
#elif defined(GS_DBG_ENABLED) && GS_DBG_SH_DC==0
|
|
67
|
+
vColor.xyz=computeSH(splat,eyeToSplatLocalSpace);
|
|
68
|
+
#else
|
|
69
|
+
vColor.xyz=splat.color.xyz+computeSH(splat,eyeToSplatLocalSpace);
|
|
70
|
+
#endif
|
|
71
|
+
#else
|
|
72
|
+
#if defined(GS_DBG_ENABLED) && IS_COMPOUND
|
|
73
|
+
{float _shDc=texelFetch(dbgPartData,ivec2(int(splat.partIndex),3),0).x;vColor.xyz=_shDc*splat.color.xyz;}
|
|
74
|
+
#elif defined(GS_DBG_ENABLED) && GS_DBG_SH_DC==0
|
|
75
|
+
vColor.xyz=vec3(0.0);
|
|
76
|
+
#endif
|
|
58
77
|
#endif
|
|
59
78
|
vColor.w*=alpha;
|
|
60
79
|
#if IS_COMPOUND
|
|
@@ -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,EAAE,kCAAkC,EAAE,MAAM,qDAAqD,CAAC;AACzG,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,+BAA+B,EAAE,MAAM,kDAAkD,CAAC;AACnG,OAAO,EAAE,0BAA0B,EAAE,MAAM,6CAA6C,CAAC;AACzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE,MAAM,IAAI,GAAG,+BAA+B,CAAC;AAC7C,MAAM,MAAM,GAAG
|
|
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,EAAE,kCAAkC,EAAE,MAAM,qDAAqD,CAAC;AACzG,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,+BAA+B,EAAE,MAAM,kDAAkD,CAAC;AACnG,OAAO,EAAE,0BAA0B,EAAE,MAAM,6CAA6C,CAAC;AACzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE,MAAM,IAAI,GAAG,+BAA+B,CAAC;AAC7C,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0Ed,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,MAAM,QAAQ,GAAG,CAAC,kCAAkC,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,+BAA+B,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,eAAe,EAAE,iBAAiB,EAAE,eAAe,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC;AACvR,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;IACzB,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9C,WAAW,CAAC,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC;IAC5D,CAAC;AACL,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,6BAA6B,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\nimport { gaussianSplattingVertexDeclaration } from \"./ShadersInclude/gaussianSplattingVertexDeclaration\";\nimport { sceneUboDeclaration } from \"./ShadersInclude/sceneUboDeclaration\";\nimport { meshUboDeclaration } from \"./ShadersInclude/meshUboDeclaration\";\nimport { gaussianSplattingUboDeclaration } from \"./ShadersInclude/gaussianSplattingUboDeclaration\";\nimport { clipPlaneVertexDeclaration } from \"./ShadersInclude/clipPlaneVertexDeclaration\";\nimport { fogVertexDeclaration } from \"./ShadersInclude/fogVertexDeclaration\";\nimport { logDepthDeclaration } from \"./ShadersInclude/logDepthDeclaration\";\nimport { helperFunctions } from \"./ShadersInclude/helperFunctions\";\nimport { gaussianSplatting } from \"./ShadersInclude/gaussianSplatting\";\nimport { clipPlaneVertex } from \"./ShadersInclude/clipPlaneVertex\";\nimport { fogVertex } from \"./ShadersInclude/fogVertex\";\nimport { logDepthVertex } from \"./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>\nuniform vec2 invViewport;uniform vec2 dataTextureSize;uniform vec2 focal;uniform float kernelSize;uniform vec3 eyePosition;uniform float alpha;\n#if IS_COMPOUND\nuniform mat4 partWorld[MAX_PART_COUNT];uniform float partVisibility[MAX_PART_COUNT];\n#endif\nuniform 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\n#if SH_DEGREE>3\nuniform highp usampler2D shTexture3;uniform highp usampler2D shTexture4;\n#endif\n#if IS_COMPOUND\nuniform sampler2D partIndicesTexture;\n#endif\nvarying vec4 vColor;varying vec2 vPosition;\n#define CUSTOM_VERTEX_DEFINITIONS\n#include<gaussianSplatting>\nvoid main () {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nfloat splatIndex=getSplatIndex(int(position.z+0.5));Splat splat=readSplat(splatIndex);vec3 covA=splat.covA.xyz;vec3 covB=vec3(splat.covA.w,splat.covB.xy);\n#if IS_COMPOUND\nmat4 splatWorld=getPartWorld(splat.partIndex);\n#else\nmat4 splatWorld=world;\n#endif\nvec4 worldPos=splatWorld*vec4(splat.center.xyz,1.0);vColor=splat.color;vPosition=position.xy;\n#if SH_DEGREE>0\nmat3 worldRot=mat3(splatWorld);mat3 normWorldRot=inverseMat3(worldRot);vec3 eyeToSplatLocalSpace=normalize(normWorldRot*(worldPos.xyz-eyePosition));\n#if defined(GS_DBG_ENABLED) && IS_COMPOUND\n{vec4 _row3=texelFetch(dbgPartData,ivec2(int(splat.partIndex),3),0);\n#if SH_DEGREE>3\nfloat _so4=texelFetch(dbgPartData,ivec2(int(splat.partIndex),4),0).x;\n#else\nfloat _so4=1.0;\n#endif\nvColor.xyz=_row3.x*splat.color.xyz+computeSHWeighted(splat,eyeToSplatLocalSpace,_row3.y,_row3.z,_row3.w,_so4);}\n#elif defined(GS_DBG_ENABLED) && GS_DBG_SH_DC==0\nvColor.xyz=computeSH(splat,eyeToSplatLocalSpace);\n#else\nvColor.xyz=splat.color.xyz+computeSH(splat,eyeToSplatLocalSpace);\n#endif\n#else\n#if defined(GS_DBG_ENABLED) && IS_COMPOUND\n{float _shDc=texelFetch(dbgPartData,ivec2(int(splat.partIndex),3),0).x;vColor.xyz=_shDc*splat.color.xyz;}\n#elif defined(GS_DBG_ENABLED) && GS_DBG_SH_DC==0\nvColor.xyz=vec3(0.0);\n#endif\n#endif\nvColor.w*=alpha;\n#if IS_COMPOUND\nvColor.w*=partVisibility[splat.partIndex];\n#endif\nvec2 scale=vec2(1.,1.);\n#define CUSTOM_VERTEX_UPDATE\ngl_Position=gaussianSplatting(position.xy,worldPos.xyz,scale,covA,covB,splatWorld,view,projection);\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<logDepthVertex>\n#define CUSTOM_VERTEX_MAIN_END\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStore[name]) {\n ShaderStore.ShadersStore[name] = shader;\n}\nconst includes = [gaussianSplattingVertexDeclaration, sceneUboDeclaration, meshUboDeclaration, gaussianSplattingUboDeclaration, clipPlaneVertexDeclaration, fogVertexDeclaration, logDepthDeclaration, helperFunctions, gaussianSplatting, clipPlaneVertex, fogVertex, logDepthVertex];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStore[inc.name]) {\n ShaderStore.IncludesShadersStore[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const gaussianSplattingVertexShader = { name, shader };\n"]}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
// Do not edit.
|
|
2
2
|
import { ShaderStore } from "../Engines/shaderStore.js";
|
|
3
3
|
const name = "pickingPixelShader";
|
|
4
|
-
const shader = `#if defined(
|
|
4
|
+
const shader = `#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)
|
|
5
|
+
precision highp int;
|
|
6
|
+
#endif
|
|
7
|
+
#if defined(INSTANCES)
|
|
5
8
|
flat varying float vMeshID;
|
|
6
9
|
#else
|
|
7
10
|
uniform float meshID;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"picking.fragment.js","sourceRoot":"","sources":["../../../../dev/core/src/Shaders/picking.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,MAAM,IAAI,GAAG,oBAAoB,CAAC;AAClC,MAAM,MAAM,GAAG
|
|
1
|
+
{"version":3,"file":"picking.fragment.js","sourceRoot":"","sources":["../../../../dev/core/src/Shaders/picking.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,MAAM,IAAI,GAAG,oBAAoB,CAAC;AAClC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4Bd,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;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\n\nconst name = \"pickingPixelShader\";\nconst shader = `#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\nprecision highp int;\n#endif\n#if defined(INSTANCES)\nflat varying float vMeshID;\n#else\nuniform float meshID;\n#endif\nvoid main(void) {float id;\n#if defined(INSTANCES)\nid=vMeshID;\n#else\nid=meshID;\n#endif\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\nint castedId=int(id);vec3 color=vec3(\nfloat((castedId>>16) & 0xFF),\nfloat((castedId>>8) & 0xFF),\nfloat(castedId & 0xFF)\n)/255.0;gl_FragColor=vec4(color,1.0);\n#else\nfloat castedId=floor(id+0.5);vec3 color=vec3(\nfloor(mod(castedId,16777216.0)/65536.0),\nfloor(mod(castedId,65536.0)/256.0),\nmod(castedId,256.0)\n)/255.0;gl_FragColor=vec4(color,1.0);\n#endif\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStore[name]) {\n ShaderStore.ShadersStore[name] = shader;\n}\n\n/** @internal */\nexport const pickingPixelShader = { name, shader };\n"]}
|
|
@@ -84,7 +84,7 @@ splat.partIndex=u32(textureLoad(partIndicesTexture,splatUVi32,0).r*255.0+0.5);
|
|
|
84
84
|
splat.rotationA=textureLoad(rotationsATexture,splatUVi32,0);splat.rotationB=textureLoad(rotationsBTexture,splatUVi32,0);splat.rotationScale=textureLoad(rotationScaleTexture,splatUVi32,0);
|
|
85
85
|
#endif
|
|
86
86
|
return splat;}
|
|
87
|
-
fn computeColorFromSHDegree(dir: vec3f,sh: array<vec3<f32>,25
|
|
87
|
+
fn computeColorFromSHDegree(dir: vec3f,sh: array<vec3<f32>,25>,_so1: f32,_so2: f32,_so3: f32,_so4: f32)->vec3f
|
|
88
88
|
{let SH_C0: f32=0.28209479;let SH_C1: f32=0.48860251;var SH_C2: array<f32,5>=array<f32,5>(
|
|
89
89
|
1.092548430,
|
|
90
90
|
-1.09254843,
|
|
@@ -111,25 +111,25 @@ fn computeColorFromSHDegree(dir: vec3f,sh: array<vec3<f32>,25>)->vec3f
|
|
|
111
111
|
0.6258357354
|
|
112
112
|
);var result: vec3f=/*SH_C0**/sh[0];
|
|
113
113
|
#if SH_DEGREE>0
|
|
114
|
-
let x: f32=dir.x;let y: f32=dir.y;let z: f32=dir.z;result
|
|
114
|
+
let x: f32=dir.x;let y: f32=dir.y;let z: f32=dir.z;result+=_so1*(-SH_C1*y*sh[1]+SH_C1*z*sh[2]-SH_C1*x*sh[3]);
|
|
115
115
|
#if SH_DEGREE>1
|
|
116
|
-
let xx: f32=x*x;let yy: f32=y*y;let zz: f32=z*z;let xy: f32=x*y;let yz: f32=y*z;let xz: f32=x*z;result
|
|
116
|
+
let xx: f32=x*x;let yy: f32=y*y;let zz: f32=z*z;let xy: f32=x*y;let yz: f32=y*z;let xz: f32=x*z;result+=_so2*(
|
|
117
117
|
SH_C2[0]*xy*sh[4] +
|
|
118
118
|
SH_C2[1]*yz*sh[5] +
|
|
119
119
|
SH_C2[2]*(2.0f*zz-xx-yy)*sh[6] +
|
|
120
120
|
SH_C2[3]*xz*sh[7] +
|
|
121
|
-
SH_C2[4]*(xx-yy)*sh[8];
|
|
121
|
+
SH_C2[4]*(xx-yy)*sh[8]);
|
|
122
122
|
#if SH_DEGREE>2
|
|
123
|
-
result
|
|
123
|
+
result+=_so3*(
|
|
124
124
|
SH_C3[0]*y*(3.0f*xx-yy)*sh[9] +
|
|
125
125
|
SH_C3[1]*xy*z*sh[10] +
|
|
126
126
|
SH_C3[2]*y*(4.0f*zz-xx-yy)*sh[11] +
|
|
127
127
|
SH_C3[3]*z*(2.0f*zz-3.0f*xx-3.0f*yy)*sh[12] +
|
|
128
128
|
SH_C3[4]*x*(4.0f*zz-xx-yy)*sh[13] +
|
|
129
129
|
SH_C3[5]*z*(xx-yy)*sh[14] +
|
|
130
|
-
SH_C3[6]*x*(xx-3.0f*yy)*sh[15];
|
|
130
|
+
SH_C3[6]*x*(xx-3.0f*yy)*sh[15]);
|
|
131
131
|
#if SH_DEGREE>3
|
|
132
|
-
result
|
|
132
|
+
result+=_so4*(
|
|
133
133
|
SH_C4[0]*x*y*(xx-yy)*sh[16] +
|
|
134
134
|
SH_C4[1]*y*z*(3.0f*xx-yy)*sh[17] +
|
|
135
135
|
SH_C4[2]*x*y*(7.0f*zz-1.0f)*sh[18] +
|
|
@@ -138,7 +138,7 @@ SH_C4[4]*(zz*(35.0f*zz-30.0f)+3.0f)*sh[20] +
|
|
|
138
138
|
SH_C4[5]*x*z*(7.0f*zz-3.0f)*sh[21] +
|
|
139
139
|
SH_C4[6]*(xx-yy)*(7.0f*zz-1.0f)*sh[22] +
|
|
140
140
|
SH_C4[7]*x*z*(xx-3.0f*yy)*sh[23] +
|
|
141
|
-
SH_C4[8]*(xx*(xx-3.0f*yy)-yy*(3.0f*xx-yy))*sh[24];
|
|
141
|
+
SH_C4[8]*(xx*(xx-3.0f*yy)-yy*(3.0f*xx-yy))*sh[24]);
|
|
142
142
|
#endif
|
|
143
143
|
#endif
|
|
144
144
|
#endif
|
|
@@ -150,7 +150,7 @@ f32((value ) & 255u),
|
|
|
150
150
|
f32((value>>u32( 8)) & 255u),
|
|
151
151
|
f32((value>>u32(16)) & 255u),
|
|
152
152
|
f32((value>>u32(24)) & 255u));return components*vec4f(2./255.)-vec4f(1.);}
|
|
153
|
-
fn
|
|
153
|
+
fn computeSHWeighted(splat: Splat,dir: vec3f,_so1: f32,_so2: f32,_so3: f32,_so4: f32)->vec3f
|
|
154
154
|
{var sh: array<vec3<f32>,25>;sh[0]=vec3f(0.,0.,0.);
|
|
155
155
|
#if SH_DEGREE>0
|
|
156
156
|
let sh00: vec4f=decompose(splat.sh0.x);let sh01: vec4f=decompose(splat.sh0.y);let sh02: vec4f=decompose(splat.sh0.z);sh[1]=vec3f(sh00.x,sh00.y,sh00.z);sh[2]=vec3f(sh00.w,sh01.x,sh01.y);sh[3]=vec3f(sh01.z,sh01.w,sh02.x);
|
|
@@ -164,7 +164,30 @@ let sh06: vec4f=decompose(splat.sh1.z);let sh07: vec4f=decompose(splat.sh1.w);le
|
|
|
164
164
|
#if SH_DEGREE>3
|
|
165
165
|
let sh12: vec4f=decompose(splat.sh3.x);let sh13: vec4f=decompose(splat.sh3.y);let sh14: vec4f=decompose(splat.sh3.z);let sh15: vec4f=decompose(splat.sh3.w);let sh16: vec4f=decompose(splat.sh4.x);let sh17: vec4f=decompose(splat.sh4.y);sh[16]=vec3f(sh11.y,sh11.z,sh11.w);sh[17]=vec3f(sh12.x,sh12.y,sh12.z);sh[18]=vec3f(sh12.w,sh13.x,sh13.y);sh[19]=vec3f(sh13.z,sh13.w,sh14.x);sh[20]=vec3f(sh14.y,sh14.z,sh14.w);sh[21]=vec3f(sh15.x,sh15.y,sh15.z);sh[22]=vec3f(sh15.w,sh16.x,sh16.y);sh[23]=vec3f(sh16.z,sh16.w,sh17.x);sh[24]=vec3f(sh17.y,sh17.z,sh17.w);
|
|
166
166
|
#endif
|
|
167
|
-
return computeColorFromSHDegree(dir,sh);}
|
|
167
|
+
return computeColorFromSHDegree(dir,sh,_so1,_so2,_so3,_so4);}
|
|
168
|
+
fn computeSH(splat: Splat,dir: vec3f)->vec3f
|
|
169
|
+
{
|
|
170
|
+
#if !defined(GS_DBG_ENABLED) || GS_DBG_SH_ORDER1==1
|
|
171
|
+
let _w1: f32=1.0;
|
|
172
|
+
#else
|
|
173
|
+
let _w1: f32=0.0;
|
|
174
|
+
#endif
|
|
175
|
+
#if !defined(GS_DBG_ENABLED) || GS_DBG_SH_ORDER2==1
|
|
176
|
+
let _w2: f32=1.0;
|
|
177
|
+
#else
|
|
178
|
+
let _w2: f32=0.0;
|
|
179
|
+
#endif
|
|
180
|
+
#if !defined(GS_DBG_ENABLED) || GS_DBG_SH_ORDER3==1
|
|
181
|
+
let _w3: f32=1.0;
|
|
182
|
+
#else
|
|
183
|
+
let _w3: f32=0.0;
|
|
184
|
+
#endif
|
|
185
|
+
#if !defined(GS_DBG_ENABLED) || GS_DBG_SH_ORDER4==1
|
|
186
|
+
let _w4: f32=1.0;
|
|
187
|
+
#else
|
|
188
|
+
let _w4: f32=0.0;
|
|
189
|
+
#endif
|
|
190
|
+
return computeSHWeighted(splat,dir,_w1,_w2,_w3,_w4);}
|
|
168
191
|
fn gaussianSplatting(
|
|
169
192
|
meshPos: vec2<f32>,
|
|
170
193
|
worldPos: vec3<f32>,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gaussianSplatting.js","sourceRoot":"","sources":["../../../../../dev/core/src/ShadersWGSL/ShadersInclude/gaussianSplatting.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,MAAM,IAAI,GAAG,mBAAmB,CAAC;AACjC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2Nd,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,qBAAqB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\nconst name = \"gaussianSplatting\";\nconst shader = `fn getDataUV(index: f32,dataTextureSize: vec2f)->vec2<f32> {let y: f32=floor(index/dataTextureSize.x);let x: f32=index-y*dataTextureSize.x;return vec2f((x+0.5),(y+0.5));}\nstruct Splat {center: vec4f,\ncolor: vec4f,\ncovA: vec4f,\ncovB: vec4f,\n#if SH_DEGREE>0\nsh0: vec4<u32>,\n#endif\n#if SH_DEGREE>1\nsh1: vec4<u32>,\n#endif\n#if SH_DEGREE>2\nsh2: vec4<u32>,\n#endif\n#if SH_DEGREE>3\nsh3: vec4<u32>,\nsh4: vec4<u32>,\n#endif\n#if IS_COMPOUND\npartIndex: u32,\n#endif\n#if defined(IS_FOR_VOXELIZATION)\nrotationA: vec4f,\nrotationB: vec4f,\nrotationScale: vec4f,\n#endif\n};fn getSplatIndex(localIndex: i32,splatIndex0: vec4f,splatIndex1: vec4f,splatIndex2: vec4f,splatIndex3: vec4f)->f32 {var splatIndex: f32;switch (localIndex)\n{case 0:\n{splatIndex=splatIndex0.x;break;}\ncase 1:\n{splatIndex=splatIndex0.y;break;}\ncase 2:\n{splatIndex=splatIndex0.z;break;}\ncase 3:\n{splatIndex=splatIndex0.w;break;}\ncase 4:\n{splatIndex=splatIndex1.x;break;}\ncase 5:\n{splatIndex=splatIndex1.y;break;}\ncase 6:\n{splatIndex=splatIndex1.z;break;}\ncase 7:\n{splatIndex=splatIndex1.w;break;}\ncase 8:\n{splatIndex=splatIndex2.x;break;}\ncase 9:\n{splatIndex=splatIndex2.y;break;}\ncase 10:\n{splatIndex=splatIndex2.z;break;}\ncase 11:\n{splatIndex=splatIndex2.w;break;}\ncase 12:\n{splatIndex=splatIndex3.x;break;}\ncase 13:\n{splatIndex=splatIndex3.y;break;}\ncase 14:\n{splatIndex=splatIndex3.z;break;}\ndefault:\n{splatIndex=splatIndex3.w;break;}}\nreturn splatIndex;}\nfn readSplat(splatIndex: f32,dataTextureSize: vec2f)->Splat {var splat: Splat;let splatUV=getDataUV(splatIndex,dataTextureSize);let splatUVi32=vec2<i32>(i32(splatUV.x),i32(splatUV.y));splat.center=textureLoad(centersTexture,splatUVi32,0);splat.color=textureLoad(colorsTexture,splatUVi32,0);\n#if !defined(IS_FOR_VOXELIZATION)\nsplat.covA=textureLoad(covariancesATexture,splatUVi32,0)*splat.center.w;splat.covB=textureLoad(covariancesBTexture,splatUVi32,0)*splat.center.w;\n#endif\n#if SH_DEGREE>0\nsplat.sh0=textureLoad(shTexture0,splatUVi32,0);\n#endif\n#if SH_DEGREE>1\nsplat.sh1=textureLoad(shTexture1,splatUVi32,0);\n#endif\n#if SH_DEGREE>2\nsplat.sh2=textureLoad(shTexture2,splatUVi32,0);\n#endif\n#if SH_DEGREE>3\nsplat.sh3=textureLoad(shTexture3,splatUVi32,0);splat.sh4=textureLoad(shTexture4,splatUVi32,0);\n#endif\n#if IS_COMPOUND\nsplat.partIndex=u32(textureLoad(partIndicesTexture,splatUVi32,0).r*255.0+0.5);\n#endif\n#if defined(IS_FOR_VOXELIZATION)\nsplat.rotationA=textureLoad(rotationsATexture,splatUVi32,0);splat.rotationB=textureLoad(rotationsBTexture,splatUVi32,0);splat.rotationScale=textureLoad(rotationScaleTexture,splatUVi32,0);\n#endif\nreturn splat;}\nfn computeColorFromSHDegree(dir: vec3f,sh: array<vec3<f32>,25>)->vec3f\n{let SH_C0: f32=0.28209479;let SH_C1: f32=0.48860251;var SH_C2: array<f32,5>=array<f32,5>(\n1.092548430,\n-1.09254843,\n0.315391565,\n-1.09254843,\n0.546274215\n);var SH_C3: array<f32,7>=array<f32,7>(\n-0.59004358,\n2.890611442,\n-0.45704579,\n0.373176332,\n-0.45704579,\n1.445305721,\n-0.59004358\n);var SH_C4: array<f32,9>=array<f32,9>(\n2.5033429418,\n-1.7701307698,\n0.9461746958,\n-0.6690465436,\n0.1057855469,\n-0.6690465436,\n0.4730873479,\n-1.7701307698,\n0.6258357354\n);var result: vec3f=/*SH_C0**/sh[0];\n#if SH_DEGREE>0\nlet x: f32=dir.x;let y: f32=dir.y;let z: f32=dir.z;result+=-SH_C1*y*sh[1]+SH_C1*z*sh[2]-SH_C1*x*sh[3];\n#if SH_DEGREE>1\nlet xx: f32=x*x;let yy: f32=y*y;let zz: f32=z*z;let xy: f32=x*y;let yz: f32=y*z;let xz: f32=x*z;result +=\nSH_C2[0]*xy*sh[4] +\nSH_C2[1]*yz*sh[5] +\nSH_C2[2]*(2.0f*zz-xx-yy)*sh[6] +\nSH_C2[3]*xz*sh[7] +\nSH_C2[4]*(xx-yy)*sh[8];\n#if SH_DEGREE>2\nresult +=\nSH_C3[0]*y*(3.0f*xx-yy)*sh[9] +\nSH_C3[1]*xy*z*sh[10] +\nSH_C3[2]*y*(4.0f*zz-xx-yy)*sh[11] +\nSH_C3[3]*z*(2.0f*zz-3.0f*xx-3.0f*yy)*sh[12] +\nSH_C3[4]*x*(4.0f*zz-xx-yy)*sh[13] +\nSH_C3[5]*z*(xx-yy)*sh[14] +\nSH_C3[6]*x*(xx-3.0f*yy)*sh[15];\n#if SH_DEGREE>3\nresult +=\nSH_C4[0]*x*y*(xx-yy)*sh[16] +\nSH_C4[1]*y*z*(3.0f*xx-yy)*sh[17] +\nSH_C4[2]*x*y*(7.0f*zz-1.0f)*sh[18] +\nSH_C4[3]*y*z*(7.0f*zz-3.0f)*sh[19] +\nSH_C4[4]*(zz*(35.0f*zz-30.0f)+3.0f)*sh[20] +\nSH_C4[5]*x*z*(7.0f*zz-3.0f)*sh[21] +\nSH_C4[6]*(xx-yy)*(7.0f*zz-1.0f)*sh[22] +\nSH_C4[7]*x*z*(xx-3.0f*yy)*sh[23] +\nSH_C4[8]*(xx*(xx-3.0f*yy)-yy*(3.0f*xx-yy))*sh[24];\n#endif\n#endif\n#endif\n#endif\nreturn result;}\nfn decompose(value: u32)->vec4f\n{let components : vec4f=vec4f(\nf32((value ) & 255u),\nf32((value>>u32( 8)) & 255u),\nf32((value>>u32(16)) & 255u),\nf32((value>>u32(24)) & 255u));return components*vec4f(2./255.)-vec4f(1.);}\nfn computeSH(splat: Splat,dir: vec3f)->vec3f\n{var sh: array<vec3<f32>,25>;sh[0]=vec3f(0.,0.,0.);\n#if SH_DEGREE>0\nlet sh00: vec4f=decompose(splat.sh0.x);let sh01: vec4f=decompose(splat.sh0.y);let sh02: vec4f=decompose(splat.sh0.z);sh[1]=vec3f(sh00.x,sh00.y,sh00.z);sh[2]=vec3f(sh00.w,sh01.x,sh01.y);sh[3]=vec3f(sh01.z,sh01.w,sh02.x);\n#endif\n#if SH_DEGREE>1\nlet sh03: vec4f=decompose(splat.sh0.w);let sh04: vec4f=decompose(splat.sh1.x);let sh05: vec4f=decompose(splat.sh1.y);sh[4]=vec3f(sh02.y,sh02.z,sh02.w);sh[5]=vec3f(sh03.x,sh03.y,sh03.z);sh[6]=vec3f(sh03.w,sh04.x,sh04.y);sh[7]=vec3f(sh04.z,sh04.w,sh05.x);sh[8]=vec3f(sh05.y,sh05.z,sh05.w);\n#endif\n#if SH_DEGREE>2\nlet sh06: vec4f=decompose(splat.sh1.z);let sh07: vec4f=decompose(splat.sh1.w);let sh08: vec4f=decompose(splat.sh2.x);let sh09: vec4f=decompose(splat.sh2.y);let sh10: vec4f=decompose(splat.sh2.z);let sh11: vec4f=decompose(splat.sh2.w);sh[9]=vec3f(sh06.x,sh06.y,sh06.z);sh[10]=vec3f(sh06.w,sh07.x,sh07.y);sh[11]=vec3f(sh07.z,sh07.w,sh08.x);sh[12]=vec3f(sh08.y,sh08.z,sh08.w);sh[13]=vec3f(sh09.x,sh09.y,sh09.z);sh[14]=vec3f(sh09.w,sh10.x,sh10.y);sh[15]=vec3f(sh10.z,sh10.w,sh11.x);\n#endif\n#if SH_DEGREE>3\nlet sh12: vec4f=decompose(splat.sh3.x);let sh13: vec4f=decompose(splat.sh3.y);let sh14: vec4f=decompose(splat.sh3.z);let sh15: vec4f=decompose(splat.sh3.w);let sh16: vec4f=decompose(splat.sh4.x);let sh17: vec4f=decompose(splat.sh4.y);sh[16]=vec3f(sh11.y,sh11.z,sh11.w);sh[17]=vec3f(sh12.x,sh12.y,sh12.z);sh[18]=vec3f(sh12.w,sh13.x,sh13.y);sh[19]=vec3f(sh13.z,sh13.w,sh14.x);sh[20]=vec3f(sh14.y,sh14.z,sh14.w);sh[21]=vec3f(sh15.x,sh15.y,sh15.z);sh[22]=vec3f(sh15.w,sh16.x,sh16.y);sh[23]=vec3f(sh16.z,sh16.w,sh17.x);sh[24]=vec3f(sh17.y,sh17.z,sh17.w);\n#endif\nreturn computeColorFromSHDegree(dir,sh);}\nfn gaussianSplatting(\nmeshPos: vec2<f32>,\nworldPos: vec3<f32>,\nscale: vec2<f32>,\ncovA: vec3<f32>,\ncovB: vec3<f32>,\nworldMatrix: mat4x4<f32>,\nviewMatrix: mat4x4<f32>,\nprojectionMatrix: mat4x4<f32>,\nfocal: vec2f,\ninvViewport: vec2f,\nkernelSize: f32\n)->vec4f {let modelView=viewMatrix*worldMatrix;let camspace=viewMatrix*vec4f(worldPos,1.0);let pos2d=projectionMatrix*camspace;let bounds=1.2*pos2d.w;if (pos2d.z<0. || pos2d.x<-bounds || pos2d.x>bounds || pos2d.y<-bounds || pos2d.y>bounds) {return vec4f(0.0,0.0,2.0,1.0);}\nlet Vrk=mat3x3<f32>(\ncovA.x,covA.y,covA.z,\ncovA.y,covB.x,covB.y,\ncovA.z,covB.y,covB.z\n);let isOrtho=abs(projectionMatrix[3][3]-1.0)<0.001;var J: mat3x3<f32>;if (isOrtho) {J=mat3x3<f32>(\nfocal.x,0.0,0.0,\n0.0,focal.y,0.0,\n0.0,0.0,0.0\n);} else {J=mat3x3<f32>(\nfocal.x/camspace.z,0.0,-(focal.x*camspace.x)/(camspace.z*camspace.z),\n0.0,focal.y/camspace.z,-(focal.y*camspace.y)/(camspace.z*camspace.z),\n0.0,0.0,0.0\n);}\nlet T=transpose(mat3x3<f32>(\nmodelView[0].xyz,\nmodelView[1].xyz,\nmodelView[2].xyz))*J;var cov2d=transpose(T)*Vrk*T;\n#if COMPENSATION\nlet c00: f32=cov2d[0][0];let c11: f32=cov2d[1][1];let c01: f32=cov2d[0][1];let detOrig: f32=c00*c11-c01*c01;\n#endif\ncov2d[0][0]+=kernelSize;cov2d[1][1]+=kernelSize;\n#if COMPENSATION\nlet c2d: vec3f=vec3f(cov2d[0][0],c01,cov2d[1][1]);let detBlur: f32=c2d.x*c2d.z-c2d.y*c2d.y;let compensation: f32=sqrt(max(0.,detOrig/detBlur));vertexOutputs.vColor.w*=compensation;\n#endif\nlet mid=(cov2d[0][0]+cov2d[1][1])/2.0;let radius=length(vec2<f32>((cov2d[0][0]-cov2d[1][1])/2.0,cov2d[0][1]));let lambda1=mid+radius;let lambda2=mid-radius;if (lambda2<0.0) {return vec4f(0.0,0.0,2.0,1.0);}\nlet diagonalVector=normalize(vec2<f32>(cov2d[0][1],lambda1-cov2d[0][0]));let majorAxis=min(sqrt(2.0*lambda1),1024.0)*diagonalVector;let minorAxis=min(sqrt(2.0*lambda2),1024.0)*vec2<f32>(diagonalVector.y,-diagonalVector.x);let vCenter=vec2<f32>(pos2d.x,pos2d.y);let scaleFactor=select(pos2d.w,1.0,isOrtho);return vec4f(\nvCenter+((meshPos.x*majorAxis+meshPos.y*minorAxis)*invViewport*scaleFactor)*scale,\npos2d.z,\npos2d.w\n);}\n#if IS_COMPOUND\nfn getPartWorld(partIndex: u32)->mat4x4<f32> {return uniforms.partWorld[partIndex];}\n#endif\n#if defined(IS_FOR_VOXELIZATION)\nfn computeVoxelSplatWorldPos(rotationA: vec4f,rotationB: vec4f,rotationScale: vec4f,center: vec3f,splatWorld: mat4x4f,viewMatrix: mat4x4f,invWorldScale: mat4x4f,quadPos: vec2f)->vec4f {let splatRotation=mat3x3f(\nrotationA.xyz,\nvec3f(rotationA.w,rotationB.x,rotationB.y),\nvec3f(rotationB.z,rotationB.w,rotationScale.x)\n);let splatScale=rotationScale.yzw;let view3x3=mat3x3f(viewMatrix[0].xyz,viewMatrix[1].xyz,viewMatrix[2].xyz);let invWorldScale3x3=mat3x3f(invWorldScale[0].xyz,invWorldScale[1].xyz,invWorldScale[2].xyz);let splatWorld3x3=mat3x3f(splatWorld[0].xyz,splatWorld[1].xyz,splatWorld[2].xyz);let rotToView=view3x3*invWorldScale3x3*splatWorld3x3*splatRotation;let axisLengthInViewZ=abs(vec3f(rotToView[0][2],rotToView[1][2],rotToView[2][2]));let gaussianSplatCutoffStddev: f32=0.7071067812; \nvar offsetSplatSpace: vec3f;if (axisLengthInViewZ.x>axisLengthInViewZ.y && axisLengthInViewZ.x>axisLengthInViewZ.z) {offsetSplatSpace=vec3f(0.0,quadPos.x,quadPos.y)*splatScale*gaussianSplatCutoffStddev;} else if (axisLengthInViewZ.y>axisLengthInViewZ.z) {offsetSplatSpace=vec3f(quadPos.x,0.0,quadPos.y)*splatScale*gaussianSplatCutoffStddev;} else {offsetSplatSpace=vec3f(quadPos.x,quadPos.y,0.0)*splatScale*gaussianSplatCutoffStddev;}\nlet vertexObjectSpace=center+splatRotation*offsetSplatSpace;return splatWorld*vec4f(vertexObjectSpace,1.0);}\n#endif\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStoreWGSL[name]) {\n ShaderStore.IncludesShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const gaussianSplattingWGSL = { name, shader };\n"]}
|
|
1
|
+
{"version":3,"file":"gaussianSplatting.js","sourceRoot":"","sources":["../../../../../dev/core/src/ShadersWGSL/ShadersInclude/gaussianSplatting.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,MAAM,IAAI,GAAG,mBAAmB,CAAC;AACjC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkPd,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,qBAAqB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\nconst name = \"gaussianSplatting\";\nconst shader = `fn getDataUV(index: f32,dataTextureSize: vec2f)->vec2<f32> {let y: f32=floor(index/dataTextureSize.x);let x: f32=index-y*dataTextureSize.x;return vec2f((x+0.5),(y+0.5));}\nstruct Splat {center: vec4f,\ncolor: vec4f,\ncovA: vec4f,\ncovB: vec4f,\n#if SH_DEGREE>0\nsh0: vec4<u32>,\n#endif\n#if SH_DEGREE>1\nsh1: vec4<u32>,\n#endif\n#if SH_DEGREE>2\nsh2: vec4<u32>,\n#endif\n#if SH_DEGREE>3\nsh3: vec4<u32>,\nsh4: vec4<u32>,\n#endif\n#if IS_COMPOUND\npartIndex: u32,\n#endif\n#if defined(IS_FOR_VOXELIZATION)\nrotationA: vec4f,\nrotationB: vec4f,\nrotationScale: vec4f,\n#endif\n};fn getSplatIndex(localIndex: i32,splatIndex0: vec4f,splatIndex1: vec4f,splatIndex2: vec4f,splatIndex3: vec4f)->f32 {var splatIndex: f32;switch (localIndex)\n{case 0:\n{splatIndex=splatIndex0.x;break;}\ncase 1:\n{splatIndex=splatIndex0.y;break;}\ncase 2:\n{splatIndex=splatIndex0.z;break;}\ncase 3:\n{splatIndex=splatIndex0.w;break;}\ncase 4:\n{splatIndex=splatIndex1.x;break;}\ncase 5:\n{splatIndex=splatIndex1.y;break;}\ncase 6:\n{splatIndex=splatIndex1.z;break;}\ncase 7:\n{splatIndex=splatIndex1.w;break;}\ncase 8:\n{splatIndex=splatIndex2.x;break;}\ncase 9:\n{splatIndex=splatIndex2.y;break;}\ncase 10:\n{splatIndex=splatIndex2.z;break;}\ncase 11:\n{splatIndex=splatIndex2.w;break;}\ncase 12:\n{splatIndex=splatIndex3.x;break;}\ncase 13:\n{splatIndex=splatIndex3.y;break;}\ncase 14:\n{splatIndex=splatIndex3.z;break;}\ndefault:\n{splatIndex=splatIndex3.w;break;}}\nreturn splatIndex;}\nfn readSplat(splatIndex: f32,dataTextureSize: vec2f)->Splat {var splat: Splat;let splatUV=getDataUV(splatIndex,dataTextureSize);let splatUVi32=vec2<i32>(i32(splatUV.x),i32(splatUV.y));splat.center=textureLoad(centersTexture,splatUVi32,0);splat.color=textureLoad(colorsTexture,splatUVi32,0);\n#if !defined(IS_FOR_VOXELIZATION)\nsplat.covA=textureLoad(covariancesATexture,splatUVi32,0)*splat.center.w;splat.covB=textureLoad(covariancesBTexture,splatUVi32,0)*splat.center.w;\n#endif\n#if SH_DEGREE>0\nsplat.sh0=textureLoad(shTexture0,splatUVi32,0);\n#endif\n#if SH_DEGREE>1\nsplat.sh1=textureLoad(shTexture1,splatUVi32,0);\n#endif\n#if SH_DEGREE>2\nsplat.sh2=textureLoad(shTexture2,splatUVi32,0);\n#endif\n#if SH_DEGREE>3\nsplat.sh3=textureLoad(shTexture3,splatUVi32,0);splat.sh4=textureLoad(shTexture4,splatUVi32,0);\n#endif\n#if IS_COMPOUND\nsplat.partIndex=u32(textureLoad(partIndicesTexture,splatUVi32,0).r*255.0+0.5);\n#endif\n#if defined(IS_FOR_VOXELIZATION)\nsplat.rotationA=textureLoad(rotationsATexture,splatUVi32,0);splat.rotationB=textureLoad(rotationsBTexture,splatUVi32,0);splat.rotationScale=textureLoad(rotationScaleTexture,splatUVi32,0);\n#endif\nreturn splat;}\nfn computeColorFromSHDegree(dir: vec3f,sh: array<vec3<f32>,25>,_so1: f32,_so2: f32,_so3: f32,_so4: f32)->vec3f\n{let SH_C0: f32=0.28209479;let SH_C1: f32=0.48860251;var SH_C2: array<f32,5>=array<f32,5>(\n1.092548430,\n-1.09254843,\n0.315391565,\n-1.09254843,\n0.546274215\n);var SH_C3: array<f32,7>=array<f32,7>(\n-0.59004358,\n2.890611442,\n-0.45704579,\n0.373176332,\n-0.45704579,\n1.445305721,\n-0.59004358\n);var SH_C4: array<f32,9>=array<f32,9>(\n2.5033429418,\n-1.7701307698,\n0.9461746958,\n-0.6690465436,\n0.1057855469,\n-0.6690465436,\n0.4730873479,\n-1.7701307698,\n0.6258357354\n);var result: vec3f=/*SH_C0**/sh[0];\n#if SH_DEGREE>0\nlet x: f32=dir.x;let y: f32=dir.y;let z: f32=dir.z;result+=_so1*(-SH_C1*y*sh[1]+SH_C1*z*sh[2]-SH_C1*x*sh[3]);\n#if SH_DEGREE>1\nlet xx: f32=x*x;let yy: f32=y*y;let zz: f32=z*z;let xy: f32=x*y;let yz: f32=y*z;let xz: f32=x*z;result+=_so2*(\nSH_C2[0]*xy*sh[4] +\nSH_C2[1]*yz*sh[5] +\nSH_C2[2]*(2.0f*zz-xx-yy)*sh[6] +\nSH_C2[3]*xz*sh[7] +\nSH_C2[4]*(xx-yy)*sh[8]);\n#if SH_DEGREE>2\nresult+=_so3*(\nSH_C3[0]*y*(3.0f*xx-yy)*sh[9] +\nSH_C3[1]*xy*z*sh[10] +\nSH_C3[2]*y*(4.0f*zz-xx-yy)*sh[11] +\nSH_C3[3]*z*(2.0f*zz-3.0f*xx-3.0f*yy)*sh[12] +\nSH_C3[4]*x*(4.0f*zz-xx-yy)*sh[13] +\nSH_C3[5]*z*(xx-yy)*sh[14] +\nSH_C3[6]*x*(xx-3.0f*yy)*sh[15]);\n#if SH_DEGREE>3\nresult+=_so4*(\nSH_C4[0]*x*y*(xx-yy)*sh[16] +\nSH_C4[1]*y*z*(3.0f*xx-yy)*sh[17] +\nSH_C4[2]*x*y*(7.0f*zz-1.0f)*sh[18] +\nSH_C4[3]*y*z*(7.0f*zz-3.0f)*sh[19] +\nSH_C4[4]*(zz*(35.0f*zz-30.0f)+3.0f)*sh[20] +\nSH_C4[5]*x*z*(7.0f*zz-3.0f)*sh[21] +\nSH_C4[6]*(xx-yy)*(7.0f*zz-1.0f)*sh[22] +\nSH_C4[7]*x*z*(xx-3.0f*yy)*sh[23] +\nSH_C4[8]*(xx*(xx-3.0f*yy)-yy*(3.0f*xx-yy))*sh[24]);\n#endif\n#endif\n#endif\n#endif\nreturn result;}\nfn decompose(value: u32)->vec4f\n{let components : vec4f=vec4f(\nf32((value ) & 255u),\nf32((value>>u32( 8)) & 255u),\nf32((value>>u32(16)) & 255u),\nf32((value>>u32(24)) & 255u));return components*vec4f(2./255.)-vec4f(1.);}\nfn computeSHWeighted(splat: Splat,dir: vec3f,_so1: f32,_so2: f32,_so3: f32,_so4: f32)->vec3f\n{var sh: array<vec3<f32>,25>;sh[0]=vec3f(0.,0.,0.);\n#if SH_DEGREE>0\nlet sh00: vec4f=decompose(splat.sh0.x);let sh01: vec4f=decompose(splat.sh0.y);let sh02: vec4f=decompose(splat.sh0.z);sh[1]=vec3f(sh00.x,sh00.y,sh00.z);sh[2]=vec3f(sh00.w,sh01.x,sh01.y);sh[3]=vec3f(sh01.z,sh01.w,sh02.x);\n#endif\n#if SH_DEGREE>1\nlet sh03: vec4f=decompose(splat.sh0.w);let sh04: vec4f=decompose(splat.sh1.x);let sh05: vec4f=decompose(splat.sh1.y);sh[4]=vec3f(sh02.y,sh02.z,sh02.w);sh[5]=vec3f(sh03.x,sh03.y,sh03.z);sh[6]=vec3f(sh03.w,sh04.x,sh04.y);sh[7]=vec3f(sh04.z,sh04.w,sh05.x);sh[8]=vec3f(sh05.y,sh05.z,sh05.w);\n#endif\n#if SH_DEGREE>2\nlet sh06: vec4f=decompose(splat.sh1.z);let sh07: vec4f=decompose(splat.sh1.w);let sh08: vec4f=decompose(splat.sh2.x);let sh09: vec4f=decompose(splat.sh2.y);let sh10: vec4f=decompose(splat.sh2.z);let sh11: vec4f=decompose(splat.sh2.w);sh[9]=vec3f(sh06.x,sh06.y,sh06.z);sh[10]=vec3f(sh06.w,sh07.x,sh07.y);sh[11]=vec3f(sh07.z,sh07.w,sh08.x);sh[12]=vec3f(sh08.y,sh08.z,sh08.w);sh[13]=vec3f(sh09.x,sh09.y,sh09.z);sh[14]=vec3f(sh09.w,sh10.x,sh10.y);sh[15]=vec3f(sh10.z,sh10.w,sh11.x);\n#endif\n#if SH_DEGREE>3\nlet sh12: vec4f=decompose(splat.sh3.x);let sh13: vec4f=decompose(splat.sh3.y);let sh14: vec4f=decompose(splat.sh3.z);let sh15: vec4f=decompose(splat.sh3.w);let sh16: vec4f=decompose(splat.sh4.x);let sh17: vec4f=decompose(splat.sh4.y);sh[16]=vec3f(sh11.y,sh11.z,sh11.w);sh[17]=vec3f(sh12.x,sh12.y,sh12.z);sh[18]=vec3f(sh12.w,sh13.x,sh13.y);sh[19]=vec3f(sh13.z,sh13.w,sh14.x);sh[20]=vec3f(sh14.y,sh14.z,sh14.w);sh[21]=vec3f(sh15.x,sh15.y,sh15.z);sh[22]=vec3f(sh15.w,sh16.x,sh16.y);sh[23]=vec3f(sh16.z,sh16.w,sh17.x);sh[24]=vec3f(sh17.y,sh17.z,sh17.w);\n#endif\nreturn computeColorFromSHDegree(dir,sh,_so1,_so2,_so3,_so4);}\nfn computeSH(splat: Splat,dir: vec3f)->vec3f\n{\n#if !defined(GS_DBG_ENABLED) || GS_DBG_SH_ORDER1==1\nlet _w1: f32=1.0;\n#else\nlet _w1: f32=0.0;\n#endif\n#if !defined(GS_DBG_ENABLED) || GS_DBG_SH_ORDER2==1\nlet _w2: f32=1.0;\n#else\nlet _w2: f32=0.0;\n#endif\n#if !defined(GS_DBG_ENABLED) || GS_DBG_SH_ORDER3==1\nlet _w3: f32=1.0;\n#else\nlet _w3: f32=0.0;\n#endif\n#if !defined(GS_DBG_ENABLED) || GS_DBG_SH_ORDER4==1\nlet _w4: f32=1.0;\n#else\nlet _w4: f32=0.0;\n#endif\nreturn computeSHWeighted(splat,dir,_w1,_w2,_w3,_w4);}\nfn gaussianSplatting(\nmeshPos: vec2<f32>,\nworldPos: vec3<f32>,\nscale: vec2<f32>,\ncovA: vec3<f32>,\ncovB: vec3<f32>,\nworldMatrix: mat4x4<f32>,\nviewMatrix: mat4x4<f32>,\nprojectionMatrix: mat4x4<f32>,\nfocal: vec2f,\ninvViewport: vec2f,\nkernelSize: f32\n)->vec4f {let modelView=viewMatrix*worldMatrix;let camspace=viewMatrix*vec4f(worldPos,1.0);let pos2d=projectionMatrix*camspace;let bounds=1.2*pos2d.w;if (pos2d.z<0. || pos2d.x<-bounds || pos2d.x>bounds || pos2d.y<-bounds || pos2d.y>bounds) {return vec4f(0.0,0.0,2.0,1.0);}\nlet Vrk=mat3x3<f32>(\ncovA.x,covA.y,covA.z,\ncovA.y,covB.x,covB.y,\ncovA.z,covB.y,covB.z\n);let isOrtho=abs(projectionMatrix[3][3]-1.0)<0.001;var J: mat3x3<f32>;if (isOrtho) {J=mat3x3<f32>(\nfocal.x,0.0,0.0,\n0.0,focal.y,0.0,\n0.0,0.0,0.0\n);} else {J=mat3x3<f32>(\nfocal.x/camspace.z,0.0,-(focal.x*camspace.x)/(camspace.z*camspace.z),\n0.0,focal.y/camspace.z,-(focal.y*camspace.y)/(camspace.z*camspace.z),\n0.0,0.0,0.0\n);}\nlet T=transpose(mat3x3<f32>(\nmodelView[0].xyz,\nmodelView[1].xyz,\nmodelView[2].xyz))*J;var cov2d=transpose(T)*Vrk*T;\n#if COMPENSATION\nlet c00: f32=cov2d[0][0];let c11: f32=cov2d[1][1];let c01: f32=cov2d[0][1];let detOrig: f32=c00*c11-c01*c01;\n#endif\ncov2d[0][0]+=kernelSize;cov2d[1][1]+=kernelSize;\n#if COMPENSATION\nlet c2d: vec3f=vec3f(cov2d[0][0],c01,cov2d[1][1]);let detBlur: f32=c2d.x*c2d.z-c2d.y*c2d.y;let compensation: f32=sqrt(max(0.,detOrig/detBlur));vertexOutputs.vColor.w*=compensation;\n#endif\nlet mid=(cov2d[0][0]+cov2d[1][1])/2.0;let radius=length(vec2<f32>((cov2d[0][0]-cov2d[1][1])/2.0,cov2d[0][1]));let lambda1=mid+radius;let lambda2=mid-radius;if (lambda2<0.0) {return vec4f(0.0,0.0,2.0,1.0);}\nlet diagonalVector=normalize(vec2<f32>(cov2d[0][1],lambda1-cov2d[0][0]));let majorAxis=min(sqrt(2.0*lambda1),1024.0)*diagonalVector;let minorAxis=min(sqrt(2.0*lambda2),1024.0)*vec2<f32>(diagonalVector.y,-diagonalVector.x);let vCenter=vec2<f32>(pos2d.x,pos2d.y);let scaleFactor=select(pos2d.w,1.0,isOrtho);return vec4f(\nvCenter+((meshPos.x*majorAxis+meshPos.y*minorAxis)*invViewport*scaleFactor)*scale,\npos2d.z,\npos2d.w\n);}\n#if IS_COMPOUND\nfn getPartWorld(partIndex: u32)->mat4x4<f32> {return uniforms.partWorld[partIndex];}\n#endif\n#if defined(IS_FOR_VOXELIZATION)\nfn computeVoxelSplatWorldPos(rotationA: vec4f,rotationB: vec4f,rotationScale: vec4f,center: vec3f,splatWorld: mat4x4f,viewMatrix: mat4x4f,invWorldScale: mat4x4f,quadPos: vec2f)->vec4f {let splatRotation=mat3x3f(\nrotationA.xyz,\nvec3f(rotationA.w,rotationB.x,rotationB.y),\nvec3f(rotationB.z,rotationB.w,rotationScale.x)\n);let splatScale=rotationScale.yzw;let view3x3=mat3x3f(viewMatrix[0].xyz,viewMatrix[1].xyz,viewMatrix[2].xyz);let invWorldScale3x3=mat3x3f(invWorldScale[0].xyz,invWorldScale[1].xyz,invWorldScale[2].xyz);let splatWorld3x3=mat3x3f(splatWorld[0].xyz,splatWorld[1].xyz,splatWorld[2].xyz);let rotToView=view3x3*invWorldScale3x3*splatWorld3x3*splatRotation;let axisLengthInViewZ=abs(vec3f(rotToView[0][2],rotToView[1][2],rotToView[2][2]));let gaussianSplatCutoffStddev: f32=0.7071067812; \nvar offsetSplatSpace: vec3f;if (axisLengthInViewZ.x>axisLengthInViewZ.y && axisLengthInViewZ.x>axisLengthInViewZ.z) {offsetSplatSpace=vec3f(0.0,quadPos.x,quadPos.y)*splatScale*gaussianSplatCutoffStddev;} else if (axisLengthInViewZ.y>axisLengthInViewZ.z) {offsetSplatSpace=vec3f(quadPos.x,0.0,quadPos.y)*splatScale*gaussianSplatCutoffStddev;} else {offsetSplatSpace=vec3f(quadPos.x,quadPos.y,0.0)*splatScale*gaussianSplatCutoffStddev;}\nlet vertexObjectSpace=center+splatRotation*offsetSplatSpace;return splatWorld*vec4f(vertexObjectSpace,1.0);}\n#endif\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStoreWGSL[name]) {\n ShaderStore.IncludesShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const gaussianSplattingWGSL = { name, shader };\n"]}
|
|
@@ -51,14 +51,33 @@ let splatWorld: mat4x4f=mesh.world;
|
|
|
51
51
|
#endif
|
|
52
52
|
let worldPos: vec4f=splatWorld*vec4f(splat.center.xyz,1.0);vertexOutputs.vPosition=vertexInputs.position.xy;
|
|
53
53
|
#if SH_DEGREE>0
|
|
54
|
-
let worldRot: mat3x3f= mat3x3f(splatWorld[0].xyz,splatWorld[1].xyz,splatWorld[2].xyz);let normWorldRot: mat3x3f=inverseMat3(worldRot);var eyeToSplatLocalSpace: vec3f=normalize(normWorldRot*(worldPos.xyz-uniforms.eyePosition.xyz));
|
|
54
|
+
let worldRot: mat3x3f= mat3x3f(splatWorld[0].xyz,splatWorld[1].xyz,splatWorld[2].xyz);let normWorldRot: mat3x3f=inverseMat3(worldRot);var eyeToSplatLocalSpace: vec3f=normalize(normWorldRot*(worldPos.xyz-uniforms.eyePosition.xyz));
|
|
55
|
+
#if defined(GS_DBG_ENABLED) && IS_COMPOUND
|
|
56
|
+
{let _row3=textureLoad(dbgPartData,vec2i(i32(splat.partIndex),3),0);
|
|
57
|
+
#if SH_DEGREE>3
|
|
58
|
+
let _so4=textureLoad(dbgPartData,vec2i(i32(splat.partIndex),4),0).x;
|
|
59
|
+
#else
|
|
60
|
+
let _so4: f32=1.0;
|
|
61
|
+
#endif
|
|
62
|
+
vertexOutputs.vColor=vec4f(_row3.x*splat.color.xyz+computeSHWeighted(splat,eyeToSplatLocalSpace,_row3.y,_row3.z,_row3.w,_so4),splat.color.w*uniforms.alpha);}
|
|
63
|
+
#elif defined(GS_DBG_ENABLED) && GS_DBG_SH_DC==0
|
|
64
|
+
vertexOutputs.vColor=vec4f(computeSH(splat,eyeToSplatLocalSpace),splat.color.w*uniforms.alpha);
|
|
65
|
+
#else
|
|
66
|
+
vertexOutputs.vColor=vec4f(splat.color.xyz+computeSH(splat,eyeToSplatLocalSpace),splat.color.w*uniforms.alpha);
|
|
67
|
+
#endif
|
|
68
|
+
#else
|
|
69
|
+
#if defined(GS_DBG_ENABLED) && IS_COMPOUND
|
|
70
|
+
{let _shDc=textureLoad(dbgPartData,vec2i(i32(splat.partIndex),3),0).x;vertexOutputs.vColor=vec4f(_shDc*splat.color.xyz,splat.color.w*uniforms.alpha);}
|
|
71
|
+
#elif defined(GS_DBG_ENABLED) && GS_DBG_SH_DC==0
|
|
72
|
+
vertexOutputs.vColor=vec4f(0.0,0.0,0.0,splat.color.w*uniforms.alpha);
|
|
55
73
|
#else
|
|
56
74
|
vertexOutputs.vColor=vec4f(splat.color.xyz,splat.color.w*uniforms.alpha);
|
|
57
75
|
#endif
|
|
76
|
+
#endif
|
|
58
77
|
#if IS_COMPOUND
|
|
59
78
|
vertexOutputs.vColor.w*=uniforms.partVisibility[splat.partIndex];
|
|
60
79
|
#endif
|
|
61
|
-
|
|
80
|
+
var scale: vec2f=vec2f(1.,1.);
|
|
62
81
|
#define CUSTOM_VERTEX_UPDATE
|
|
63
82
|
vertexOutputs.position=gaussianSplatting(vertexInputs.position.xy,worldPos.xyz,scale,covA,covB,splatWorld,scene.view,scene.projection,uniforms.focal,uniforms.invViewport,uniforms.kernelSize);
|
|
64
83
|
#include<clipPlaneVertex>
|
|
@@ -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,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,8BAA8B,EAAE,MAAM,6CAA6C,CAAC;AAC7F,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE,MAAM,IAAI,GAAG,+BAA+B,CAAC;AAC7C,MAAM,MAAM,GAAG
|
|
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,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,8BAA8B,EAAE,MAAM,6CAA6C,CAAC;AAC7F,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE,MAAM,IAAI,GAAG,+BAA+B,CAAC;AAC7C,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0Ed,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,MAAM,QAAQ,GAAG,CAAC,uBAAuB,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,8BAA8B,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,aAAa,EAAE,kBAAkB,CAAC,CAAC;AAC1P,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;IACzB,IAAI,CAAC,WAAW,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAClD,WAAW,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC;IAChE,CAAC;AACL,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,iCAAiC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\nimport { sceneUboDeclarationWGSL } from \"./ShadersInclude/sceneUboDeclaration\";\nimport { meshUboDeclarationWGSL } from \"./ShadersInclude/meshUboDeclaration\";\nimport { helperFunctionsWGSL } from \"./ShadersInclude/helperFunctions\";\nimport { clipPlaneVertexDeclarationWGSL } from \"./ShadersInclude/clipPlaneVertexDeclaration\";\nimport { fogVertexDeclarationWGSL } from \"./ShadersInclude/fogVertexDeclaration\";\nimport { logDepthDeclarationWGSL } from \"./ShadersInclude/logDepthDeclaration\";\nimport { gaussianSplattingWGSL } from \"./ShadersInclude/gaussianSplatting\";\nimport { clipPlaneVertexWGSL } from \"./ShadersInclude/clipPlaneVertex\";\nimport { fogVertexWGSL } from \"./ShadersInclude/fogVertex\";\nimport { logDepthVertexWGSL } from \"./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 splatIndex0: vec4f;attribute splatIndex1: vec4f;attribute splatIndex2: vec4f;attribute splatIndex3: vec4f;attribute position: vec3f;uniform invViewport: vec2f;uniform dataTextureSize: vec2f;uniform focal: vec2f;uniform kernelSize: f32;uniform eyePosition: vec3f;uniform alpha: f32;\n#if IS_COMPOUND\nuniform partWorld: array<mat4x4<f32>,MAX_PART_COUNT>;uniform partVisibility: array<f32,MAX_PART_COUNT>;\n#endif\nvar 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\n#if SH_DEGREE>3\nvar shTexture3: texture_2d<u32>;var shTexture4: texture_2d<u32>;\n#endif\n#if IS_COMPOUND\nvar partIndicesTexture: texture_2d<f32>;\n#endif\nvarying vColor: vec4f;varying vPosition: vec2f;\n#define CUSTOM_VERTEX_DEFINITIONS\n#include<gaussianSplatting>\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nlet splatIndex: f32=getSplatIndex(i32(vertexInputs.position.z+0.5),vertexInputs.splatIndex0,vertexInputs.splatIndex1,vertexInputs.splatIndex2,vertexInputs.splatIndex3);var splat: Splat=readSplat(splatIndex,uniforms.dataTextureSize);var covA: vec3f=splat.covA.xyz;var covB: vec3f=vec3f(splat.covA.w,splat.covB.xy);\n#if IS_COMPOUND\nlet splatWorld: mat4x4f=getPartWorld(splat.partIndex);\n#else\nlet splatWorld: mat4x4f=mesh.world;\n#endif\nlet worldPos: vec4f=splatWorld*vec4f(splat.center.xyz,1.0);vertexOutputs.vPosition=vertexInputs.position.xy;\n#if SH_DEGREE>0\nlet worldRot: mat3x3f= mat3x3f(splatWorld[0].xyz,splatWorld[1].xyz,splatWorld[2].xyz);let normWorldRot: mat3x3f=inverseMat3(worldRot);var eyeToSplatLocalSpace: vec3f=normalize(normWorldRot*(worldPos.xyz-uniforms.eyePosition.xyz));\n#if defined(GS_DBG_ENABLED) && IS_COMPOUND\n{let _row3=textureLoad(dbgPartData,vec2i(i32(splat.partIndex),3),0);\n#if SH_DEGREE>3\nlet _so4=textureLoad(dbgPartData,vec2i(i32(splat.partIndex),4),0).x;\n#else\nlet _so4: f32=1.0;\n#endif\nvertexOutputs.vColor=vec4f(_row3.x*splat.color.xyz+computeSHWeighted(splat,eyeToSplatLocalSpace,_row3.y,_row3.z,_row3.w,_so4),splat.color.w*uniforms.alpha);}\n#elif defined(GS_DBG_ENABLED) && GS_DBG_SH_DC==0\nvertexOutputs.vColor=vec4f(computeSH(splat,eyeToSplatLocalSpace),splat.color.w*uniforms.alpha);\n#else\nvertexOutputs.vColor=vec4f(splat.color.xyz+computeSH(splat,eyeToSplatLocalSpace),splat.color.w*uniforms.alpha);\n#endif\n#else\n#if defined(GS_DBG_ENABLED) && IS_COMPOUND\n{let _shDc=textureLoad(dbgPartData,vec2i(i32(splat.partIndex),3),0).x;vertexOutputs.vColor=vec4f(_shDc*splat.color.xyz,splat.color.w*uniforms.alpha);}\n#elif defined(GS_DBG_ENABLED) && GS_DBG_SH_DC==0\nvertexOutputs.vColor=vec4f(0.0,0.0,0.0,splat.color.w*uniforms.alpha);\n#else\nvertexOutputs.vColor=vec4f(splat.color.xyz,splat.color.w*uniforms.alpha);\n#endif\n#endif\n#if IS_COMPOUND\nvertexOutputs.vColor.w*=uniforms.partVisibility[splat.partIndex];\n#endif\nvar scale: vec2f=vec2f(1.,1.);\n#define CUSTOM_VERTEX_UPDATE\nvertexOutputs.position=gaussianSplatting(vertexInputs.position.xy,worldPos.xyz,scale,covA,covB,splatWorld,scene.view,scene.projection,uniforms.focal,uniforms.invViewport,uniforms.kernelSize);\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<logDepthVertex>\n#define CUSTOM_VERTEX_MAIN_END\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\nconst includes = [sceneUboDeclarationWGSL, meshUboDeclarationWGSL, helperFunctionsWGSL, clipPlaneVertexDeclarationWGSL, fogVertexDeclarationWGSL, logDepthDeclarationWGSL, gaussianSplattingWGSL, clipPlaneVertexWGSL, fogVertexWGSL, logDepthVertexWGSL];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStoreWGSL[inc.name]) {\n ShaderStore.IncludesShadersStoreWGSL[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const gaussianSplattingVertexShaderWGSL = { name, shader };\n"]}
|