@babylonjs/core 8.9.1 → 8.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Engines/WebGPU/webgpuCacheBindGroups.js +4 -4
- package/Engines/WebGPU/webgpuCacheBindGroups.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.js +16 -1
- package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +2 -4
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
- package/Materials/Node/Blocks/GaussianSplatting/gaussianBlock.d.ts +8 -0
- package/Materials/Node/Blocks/GaussianSplatting/gaussianBlock.js +23 -3
- package/Materials/Node/Blocks/GaussianSplatting/gaussianBlock.js.map +1 -1
- package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.d.ts +13 -0
- package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js +44 -0
- package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js.map +1 -1
- package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.js +3 -0
- package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.js.map +1 -1
- package/Materials/Node/nodeMaterialBuildState.d.ts +1 -1
- package/Materials/Node/nodeMaterialBuildState.js +6 -3
- package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
- package/Materials/Node/nodeMaterialDefault.js +6 -1
- package/Materials/Node/nodeMaterialDefault.js.map +1 -1
- package/Meshes/Builders/decalBuilder.js +3 -2
- package/Meshes/Builders/decalBuilder.js.map +1 -1
- package/Shaders/ShadersInclude/gaussianSplatting.js +4 -4
- package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/Shaders/gaussianSplatting.vertex.js +3 -3
- package/Shaders/gaussianSplatting.vertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +2 -2
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/ShadersWGSL/gaussianSplatting.vertex.js +3 -3
- package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decalBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders/decalBuilder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EAAE,IAAI,EAAE,MAAM,mCAAmC,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAE9E,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACpC,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACrC,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACpC,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACrC,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACpC,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAErC,gBAAgB;AAChB,MAAM,WAAW;IACb,YACW,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,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC;IACpD,UAAU,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAE9B,IAAI,mBAAmB,EAAE,CAAC;QACtB,KAAK,CAAC,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;QACrC,KAAK,CAAC,MAAM,GAAG,UAAU,CAAC;IAC9B,CAAC;SAAM,CAAC;QACJ,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC;QAClC,KAAK,CAAC,QAAQ,GAAG,IAAI,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;IAC/B,KAAK,CAAC,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAEtC,OAAO,KAAK,CAAC;AACjB,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IACxB,gEAAgE;IAChE,WAAW;CACd,CAAC;AAEF,IAAI,CAAC,WAAW,GAAG,CAAC,IAAY,EAAE,UAAwB,EAAE,QAAiB,EAAE,MAAe,EAAE,IAAa,EAAE,KAAa,EAAQ,EAAE;IAClI,MAAM,OAAO,GAAG;QACZ,QAAQ;QACR,MAAM;QACN,IAAI;QACJ,KAAK;KACR,CAAC;IAEF,OAAO,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;AAClD,CAAC,CAAC","sourcesContent":["import type { Nullable, IndicesArray, FloatArray } from \"../../types\";\r\nimport { Vector3, Matrix, Vector2, TmpVectors } from \"../../Maths/math.vector\";\r\nimport { Lerp } from \"../../Maths/math.scalar.functions\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { VertexBuffer } from \"../../Buffers/buffer\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport type { AbstractMesh } from \"../abstractMesh\";\r\nimport type { Camera } from \"../../Cameras/camera\";\r\nimport { useOpenGLOrientationForUV } from \"../../Compat/compatibilityOptions\";\r\n\r\nconst XpAxis = new Vector3(1, 0, 0);\r\nconst XnAxis = new Vector3(-1, 0, 0);\r\nconst YpAxis = new Vector3(0, 1, 0);\r\nconst YnAxis = new Vector3(0, -1, 0);\r\nconst ZpAxis = new Vector3(0, 0, 1);\r\nconst ZnAxis = new Vector3(0, 0, -1);\r\n\r\n/** @internal */\r\nclass DecalVertex {\r\n constructor(\r\n public position: Vector3 = Vector3.Zero(),\r\n public normal: Vector3 = Vector3.Up(),\r\n public uv: Vector2 = Vector2.Zero(),\r\n public vertexIdx: number = 0,\r\n public vertexIdxForBones: number = 0,\r\n public localPositionOverride: Nullable<number[]> = null,\r\n public localNormalOverride: Nullable<number[]> = null,\r\n public matrixIndicesOverride: Nullable<number[]> = null,\r\n public matrixWeightsOverride: Nullable<number[]> = null\r\n ) {}\r\n public clone(): DecalVertex {\r\n return new DecalVertex(\r\n this.position.clone(),\r\n this.normal.clone(),\r\n this.uv.clone(),\r\n this.vertexIdx,\r\n this.vertexIdxForBones,\r\n this.localPositionOverride?.slice(),\r\n this.localNormalOverride?.slice(),\r\n this.matrixIndicesOverride?.slice(),\r\n this.matrixWeightsOverride?.slice()\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * Creates a decal mesh.\r\n * A decal is a mesh usually applied as a model onto the surface of another mesh. So don't forget the parameter `sourceMesh` depicting the decal\r\n * * The parameter `position` (Vector3, default `(0, 0, 0)`) sets the position of the decal in World coordinates\r\n * * The parameter `normal` (Vector3, default `Vector3.Up`) sets the normal of the mesh where the decal is applied onto in World coordinates\r\n * * The parameter `size` (Vector3, default `(1, 1, 1)`) sets the decal scaling\r\n * * The parameter `angle` (float in radian, default 0) sets the angle to rotate the decal\r\n * * The parameter `captureUVS` defines if we need to capture the uvs or compute them\r\n * * The parameter `cullBackFaces` defines if the back faces should be removed from the decal mesh\r\n * * The parameter `localMode` defines that the computations should be done with the local mesh coordinates instead of the world space coordinates.\r\n * * Use this mode if you want the decal to be parented to the sourceMesh and move/rotate with it.\r\n * Note: Meshes with morph targets are not supported!\r\n * @param name defines the name of the mesh\r\n * @param sourceMesh defines the mesh where the decal must be applied\r\n * @param options defines the options used to create the mesh\r\n * @returns the decal mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/decals\r\n */\r\nexport function CreateDecal(\r\n name: string,\r\n sourceMesh: AbstractMesh,\r\n options: { position?: Vector3; normal?: Vector3; size?: Vector3; angle?: number; captureUVS?: boolean; cullBackFaces?: boolean; localMode?: boolean }\r\n): Mesh {\r\n const hasSkeleton = !!sourceMesh.skeleton;\r\n const useLocalComputation = options.localMode || hasSkeleton;\r\n\r\n const indices = <IndicesArray>sourceMesh.getIndices();\r\n const positions = hasSkeleton ? sourceMesh.getPositionData(true, true) : sourceMesh.getVerticesData(VertexBuffer.PositionKind);\r\n const normals = hasSkeleton ? sourceMesh.getNormalsData(true, true) : sourceMesh.getVerticesData(VertexBuffer.NormalKind);\r\n const localPositions = useLocalComputation ? (hasSkeleton ? sourceMesh.getVerticesData(VertexBuffer.PositionKind) : positions) : null;\r\n const localNormals = useLocalComputation ? (hasSkeleton ? sourceMesh.getVerticesData(VertexBuffer.NormalKind) : normals) : null;\r\n const uvs = sourceMesh.getVerticesData(VertexBuffer.UVKind);\r\n const matIndices = hasSkeleton ? sourceMesh.getVerticesData(VertexBuffer.MatricesIndicesKind) : null;\r\n const matWeights = hasSkeleton ? sourceMesh.getVerticesData(VertexBuffer.MatricesWeightsKind) : null;\r\n const matIndicesExtra = hasSkeleton ? sourceMesh.getVerticesData(VertexBuffer.MatricesIndicesExtraKind) : null;\r\n const matWeightsExtra = hasSkeleton ? sourceMesh.getVerticesData(VertexBuffer.MatricesWeightsExtraKind) : null;\r\n\r\n const position = options.position || Vector3.Zero();\r\n let normal = options.normal || Vector3.Up();\r\n const size = options.size || Vector3.One();\r\n const angle = options.angle || 0;\r\n\r\n // Getting correct rotation\r\n if (!normal) {\r\n const target = new Vector3(0, 0, 1);\r\n const camera = <Camera>sourceMesh.getScene().activeCamera;\r\n const cameraWorldTarget = Vector3.TransformCoordinates(target, camera.getWorldMatrix());\r\n\r\n normal = camera.globalPosition.subtract(cameraWorldTarget);\r\n }\r\n\r\n const yaw = -Math.atan2(normal.z, normal.x) - Math.PI / 2;\r\n const len = Math.sqrt(normal.x * normal.x + normal.z * normal.z);\r\n const pitch = Math.atan2(normal.y, len);\r\n\r\n const vertexData = new VertexData();\r\n vertexData.indices = [];\r\n vertexData.positions = [];\r\n vertexData.normals = [];\r\n vertexData.uvs = [];\r\n vertexData.matricesIndices = hasSkeleton ? [] : null;\r\n vertexData.matricesWeights = hasSkeleton ? [] : null;\r\n vertexData.matricesIndicesExtra = matIndicesExtra ? [] : null;\r\n vertexData.matricesWeightsExtra = matWeightsExtra ? [] : null;\r\n\r\n let currentVertexDataIndex = 0;\r\n\r\n const extractDecalVector3 = (indexId: number, transformMatrix: Matrix): DecalVertex => {\r\n const result = new DecalVertex();\r\n if (!indices || !positions || !normals) {\r\n return result;\r\n }\r\n\r\n const vertexId = indices[indexId];\r\n\r\n result.vertexIdx = vertexId * 3;\r\n result.vertexIdxForBones = vertexId * 4;\r\n\r\n // Send vector to decal local world\r\n result.position = new Vector3(positions[vertexId * 3], positions[vertexId * 3 + 1], positions[vertexId * 3 + 2]);\r\n Vector3.TransformCoordinatesToRef(result.position, transformMatrix, result.position);\r\n\r\n // Get normal\r\n result.normal = new Vector3(normals[vertexId * 3], normals[vertexId * 3 + 1], normals[vertexId * 3 + 2]);\r\n Vector3.TransformNormalToRef(result.normal, transformMatrix, result.normal);\r\n\r\n if (options.captureUVS && uvs) {\r\n const v = uvs[vertexId * 2 + 1];\r\n result.uv = new Vector2(uvs[vertexId * 2], useOpenGLOrientationForUV ? 1 - v : v);\r\n }\r\n\r\n return result;\r\n };\r\n\r\n const emptyArray = [0, 0, 0, 0];\r\n\r\n // Inspired by https://github.com/mrdoob/three.js/blob/eee231960882f6f3b6113405f524956145148146/examples/js/geometries/DecalGeometry.js\r\n const clip = (vertices: DecalVertex[], axis: Vector3): Nullable<DecalVertex[]> => {\r\n if (vertices.length === 0) {\r\n return vertices;\r\n }\r\n\r\n const clipSize = 0.5 * Math.abs(Vector3.Dot(size, axis));\r\n\r\n const indexOf = (arr: FloatArray | number[], val: number, start: number, num: number) => {\r\n for (let i = 0; i < num; ++i) {\r\n if (arr[start + i] === val) {\r\n return start + i;\r\n }\r\n }\r\n return -1;\r\n };\r\n\r\n const clipVertices = (v0: DecalVertex, v1: DecalVertex): DecalVertex => {\r\n const clipFactor = Vector3.GetClipFactor(v0.position, v1.position, axis, clipSize);\r\n\r\n let indices = emptyArray;\r\n let weights = emptyArray;\r\n\r\n if (matIndices && matWeights) {\r\n const mat0Index = v0.matrixIndicesOverride ? 0 : v0.vertexIdxForBones;\r\n const v0Indices = v0.matrixIndicesOverride ?? matIndices;\r\n const v0Weights = v0.matrixWeightsOverride ?? matWeights;\r\n\r\n const mat1Index = v1.matrixIndicesOverride ? 0 : v1.vertexIdxForBones;\r\n const v1Indices = v1.matrixIndicesOverride ?? matIndices;\r\n const v1Weights = v1.matrixWeightsOverride ?? matWeights;\r\n\r\n indices = [0, 0, 0, 0];\r\n weights = [0, 0, 0, 0];\r\n\r\n let index = 0;\r\n for (let i = 0; i < 4; ++i) {\r\n if (v0Weights[mat0Index + i] > 0) {\r\n const idx = indexOf(v1Indices, v0Indices[mat0Index + i], mat1Index, 4);\r\n indices[index] = v0Indices[mat0Index + i];\r\n weights[index] = Lerp(v0Weights[mat0Index + i], idx >= 0 ? v1Weights[idx] : 0, clipFactor);\r\n index++;\r\n }\r\n }\r\n\r\n for (let i = 0; i < 4 && index < 4; ++i) {\r\n const ind = v1Indices[mat1Index + i];\r\n if (indexOf(v0Indices, ind, mat0Index, 4) !== -1) {\r\n continue;\r\n }\r\n\r\n indices[index] = ind;\r\n weights[index] = Lerp(0, v1Weights[mat1Index + i], clipFactor);\r\n index++;\r\n }\r\n\r\n const sumw = weights[0] + weights[1] + weights[2] + weights[3];\r\n\r\n weights[0] /= sumw;\r\n weights[1] /= sumw;\r\n weights[2] /= sumw;\r\n weights[3] /= sumw;\r\n }\r\n\r\n const v0LocalPositionX = v0.localPositionOverride ? v0.localPositionOverride[0] : (localPositions?.[v0.vertexIdx] ?? 0);\r\n const v0LocalPositionY = v0.localPositionOverride ? v0.localPositionOverride[1] : (localPositions?.[v0.vertexIdx + 1] ?? 0);\r\n const v0LocalPositionZ = v0.localPositionOverride ? v0.localPositionOverride[2] : (localPositions?.[v0.vertexIdx + 2] ?? 0);\r\n\r\n const v1LocalPositionX = v1.localPositionOverride ? v1.localPositionOverride[0] : (localPositions?.[v1.vertexIdx] ?? 0);\r\n const v1LocalPositionY = v1.localPositionOverride ? v1.localPositionOverride[1] : (localPositions?.[v1.vertexIdx + 1] ?? 0);\r\n const v1LocalPositionZ = v1.localPositionOverride ? v1.localPositionOverride[2] : (localPositions?.[v1.vertexIdx + 2] ?? 0);\r\n\r\n const v0LocalNormalX = v0.localNormalOverride ? v0.localNormalOverride[0] : (localNormals?.[v0.vertexIdx] ?? 0);\r\n const v0LocalNormalY = v0.localNormalOverride ? v0.localNormalOverride[1] : (localNormals?.[v0.vertexIdx + 1] ?? 0);\r\n const v0LocalNormalZ = v0.localNormalOverride ? v0.localNormalOverride[2] : (localNormals?.[v0.vertexIdx + 2] ?? 0);\r\n\r\n const v1LocalNormalX = v1.localNormalOverride ? v1.localNormalOverride[0] : (localNormals?.[v1.vertexIdx] ?? 0);\r\n const v1LocalNormalY = v1.localNormalOverride ? v1.localNormalOverride[1] : (localNormals?.[v1.vertexIdx + 1] ?? 0);\r\n const v1LocalNormalZ = v1.localNormalOverride ? v1.localNormalOverride[2] : (localNormals?.[v1.vertexIdx + 2] ?? 0);\r\n\r\n const interpNormalX = v0LocalNormalX + (v1LocalNormalX - v0LocalNormalX) * clipFactor;\r\n const interpNormalY = v0LocalNormalY + (v1LocalNormalY - v0LocalNormalY) * clipFactor;\r\n const interpNormalZ = v0LocalNormalZ + (v1LocalNormalZ - v0LocalNormalZ) * clipFactor;\r\n\r\n const norm = Math.sqrt(interpNormalX * interpNormalX + interpNormalY * interpNormalY + interpNormalZ * interpNormalZ);\r\n\r\n return new DecalVertex(\r\n Vector3.Lerp(v0.position, v1.position, clipFactor),\r\n Vector3.Lerp(v0.normal, v1.normal, clipFactor).normalize(),\r\n Vector2.Lerp(v0.uv, v1.uv, clipFactor),\r\n -1,\r\n -1,\r\n localPositions\r\n ? [\r\n v0LocalPositionX + (v1LocalPositionX - v0LocalPositionX) * clipFactor,\r\n v0LocalPositionY + (v1LocalPositionY - v0LocalPositionY) * clipFactor,\r\n v0LocalPositionZ + (v1LocalPositionZ - v0LocalPositionZ) * clipFactor,\r\n ]\r\n : null,\r\n localNormals ? [interpNormalX / norm, interpNormalY / norm, interpNormalZ / norm] : null,\r\n indices,\r\n weights\r\n );\r\n };\r\n\r\n let clipResult: Nullable<DecalVertex[]> = null;\r\n\r\n if (vertices.length > 3) {\r\n clipResult = [] as DecalVertex[];\r\n }\r\n\r\n for (let index = 0; index < vertices.length; index += 3) {\r\n let total = 0;\r\n let nV1: Nullable<DecalVertex> = null;\r\n let nV2: Nullable<DecalVertex> = null;\r\n let nV3: Nullable<DecalVertex> = null;\r\n let nV4: Nullable<DecalVertex> = null;\r\n\r\n const d1 = Vector3.Dot(vertices[index].position, axis) - clipSize;\r\n const d2 = Vector3.Dot(vertices[index + 1].position, axis) - clipSize;\r\n const d3 = Vector3.Dot(vertices[index + 2].position, axis) - clipSize;\r\n\r\n const v1Out = d1 > 0;\r\n const v2Out = d2 > 0;\r\n const v3Out = d3 > 0;\r\n\r\n total = (v1Out ? 1 : 0) + (v2Out ? 1 : 0) + (v3Out ? 1 : 0);\r\n\r\n switch (total) {\r\n case 0:\r\n if (vertices.length > 3) {\r\n clipResult!.push(vertices[index]);\r\n clipResult!.push(vertices[index + 1]);\r\n clipResult!.push(vertices[index + 2]);\r\n } else {\r\n clipResult = vertices;\r\n }\r\n break;\r\n case 1:\r\n clipResult = clipResult ?? new Array<DecalVertex>();\r\n if (v1Out) {\r\n nV1 = vertices[index + 1];\r\n nV2 = vertices[index + 2];\r\n nV3 = clipVertices(vertices[index], nV1);\r\n nV4 = clipVertices(vertices[index], nV2);\r\n }\r\n\r\n if (v2Out) {\r\n nV1 = vertices[index];\r\n nV2 = vertices[index + 2];\r\n nV3 = clipVertices(vertices[index + 1], nV1);\r\n nV4 = clipVertices(vertices[index + 1], nV2);\r\n\r\n clipResult.push(nV3);\r\n clipResult.push(nV2.clone());\r\n clipResult.push(nV1.clone());\r\n\r\n clipResult.push(nV2.clone());\r\n clipResult.push(nV3.clone());\r\n clipResult.push(nV4);\r\n break;\r\n }\r\n if (v3Out) {\r\n nV1 = vertices[index];\r\n nV2 = vertices[index + 1];\r\n nV3 = clipVertices(vertices[index + 2], nV1);\r\n nV4 = clipVertices(vertices[index + 2], nV2);\r\n }\r\n\r\n if (nV1 && nV2 && nV3 && nV4) {\r\n clipResult.push(nV1.clone());\r\n clipResult.push(nV2.clone());\r\n clipResult.push(nV3);\r\n\r\n clipResult.push(nV4);\r\n clipResult.push(nV3.clone());\r\n clipResult.push(nV2.clone());\r\n }\r\n break;\r\n case 2:\r\n clipResult = clipResult ?? new Array<DecalVertex>();\r\n if (!v1Out) {\r\n nV1 = vertices[index].clone();\r\n nV2 = clipVertices(nV1, vertices[index + 1]);\r\n nV3 = clipVertices(nV1, vertices[index + 2]);\r\n clipResult.push(nV1);\r\n clipResult.push(nV2);\r\n clipResult.push(nV3);\r\n }\r\n if (!v2Out) {\r\n nV1 = vertices[index + 1].clone();\r\n nV2 = clipVertices(nV1, vertices[index + 2]);\r\n nV3 = clipVertices(nV1, vertices[index]);\r\n clipResult.push(nV1);\r\n clipResult.push(nV2);\r\n clipResult.push(nV3);\r\n }\r\n if (!v3Out) {\r\n nV1 = vertices[index + 2].clone();\r\n nV2 = clipVertices(nV1, vertices[index]);\r\n nV3 = clipVertices(nV1, vertices[index + 1]);\r\n clipResult.push(nV1);\r\n clipResult.push(nV2);\r\n clipResult.push(nV3);\r\n }\r\n break;\r\n case 3:\r\n break;\r\n }\r\n }\r\n\r\n return clipResult;\r\n };\r\n\r\n const sourceMeshAsMesh = sourceMesh instanceof Mesh ? sourceMesh : null;\r\n const matrixData = sourceMeshAsMesh?._thinInstanceDataStorage.matrixData;\r\n\r\n const numMatrices = sourceMeshAsMesh?.thinInstanceCount || 1;\r\n const thinInstanceMatrix = TmpVectors.Matrix[0];\r\n\r\n thinInstanceMatrix.copyFrom(Matrix.IdentityReadOnly);\r\n\r\n for (let m = 0; m < numMatrices; ++m) {\r\n if (sourceMeshAsMesh?.hasThinInstances && matrixData) {\r\n const ofst = m * 16;\r\n\r\n thinInstanceMatrix.setRowFromFloats(0, matrixData[ofst + 0], matrixData[ofst + 1], matrixData[ofst + 2], matrixData[ofst + 3]);\r\n thinInstanceMatrix.setRowFromFloats(1, matrixData[ofst + 4], matrixData[ofst + 5], matrixData[ofst + 6], matrixData[ofst + 7]);\r\n thinInstanceMatrix.setRowFromFloats(2, matrixData[ofst + 8], matrixData[ofst + 9], matrixData[ofst + 10], matrixData[ofst + 11]);\r\n thinInstanceMatrix.setRowFromFloats(3, matrixData[ofst + 12], matrixData[ofst + 13], matrixData[ofst + 14], matrixData[ofst + 15]);\r\n }\r\n\r\n // Matrix\r\n const decalWorldMatrix = Matrix.RotationYawPitchRoll(yaw, pitch, angle).multiply(Matrix.Translation(position.x, position.y, position.z));\r\n const inverseDecalWorldMatrix = Matrix.Invert(decalWorldMatrix);\r\n const meshWorldMatrix = sourceMesh.getWorldMatrix();\r\n const transformMatrix = thinInstanceMatrix.multiply(meshWorldMatrix).multiply(inverseDecalWorldMatrix);\r\n\r\n const oneFaceVertices = new Array<DecalVertex>(3);\r\n\r\n for (let index = 0; index < indices.length; index += 3) {\r\n let faceVertices: Nullable<DecalVertex[]> = oneFaceVertices;\r\n\r\n faceVertices[0] = extractDecalVector3(index, transformMatrix);\r\n faceVertices[1] = extractDecalVector3(index + 1, transformMatrix);\r\n faceVertices[2] = extractDecalVector3(index + 2, transformMatrix);\r\n\r\n if (options.cullBackFaces) {\r\n // If all the normals of the vertices of the face are pointing away from the view direction we discard the face.\r\n // As computations are done in the decal coordinate space, the viewDirection is (0,0,1), so when dot(vertexNormal, -viewDirection) <= 0 the vertex is culled\r\n if (-faceVertices[0].normal.z <= 0 && -faceVertices[1].normal.z <= 0 && -faceVertices[2].normal.z <= 0) {\r\n continue;\r\n }\r\n }\r\n\r\n // Clip\r\n faceVertices = clip(faceVertices, XpAxis);\r\n if (!faceVertices) {\r\n continue;\r\n }\r\n faceVertices = clip(faceVertices, XnAxis);\r\n if (!faceVertices) {\r\n continue;\r\n }\r\n faceVertices = clip(faceVertices, YpAxis);\r\n if (!faceVertices) {\r\n continue;\r\n }\r\n faceVertices = clip(faceVertices, YnAxis);\r\n if (!faceVertices) {\r\n continue;\r\n }\r\n faceVertices = clip(faceVertices, ZpAxis);\r\n if (!faceVertices) {\r\n continue;\r\n }\r\n faceVertices = clip(faceVertices, ZnAxis);\r\n if (!faceVertices) {\r\n continue;\r\n }\r\n\r\n // Add UVs and get back to world\r\n for (let vIndex = 0; vIndex < faceVertices.length; vIndex++) {\r\n const vertex = faceVertices[vIndex];\r\n\r\n //TODO check for Int32Array | Uint32Array | Uint16Array\r\n vertexData.indices.push(currentVertexDataIndex);\r\n if (useLocalComputation) {\r\n if (vertex.localPositionOverride) {\r\n vertexData.positions[currentVertexDataIndex * 3] = vertex.localPositionOverride[0];\r\n vertexData.positions[currentVertexDataIndex * 3 + 1] = vertex.localPositionOverride[1];\r\n vertexData.positions[currentVertexDataIndex * 3 + 2] = vertex.localPositionOverride[2];\r\n } else if (localPositions) {\r\n vertexData.positions[currentVertexDataIndex * 3] = localPositions[vertex.vertexIdx];\r\n vertexData.positions[currentVertexDataIndex * 3 + 1] = localPositions[vertex.vertexIdx + 1];\r\n vertexData.positions[currentVertexDataIndex * 3 + 2] = localPositions[vertex.vertexIdx + 2];\r\n }\r\n if (vertex.localNormalOverride) {\r\n vertexData.normals[currentVertexDataIndex * 3] = vertex.localNormalOverride[0];\r\n vertexData.normals[currentVertexDataIndex * 3 + 1] = vertex.localNormalOverride[1];\r\n vertexData.normals[currentVertexDataIndex * 3 + 2] = vertex.localNormalOverride[2];\r\n } else if (localNormals) {\r\n vertexData.normals[currentVertexDataIndex * 3] = localNormals[vertex.vertexIdx];\r\n vertexData.normals[currentVertexDataIndex * 3 + 1] = localNormals[vertex.vertexIdx + 1];\r\n vertexData.normals[currentVertexDataIndex * 3 + 2] = localNormals[vertex.vertexIdx + 2];\r\n }\r\n } else {\r\n vertex.position.toArray(vertexData.positions, currentVertexDataIndex * 3);\r\n vertex.normal.toArray(vertexData.normals, currentVertexDataIndex * 3);\r\n }\r\n if (vertexData.matricesIndices && vertexData.matricesWeights) {\r\n if (vertex.matrixIndicesOverride) {\r\n vertexData.matricesIndices[currentVertexDataIndex * 4] = vertex.matrixIndicesOverride[0];\r\n vertexData.matricesIndices[currentVertexDataIndex * 4 + 1] = vertex.matrixIndicesOverride[1];\r\n vertexData.matricesIndices[currentVertexDataIndex * 4 + 2] = vertex.matrixIndicesOverride[2];\r\n vertexData.matricesIndices[currentVertexDataIndex * 4 + 3] = vertex.matrixIndicesOverride[3];\r\n } else {\r\n if (matIndices) {\r\n vertexData.matricesIndices[currentVertexDataIndex * 4] = matIndices[vertex.vertexIdxForBones];\r\n vertexData.matricesIndices[currentVertexDataIndex * 4 + 1] = matIndices[vertex.vertexIdxForBones + 1];\r\n vertexData.matricesIndices[currentVertexDataIndex * 4 + 2] = matIndices[vertex.vertexIdxForBones + 2];\r\n vertexData.matricesIndices[currentVertexDataIndex * 4 + 3] = matIndices[vertex.vertexIdxForBones + 3];\r\n }\r\n if (matIndicesExtra && vertexData.matricesIndicesExtra) {\r\n vertexData.matricesIndicesExtra[currentVertexDataIndex * 4] = matIndicesExtra[vertex.vertexIdxForBones];\r\n vertexData.matricesIndicesExtra[currentVertexDataIndex * 4 + 1] = matIndicesExtra[vertex.vertexIdxForBones + 1];\r\n vertexData.matricesIndicesExtra[currentVertexDataIndex * 4 + 2] = matIndicesExtra[vertex.vertexIdxForBones + 2];\r\n vertexData.matricesIndicesExtra[currentVertexDataIndex * 4 + 3] = matIndicesExtra[vertex.vertexIdxForBones + 3];\r\n }\r\n }\r\n if (vertex.matrixWeightsOverride) {\r\n vertexData.matricesWeights[currentVertexDataIndex * 4] = vertex.matrixWeightsOverride[0];\r\n vertexData.matricesWeights[currentVertexDataIndex * 4 + 1] = vertex.matrixWeightsOverride[1];\r\n vertexData.matricesWeights[currentVertexDataIndex * 4 + 2] = vertex.matrixWeightsOverride[2];\r\n vertexData.matricesWeights[currentVertexDataIndex * 4 + 3] = vertex.matrixWeightsOverride[3];\r\n } else {\r\n if (matWeights) {\r\n vertexData.matricesWeights[currentVertexDataIndex * 4] = matWeights[vertex.vertexIdxForBones];\r\n vertexData.matricesWeights[currentVertexDataIndex * 4 + 1] = matWeights[vertex.vertexIdxForBones + 1];\r\n vertexData.matricesWeights[currentVertexDataIndex * 4 + 2] = matWeights[vertex.vertexIdxForBones + 2];\r\n vertexData.matricesWeights[currentVertexDataIndex * 4 + 3] = matWeights[vertex.vertexIdxForBones + 3];\r\n }\r\n if (matWeightsExtra && vertexData.matricesWeightsExtra) {\r\n vertexData.matricesWeightsExtra[currentVertexDataIndex * 4] = matWeightsExtra[vertex.vertexIdxForBones];\r\n vertexData.matricesWeightsExtra[currentVertexDataIndex * 4 + 1] = matWeightsExtra[vertex.vertexIdxForBones + 1];\r\n vertexData.matricesWeightsExtra[currentVertexDataIndex * 4 + 2] = matWeightsExtra[vertex.vertexIdxForBones + 2];\r\n vertexData.matricesWeightsExtra[currentVertexDataIndex * 4 + 3] = matWeightsExtra[vertex.vertexIdxForBones + 3];\r\n }\r\n }\r\n }\r\n\r\n if (!options.captureUVS) {\r\n vertexData.uvs.push(0.5 + vertex.position.x / size.x);\r\n const v = 0.5 + vertex.position.y / size.y;\r\n vertexData.uvs.push(useOpenGLOrientationForUV ? 1 - v : v);\r\n } else {\r\n vertex.uv.toArray(vertexData.uvs, currentVertexDataIndex * 2);\r\n }\r\n currentVertexDataIndex++;\r\n }\r\n }\r\n }\r\n\r\n // Avoid the \"Setting vertex data kind 'XXX' with an empty array\" warning when calling vertexData.applyToMesh\r\n if (vertexData.indices.length === 0) {\r\n vertexData.indices = null;\r\n }\r\n if (vertexData.positions.length === 0) {\r\n vertexData.positions = null;\r\n }\r\n if (vertexData.normals.length === 0) {\r\n vertexData.normals = null;\r\n }\r\n if (vertexData.uvs.length === 0) {\r\n vertexData.uvs = null;\r\n }\r\n if (vertexData.matricesIndices?.length === 0) {\r\n vertexData.matricesIndices = null;\r\n }\r\n if (vertexData.matricesWeights?.length === 0) {\r\n vertexData.matricesWeights = null;\r\n }\r\n if (vertexData.matricesIndicesExtra?.length === 0) {\r\n vertexData.matricesIndicesExtra = null;\r\n }\r\n if (vertexData.matricesWeightsExtra?.length === 0) {\r\n vertexData.matricesWeightsExtra = null;\r\n }\r\n\r\n // Return mesh\r\n const decal = new Mesh(name, sourceMesh.getScene());\r\n vertexData.applyToMesh(decal);\r\n\r\n if (useLocalComputation) {\r\n decal.skeleton = sourceMesh.skeleton;\r\n decal.parent = sourceMesh;\r\n } else {\r\n decal.position = position.clone();\r\n decal.rotation = new Vector3(pitch, yaw, angle);\r\n }\r\n\r\n decal.computeWorldMatrix(true);\r\n decal.refreshBoundingInfo(true, true);\r\n\r\n return decal;\r\n}\r\n\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated use the function directly from the module\r\n */\r\nexport const DecalBuilder = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateDecal,\r\n};\r\n\r\nMesh.CreateDecal = (name: string, sourceMesh: AbstractMesh, position: Vector3, normal: Vector3, size: Vector3, angle: number): Mesh => {\r\n const options = {\r\n position,\r\n normal,\r\n size,\r\n angle,\r\n };\r\n\r\n return CreateDecal(name, sourceMesh, options);\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"decalBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders/decalBuilder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EAAE,IAAI,EAAE,MAAM,mCAAmC,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAE9E,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACpC,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACrC,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACpC,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACrC,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACpC,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAErC,gBAAgB;AAChB,MAAM,WAAW;IACb,YACW,WAAoB,OAAO,CAAC,IAAI,EAAE,EAClC,SAAkB,OAAO,CAAC,EAAE,EAAE,EAC9B,KAAc,OAAO,CAAC,IAAI,EAAE,EAC5B,YAAoB,CAAC,EACrB,oBAA4B,CAAC,EAC7B,wBAA4C,IAAI,EAChD,sBA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,CAAC;IAE9B,IAAI,mBAAmB,EAAE,CAAC;QACtB,KAAK,CAAC,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;QACrC,KAAK,CAAC,MAAM,GAAG,UAAU,CAAC;IAC9B,CAAC;SAAM,CAAC;QACJ,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC;QAClC,KAAK,CAAC,QAAQ,GAAG,IAAI,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;IAC/B,KAAK,CAAC,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAEtC,OAAO,KAAK,CAAC;AACjB,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IACxB,gEAAgE;IAChE,WAAW;CACd,CAAC;AAEF,IAAI,CAAC,WAAW,GAAG,CAAC,IAAY,EAAE,UAAwB,EAAE,QAAiB,EAAE,MAAe,EAAE,IAAa,EAAE,KAAa,EAAQ,EAAE;IAClI,MAAM,OAAO,GAAG;QACZ,QAAQ;QACR,MAAM;QACN,IAAI;QACJ,KAAK;KACR,CAAC;IAEF,OAAO,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;AAClD,CAAC,CAAC","sourcesContent":["import type { Nullable, IndicesArray, FloatArray } from \"../../types\";\r\nimport { Vector3, Matrix, Vector2, TmpVectors } from \"../../Maths/math.vector\";\r\nimport { Lerp } from \"../../Maths/math.scalar.functions\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { VertexBuffer } from \"../../Buffers/buffer\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport type { AbstractMesh } from \"../abstractMesh\";\r\nimport type { Camera } from \"../../Cameras/camera\";\r\nimport { useOpenGLOrientationForUV } from \"../../Compat/compatibilityOptions\";\r\n\r\nconst XpAxis = new Vector3(1, 0, 0);\r\nconst XnAxis = new Vector3(-1, 0, 0);\r\nconst YpAxis = new Vector3(0, 1, 0);\r\nconst YnAxis = new Vector3(0, -1, 0);\r\nconst ZpAxis = new Vector3(0, 0, 1);\r\nconst ZnAxis = new Vector3(0, 0, -1);\r\n\r\n/** @internal */\r\nclass DecalVertex {\r\n constructor(\r\n public position: Vector3 = Vector3.Zero(),\r\n public normal: Vector3 = Vector3.Up(),\r\n public uv: Vector2 = Vector2.Zero(),\r\n public vertexIdx: number = 0,\r\n public vertexIdxForBones: number = 0,\r\n public localPositionOverride: Nullable<number[]> = null,\r\n public localNormalOverride: Nullable<number[]> = null,\r\n public matrixIndicesOverride: Nullable<number[]> = null,\r\n public matrixWeightsOverride: Nullable<number[]> = null\r\n ) {}\r\n public clone(): DecalVertex {\r\n return new DecalVertex(\r\n this.position.clone(),\r\n this.normal.clone(),\r\n this.uv.clone(),\r\n this.vertexIdx,\r\n this.vertexIdxForBones,\r\n this.localPositionOverride?.slice(),\r\n this.localNormalOverride?.slice(),\r\n this.matrixIndicesOverride?.slice(),\r\n this.matrixWeightsOverride?.slice()\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * Creates a decal mesh.\r\n * A decal is a mesh usually applied as a model onto the surface of another mesh. So don't forget the parameter `sourceMesh` depicting the decal\r\n * * The parameter `position` (Vector3, default `(0, 0, 0)`) sets the position of the decal in World coordinates\r\n * * The parameter `normal` (Vector3, default `Vector3.Up`) sets the normal of the mesh where the decal is applied onto in World coordinates\r\n * * The parameter `size` (Vector3, default `(1, 1, 1)`) sets the decal scaling\r\n * * The parameter `angle` (float in radian, default 0) sets the angle to rotate the decal\r\n * * The parameter `captureUVS` defines if we need to capture the uvs or compute them\r\n * * The parameter `cullBackFaces` defines if the back faces should be removed from the decal mesh\r\n * * The parameter `localMode` defines that the computations should be done with the local mesh coordinates instead of the world space coordinates.\r\n * * Use this mode if you want the decal to be parented to the sourceMesh and move/rotate with it.\r\n * Note: Meshes with morph targets are not supported!\r\n * @param name defines the name of the mesh\r\n * @param sourceMesh defines the mesh where the decal must be applied\r\n * @param options defines the options used to create the mesh\r\n * @returns the decal mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/decals\r\n */\r\nexport function CreateDecal(\r\n name: string,\r\n sourceMesh: AbstractMesh,\r\n options: { position?: Vector3; normal?: Vector3; size?: Vector3; angle?: number; captureUVS?: boolean; cullBackFaces?: boolean; localMode?: boolean }\r\n): Mesh {\r\n const hasSkeleton = !!sourceMesh.skeleton;\r\n const hasMorphTargets = !!sourceMesh.morphTargetManager?.numTargets;\r\n const useLocalComputation = options.localMode || hasSkeleton;\r\n\r\n const indices = <IndicesArray>sourceMesh.getIndices();\r\n const positions = hasSkeleton || hasMorphTargets ? sourceMesh.getPositionData(true, true) : sourceMesh.getVerticesData(VertexBuffer.PositionKind);\r\n const normals = hasSkeleton || hasMorphTargets ? sourceMesh.getNormalsData(true, true) : sourceMesh.getVerticesData(VertexBuffer.NormalKind);\r\n const localPositions = useLocalComputation ? (hasSkeleton ? sourceMesh.getVerticesData(VertexBuffer.PositionKind) : positions) : null;\r\n const localNormals = useLocalComputation ? (hasSkeleton ? sourceMesh.getVerticesData(VertexBuffer.NormalKind) : normals) : null;\r\n const uvs = sourceMesh.getVerticesData(VertexBuffer.UVKind);\r\n const matIndices = hasSkeleton ? sourceMesh.getVerticesData(VertexBuffer.MatricesIndicesKind) : null;\r\n const matWeights = hasSkeleton ? sourceMesh.getVerticesData(VertexBuffer.MatricesWeightsKind) : null;\r\n const matIndicesExtra = hasSkeleton ? sourceMesh.getVerticesData(VertexBuffer.MatricesIndicesExtraKind) : null;\r\n const matWeightsExtra = hasSkeleton ? sourceMesh.getVerticesData(VertexBuffer.MatricesWeightsExtraKind) : null;\r\n\r\n const position = options.position || Vector3.Zero();\r\n let normal = options.normal || Vector3.Up();\r\n const size = options.size || Vector3.One();\r\n const angle = options.angle || 0;\r\n\r\n // Getting correct rotation\r\n if (!normal) {\r\n const target = new Vector3(0, 0, 1);\r\n const camera = <Camera>sourceMesh.getScene().activeCamera;\r\n const cameraWorldTarget = Vector3.TransformCoordinates(target, camera.getWorldMatrix());\r\n\r\n normal = camera.globalPosition.subtract(cameraWorldTarget);\r\n }\r\n\r\n const yaw = -Math.atan2(normal.z, normal.x) - Math.PI / 2;\r\n const len = Math.sqrt(normal.x * normal.x + normal.z * normal.z);\r\n const pitch = Math.atan2(normal.y, len);\r\n\r\n const vertexData = new VertexData();\r\n vertexData.indices = [];\r\n vertexData.positions = [];\r\n vertexData.normals = [];\r\n vertexData.uvs = [];\r\n vertexData.matricesIndices = hasSkeleton ? [] : null;\r\n vertexData.matricesWeights = hasSkeleton ? [] : null;\r\n vertexData.matricesIndicesExtra = matIndicesExtra ? [] : null;\r\n vertexData.matricesWeightsExtra = matWeightsExtra ? [] : null;\r\n\r\n let currentVertexDataIndex = 0;\r\n\r\n const extractDecalVector3 = (indexId: number, transformMatrix: Matrix): DecalVertex => {\r\n const result = new DecalVertex();\r\n if (!indices || !positions || !normals) {\r\n return result;\r\n }\r\n\r\n const vertexId = indices[indexId];\r\n\r\n result.vertexIdx = vertexId * 3;\r\n result.vertexIdxForBones = vertexId * 4;\r\n\r\n // Send vector to decal local world\r\n result.position = new Vector3(positions[vertexId * 3], positions[vertexId * 3 + 1], positions[vertexId * 3 + 2]);\r\n Vector3.TransformCoordinatesToRef(result.position, transformMatrix, result.position);\r\n\r\n // Get normal\r\n result.normal = new Vector3(normals[vertexId * 3], normals[vertexId * 3 + 1], normals[vertexId * 3 + 2]);\r\n Vector3.TransformNormalToRef(result.normal, transformMatrix, result.normal);\r\n\r\n if (options.captureUVS && uvs) {\r\n const v = uvs[vertexId * 2 + 1];\r\n result.uv = new Vector2(uvs[vertexId * 2], useOpenGLOrientationForUV ? 1 - v : v);\r\n }\r\n\r\n return result;\r\n };\r\n\r\n const emptyArray = [0, 0, 0, 0];\r\n\r\n // Inspired by https://github.com/mrdoob/three.js/blob/eee231960882f6f3b6113405f524956145148146/examples/js/geometries/DecalGeometry.js\r\n const clip = (vertices: DecalVertex[], axis: Vector3): Nullable<DecalVertex[]> => {\r\n if (vertices.length === 0) {\r\n return vertices;\r\n }\r\n\r\n const clipSize = 0.5 * Math.abs(Vector3.Dot(size, axis));\r\n\r\n const indexOf = (arr: FloatArray | number[], val: number, start: number, num: number) => {\r\n for (let i = 0; i < num; ++i) {\r\n if (arr[start + i] === val) {\r\n return start + i;\r\n }\r\n }\r\n return -1;\r\n };\r\n\r\n const clipVertices = (v0: DecalVertex, v1: DecalVertex): DecalVertex => {\r\n const clipFactor = Vector3.GetClipFactor(v0.position, v1.position, axis, clipSize);\r\n\r\n let indices = emptyArray;\r\n let weights = emptyArray;\r\n\r\n if (matIndices && matWeights) {\r\n const mat0Index = v0.matrixIndicesOverride ? 0 : v0.vertexIdxForBones;\r\n const v0Indices = v0.matrixIndicesOverride ?? matIndices;\r\n const v0Weights = v0.matrixWeightsOverride ?? matWeights;\r\n\r\n const mat1Index = v1.matrixIndicesOverride ? 0 : v1.vertexIdxForBones;\r\n const v1Indices = v1.matrixIndicesOverride ?? matIndices;\r\n const v1Weights = v1.matrixWeightsOverride ?? matWeights;\r\n\r\n indices = [0, 0, 0, 0];\r\n weights = [0, 0, 0, 0];\r\n\r\n let index = 0;\r\n for (let i = 0; i < 4; ++i) {\r\n if (v0Weights[mat0Index + i] > 0) {\r\n const idx = indexOf(v1Indices, v0Indices[mat0Index + i], mat1Index, 4);\r\n indices[index] = v0Indices[mat0Index + i];\r\n weights[index] = Lerp(v0Weights[mat0Index + i], idx >= 0 ? v1Weights[idx] : 0, clipFactor);\r\n index++;\r\n }\r\n }\r\n\r\n for (let i = 0; i < 4 && index < 4; ++i) {\r\n const ind = v1Indices[mat1Index + i];\r\n if (indexOf(v0Indices, ind, mat0Index, 4) !== -1) {\r\n continue;\r\n }\r\n\r\n indices[index] = ind;\r\n weights[index] = Lerp(0, v1Weights[mat1Index + i], clipFactor);\r\n index++;\r\n }\r\n\r\n const sumw = weights[0] + weights[1] + weights[2] + weights[3];\r\n\r\n weights[0] /= sumw;\r\n weights[1] /= sumw;\r\n weights[2] /= sumw;\r\n weights[3] /= sumw;\r\n }\r\n\r\n const v0LocalPositionX = v0.localPositionOverride ? v0.localPositionOverride[0] : (localPositions?.[v0.vertexIdx] ?? 0);\r\n const v0LocalPositionY = v0.localPositionOverride ? v0.localPositionOverride[1] : (localPositions?.[v0.vertexIdx + 1] ?? 0);\r\n const v0LocalPositionZ = v0.localPositionOverride ? v0.localPositionOverride[2] : (localPositions?.[v0.vertexIdx + 2] ?? 0);\r\n\r\n const v1LocalPositionX = v1.localPositionOverride ? v1.localPositionOverride[0] : (localPositions?.[v1.vertexIdx] ?? 0);\r\n const v1LocalPositionY = v1.localPositionOverride ? v1.localPositionOverride[1] : (localPositions?.[v1.vertexIdx + 1] ?? 0);\r\n const v1LocalPositionZ = v1.localPositionOverride ? v1.localPositionOverride[2] : (localPositions?.[v1.vertexIdx + 2] ?? 0);\r\n\r\n const v0LocalNormalX = v0.localNormalOverride ? v0.localNormalOverride[0] : (localNormals?.[v0.vertexIdx] ?? 0);\r\n const v0LocalNormalY = v0.localNormalOverride ? v0.localNormalOverride[1] : (localNormals?.[v0.vertexIdx + 1] ?? 0);\r\n const v0LocalNormalZ = v0.localNormalOverride ? v0.localNormalOverride[2] : (localNormals?.[v0.vertexIdx + 2] ?? 0);\r\n\r\n const v1LocalNormalX = v1.localNormalOverride ? v1.localNormalOverride[0] : (localNormals?.[v1.vertexIdx] ?? 0);\r\n const v1LocalNormalY = v1.localNormalOverride ? v1.localNormalOverride[1] : (localNormals?.[v1.vertexIdx + 1] ?? 0);\r\n const v1LocalNormalZ = v1.localNormalOverride ? v1.localNormalOverride[2] : (localNormals?.[v1.vertexIdx + 2] ?? 0);\r\n\r\n const interpNormalX = v0LocalNormalX + (v1LocalNormalX - v0LocalNormalX) * clipFactor;\r\n const interpNormalY = v0LocalNormalY + (v1LocalNormalY - v0LocalNormalY) * clipFactor;\r\n const interpNormalZ = v0LocalNormalZ + (v1LocalNormalZ - v0LocalNormalZ) * clipFactor;\r\n\r\n const norm = Math.sqrt(interpNormalX * interpNormalX + interpNormalY * interpNormalY + interpNormalZ * interpNormalZ);\r\n\r\n return new DecalVertex(\r\n Vector3.Lerp(v0.position, v1.position, clipFactor),\r\n Vector3.Lerp(v0.normal, v1.normal, clipFactor).normalize(),\r\n Vector2.Lerp(v0.uv, v1.uv, clipFactor),\r\n -1,\r\n -1,\r\n localPositions\r\n ? [\r\n v0LocalPositionX + (v1LocalPositionX - v0LocalPositionX) * clipFactor,\r\n v0LocalPositionY + (v1LocalPositionY - v0LocalPositionY) * clipFactor,\r\n v0LocalPositionZ + (v1LocalPositionZ - v0LocalPositionZ) * clipFactor,\r\n ]\r\n : null,\r\n localNormals ? [interpNormalX / norm, interpNormalY / norm, interpNormalZ / norm] : null,\r\n indices,\r\n weights\r\n );\r\n };\r\n\r\n let clipResult: Nullable<DecalVertex[]> = null;\r\n\r\n if (vertices.length > 3) {\r\n clipResult = [] as DecalVertex[];\r\n }\r\n\r\n for (let index = 0; index < vertices.length; index += 3) {\r\n let total = 0;\r\n let nV1: Nullable<DecalVertex> = null;\r\n let nV2: Nullable<DecalVertex> = null;\r\n let nV3: Nullable<DecalVertex> = null;\r\n let nV4: Nullable<DecalVertex> = null;\r\n\r\n const d1 = Vector3.Dot(vertices[index].position, axis) - clipSize;\r\n const d2 = Vector3.Dot(vertices[index + 1].position, axis) - clipSize;\r\n const d3 = Vector3.Dot(vertices[index + 2].position, axis) - clipSize;\r\n\r\n const v1Out = d1 > 0;\r\n const v2Out = d2 > 0;\r\n const v3Out = d3 > 0;\r\n\r\n total = (v1Out ? 1 : 0) + (v2Out ? 1 : 0) + (v3Out ? 1 : 0);\r\n\r\n switch (total) {\r\n case 0:\r\n if (vertices.length > 3) {\r\n clipResult!.push(vertices[index]);\r\n clipResult!.push(vertices[index + 1]);\r\n clipResult!.push(vertices[index + 2]);\r\n } else {\r\n clipResult = vertices;\r\n }\r\n break;\r\n case 1:\r\n clipResult = clipResult ?? new Array<DecalVertex>();\r\n if (v1Out) {\r\n nV1 = vertices[index + 1];\r\n nV2 = vertices[index + 2];\r\n nV3 = clipVertices(vertices[index], nV1);\r\n nV4 = clipVertices(vertices[index], nV2);\r\n }\r\n\r\n if (v2Out) {\r\n nV1 = vertices[index];\r\n nV2 = vertices[index + 2];\r\n nV3 = clipVertices(vertices[index + 1], nV1);\r\n nV4 = clipVertices(vertices[index + 1], nV2);\r\n\r\n clipResult.push(nV3);\r\n clipResult.push(nV2.clone());\r\n clipResult.push(nV1.clone());\r\n\r\n clipResult.push(nV2.clone());\r\n clipResult.push(nV3.clone());\r\n clipResult.push(nV4);\r\n break;\r\n }\r\n if (v3Out) {\r\n nV1 = vertices[index];\r\n nV2 = vertices[index + 1];\r\n nV3 = clipVertices(vertices[index + 2], nV1);\r\n nV4 = clipVertices(vertices[index + 2], nV2);\r\n }\r\n\r\n if (nV1 && nV2 && nV3 && nV4) {\r\n clipResult.push(nV1.clone());\r\n clipResult.push(nV2.clone());\r\n clipResult.push(nV3);\r\n\r\n clipResult.push(nV4);\r\n clipResult.push(nV3.clone());\r\n clipResult.push(nV2.clone());\r\n }\r\n break;\r\n case 2:\r\n clipResult = clipResult ?? new Array<DecalVertex>();\r\n if (!v1Out) {\r\n nV1 = vertices[index].clone();\r\n nV2 = clipVertices(nV1, vertices[index + 1]);\r\n nV3 = clipVertices(nV1, vertices[index + 2]);\r\n clipResult.push(nV1);\r\n clipResult.push(nV2);\r\n clipResult.push(nV3);\r\n }\r\n if (!v2Out) {\r\n nV1 = vertices[index + 1].clone();\r\n nV2 = clipVertices(nV1, vertices[index + 2]);\r\n nV3 = clipVertices(nV1, vertices[index]);\r\n clipResult.push(nV1);\r\n clipResult.push(nV2);\r\n clipResult.push(nV3);\r\n }\r\n if (!v3Out) {\r\n nV1 = vertices[index + 2].clone();\r\n nV2 = clipVertices(nV1, vertices[index]);\r\n nV3 = clipVertices(nV1, vertices[index + 1]);\r\n clipResult.push(nV1);\r\n clipResult.push(nV2);\r\n clipResult.push(nV3);\r\n }\r\n break;\r\n case 3:\r\n break;\r\n }\r\n }\r\n\r\n return clipResult;\r\n };\r\n\r\n const sourceMeshAsMesh = sourceMesh instanceof Mesh ? sourceMesh : null;\r\n const matrixData = sourceMeshAsMesh?._thinInstanceDataStorage.matrixData;\r\n\r\n const numMatrices = sourceMeshAsMesh?.thinInstanceCount || 1;\r\n const thinInstanceMatrix = TmpVectors.Matrix[0];\r\n\r\n thinInstanceMatrix.copyFrom(Matrix.IdentityReadOnly);\r\n\r\n for (let m = 0; m < numMatrices; ++m) {\r\n if (sourceMeshAsMesh?.hasThinInstances && matrixData) {\r\n const ofst = m * 16;\r\n\r\n thinInstanceMatrix.setRowFromFloats(0, matrixData[ofst + 0], matrixData[ofst + 1], matrixData[ofst + 2], matrixData[ofst + 3]);\r\n thinInstanceMatrix.setRowFromFloats(1, matrixData[ofst + 4], matrixData[ofst + 5], matrixData[ofst + 6], matrixData[ofst + 7]);\r\n thinInstanceMatrix.setRowFromFloats(2, matrixData[ofst + 8], matrixData[ofst + 9], matrixData[ofst + 10], matrixData[ofst + 11]);\r\n thinInstanceMatrix.setRowFromFloats(3, matrixData[ofst + 12], matrixData[ofst + 13], matrixData[ofst + 14], matrixData[ofst + 15]);\r\n }\r\n\r\n // Matrix\r\n const decalWorldMatrix = Matrix.RotationYawPitchRoll(yaw, pitch, angle).multiply(Matrix.Translation(position.x, position.y, position.z));\r\n const inverseDecalWorldMatrix = Matrix.Invert(decalWorldMatrix);\r\n const meshWorldMatrix = sourceMesh.getWorldMatrix();\r\n const transformMatrix = thinInstanceMatrix.multiply(meshWorldMatrix).multiply(inverseDecalWorldMatrix);\r\n\r\n const oneFaceVertices = new Array<DecalVertex>(3);\r\n\r\n for (let index = 0; index < indices.length; index += 3) {\r\n let faceVertices: Nullable<DecalVertex[]> = oneFaceVertices;\r\n\r\n faceVertices[0] = extractDecalVector3(index, transformMatrix);\r\n faceVertices[1] = extractDecalVector3(index + 1, transformMatrix);\r\n faceVertices[2] = extractDecalVector3(index + 2, transformMatrix);\r\n\r\n if (options.cullBackFaces) {\r\n // If all the normals of the vertices of the face are pointing away from the view direction we discard the face.\r\n // As computations are done in the decal coordinate space, the viewDirection is (0,0,1), so when dot(vertexNormal, -viewDirection) <= 0 the vertex is culled\r\n if (-faceVertices[0].normal.z <= 0 && -faceVertices[1].normal.z <= 0 && -faceVertices[2].normal.z <= 0) {\r\n continue;\r\n }\r\n }\r\n\r\n // Clip\r\n faceVertices = clip(faceVertices, XpAxis);\r\n if (!faceVertices) {\r\n continue;\r\n }\r\n faceVertices = clip(faceVertices, XnAxis);\r\n if (!faceVertices) {\r\n continue;\r\n }\r\n faceVertices = clip(faceVertices, YpAxis);\r\n if (!faceVertices) {\r\n continue;\r\n }\r\n faceVertices = clip(faceVertices, YnAxis);\r\n if (!faceVertices) {\r\n continue;\r\n }\r\n faceVertices = clip(faceVertices, ZpAxis);\r\n if (!faceVertices) {\r\n continue;\r\n }\r\n faceVertices = clip(faceVertices, ZnAxis);\r\n if (!faceVertices) {\r\n continue;\r\n }\r\n\r\n // Add UVs and get back to world\r\n for (let vIndex = 0; vIndex < faceVertices.length; vIndex++) {\r\n const vertex = faceVertices[vIndex];\r\n\r\n //TODO check for Int32Array | Uint32Array | Uint16Array\r\n vertexData.indices.push(currentVertexDataIndex);\r\n if (useLocalComputation) {\r\n if (vertex.localPositionOverride) {\r\n vertexData.positions[currentVertexDataIndex * 3] = vertex.localPositionOverride[0];\r\n vertexData.positions[currentVertexDataIndex * 3 + 1] = vertex.localPositionOverride[1];\r\n vertexData.positions[currentVertexDataIndex * 3 + 2] = vertex.localPositionOverride[2];\r\n } else if (localPositions) {\r\n vertexData.positions[currentVertexDataIndex * 3] = localPositions[vertex.vertexIdx];\r\n vertexData.positions[currentVertexDataIndex * 3 + 1] = localPositions[vertex.vertexIdx + 1];\r\n vertexData.positions[currentVertexDataIndex * 3 + 2] = localPositions[vertex.vertexIdx + 2];\r\n }\r\n if (vertex.localNormalOverride) {\r\n vertexData.normals[currentVertexDataIndex * 3] = vertex.localNormalOverride[0];\r\n vertexData.normals[currentVertexDataIndex * 3 + 1] = vertex.localNormalOverride[1];\r\n vertexData.normals[currentVertexDataIndex * 3 + 2] = vertex.localNormalOverride[2];\r\n } else if (localNormals) {\r\n vertexData.normals[currentVertexDataIndex * 3] = localNormals[vertex.vertexIdx];\r\n vertexData.normals[currentVertexDataIndex * 3 + 1] = localNormals[vertex.vertexIdx + 1];\r\n vertexData.normals[currentVertexDataIndex * 3 + 2] = localNormals[vertex.vertexIdx + 2];\r\n }\r\n } else {\r\n vertex.position.toArray(vertexData.positions, currentVertexDataIndex * 3);\r\n vertex.normal.toArray(vertexData.normals, currentVertexDataIndex * 3);\r\n }\r\n if (vertexData.matricesIndices && vertexData.matricesWeights) {\r\n if (vertex.matrixIndicesOverride) {\r\n vertexData.matricesIndices[currentVertexDataIndex * 4] = vertex.matrixIndicesOverride[0];\r\n vertexData.matricesIndices[currentVertexDataIndex * 4 + 1] = vertex.matrixIndicesOverride[1];\r\n vertexData.matricesIndices[currentVertexDataIndex * 4 + 2] = vertex.matrixIndicesOverride[2];\r\n vertexData.matricesIndices[currentVertexDataIndex * 4 + 3] = vertex.matrixIndicesOverride[3];\r\n } else {\r\n if (matIndices) {\r\n vertexData.matricesIndices[currentVertexDataIndex * 4] = matIndices[vertex.vertexIdxForBones];\r\n vertexData.matricesIndices[currentVertexDataIndex * 4 + 1] = matIndices[vertex.vertexIdxForBones + 1];\r\n vertexData.matricesIndices[currentVertexDataIndex * 4 + 2] = matIndices[vertex.vertexIdxForBones + 2];\r\n vertexData.matricesIndices[currentVertexDataIndex * 4 + 3] = matIndices[vertex.vertexIdxForBones + 3];\r\n }\r\n if (matIndicesExtra && vertexData.matricesIndicesExtra) {\r\n vertexData.matricesIndicesExtra[currentVertexDataIndex * 4] = matIndicesExtra[vertex.vertexIdxForBones];\r\n vertexData.matricesIndicesExtra[currentVertexDataIndex * 4 + 1] = matIndicesExtra[vertex.vertexIdxForBones + 1];\r\n vertexData.matricesIndicesExtra[currentVertexDataIndex * 4 + 2] = matIndicesExtra[vertex.vertexIdxForBones + 2];\r\n vertexData.matricesIndicesExtra[currentVertexDataIndex * 4 + 3] = matIndicesExtra[vertex.vertexIdxForBones + 3];\r\n }\r\n }\r\n if (vertex.matrixWeightsOverride) {\r\n vertexData.matricesWeights[currentVertexDataIndex * 4] = vertex.matrixWeightsOverride[0];\r\n vertexData.matricesWeights[currentVertexDataIndex * 4 + 1] = vertex.matrixWeightsOverride[1];\r\n vertexData.matricesWeights[currentVertexDataIndex * 4 + 2] = vertex.matrixWeightsOverride[2];\r\n vertexData.matricesWeights[currentVertexDataIndex * 4 + 3] = vertex.matrixWeightsOverride[3];\r\n } else {\r\n if (matWeights) {\r\n vertexData.matricesWeights[currentVertexDataIndex * 4] = matWeights[vertex.vertexIdxForBones];\r\n vertexData.matricesWeights[currentVertexDataIndex * 4 + 1] = matWeights[vertex.vertexIdxForBones + 1];\r\n vertexData.matricesWeights[currentVertexDataIndex * 4 + 2] = matWeights[vertex.vertexIdxForBones + 2];\r\n vertexData.matricesWeights[currentVertexDataIndex * 4 + 3] = matWeights[vertex.vertexIdxForBones + 3];\r\n }\r\n if (matWeightsExtra && vertexData.matricesWeightsExtra) {\r\n vertexData.matricesWeightsExtra[currentVertexDataIndex * 4] = matWeightsExtra[vertex.vertexIdxForBones];\r\n vertexData.matricesWeightsExtra[currentVertexDataIndex * 4 + 1] = matWeightsExtra[vertex.vertexIdxForBones + 1];\r\n vertexData.matricesWeightsExtra[currentVertexDataIndex * 4 + 2] = matWeightsExtra[vertex.vertexIdxForBones + 2];\r\n vertexData.matricesWeightsExtra[currentVertexDataIndex * 4 + 3] = matWeightsExtra[vertex.vertexIdxForBones + 3];\r\n }\r\n }\r\n }\r\n\r\n if (!options.captureUVS) {\r\n vertexData.uvs.push(0.5 + vertex.position.x / size.x);\r\n const v = 0.5 + vertex.position.y / size.y;\r\n vertexData.uvs.push(useOpenGLOrientationForUV ? 1 - v : v);\r\n } else {\r\n vertex.uv.toArray(vertexData.uvs, currentVertexDataIndex * 2);\r\n }\r\n currentVertexDataIndex++;\r\n }\r\n }\r\n }\r\n\r\n // Avoid the \"Setting vertex data kind 'XXX' with an empty array\" warning when calling vertexData.applyToMesh\r\n if (vertexData.indices.length === 0) {\r\n vertexData.indices = null;\r\n }\r\n if (vertexData.positions.length === 0) {\r\n vertexData.positions = null;\r\n }\r\n if (vertexData.normals.length === 0) {\r\n vertexData.normals = null;\r\n }\r\n if (vertexData.uvs.length === 0) {\r\n vertexData.uvs = null;\r\n }\r\n if (vertexData.matricesIndices?.length === 0) {\r\n vertexData.matricesIndices = null;\r\n }\r\n if (vertexData.matricesWeights?.length === 0) {\r\n vertexData.matricesWeights = null;\r\n }\r\n if (vertexData.matricesIndicesExtra?.length === 0) {\r\n vertexData.matricesIndicesExtra = null;\r\n }\r\n if (vertexData.matricesWeightsExtra?.length === 0) {\r\n vertexData.matricesWeightsExtra = null;\r\n }\r\n\r\n // Return mesh\r\n const decal = new Mesh(name, sourceMesh.getScene());\r\n vertexData.applyToMesh(decal);\r\n\r\n if (useLocalComputation) {\r\n decal.skeleton = sourceMesh.skeleton;\r\n decal.parent = sourceMesh;\r\n } else {\r\n decal.position = position.clone();\r\n decal.rotation = new Vector3(pitch, yaw, angle);\r\n }\r\n\r\n decal.computeWorldMatrix(true);\r\n decal.refreshBoundingInfo(true, true);\r\n\r\n return decal;\r\n}\r\n\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated use the function directly from the module\r\n */\r\nexport const DecalBuilder = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateDecal,\r\n};\r\n\r\nMesh.CreateDecal = (name: string, sourceMesh: AbstractMesh, position: Vector3, normal: Vector3, size: Vector3, angle: number): Mesh => {\r\n const options = {\r\n position,\r\n normal,\r\n size,\r\n angle,\r\n };\r\n\r\n return CreateDecal(name, sourceMesh, options);\r\n};\r\n"]}
|
|
@@ -63,8 +63,8 @@ float((value ) & 255u),
|
|
|
63
63
|
float((value>>uint( 8)) & 255u),
|
|
64
64
|
float((value>>uint(16)) & 255u),
|
|
65
65
|
float((value>>uint(24)) & 255u));return components*vec4(2./255.)-vec4(1.);}
|
|
66
|
-
vec3 computeSH(Splat splat,vec3
|
|
67
|
-
{vec3 sh[16];sh[0]=
|
|
66
|
+
vec3 computeSH(Splat splat,vec3 dir)
|
|
67
|
+
{vec3 sh[16];sh[0]=vec3(0.,0.,0.);
|
|
68
68
|
#if SH_DEGREE>0
|
|
69
69
|
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);
|
|
70
70
|
#endif
|
|
@@ -76,8 +76,8 @@ vec4 sh06=decompose(splat.sh1.z);vec4 sh07=decompose(splat.sh1.w);vec4 sh08=deco
|
|
|
76
76
|
#endif
|
|
77
77
|
return computeColorFromSHDegree(dir,sh);}
|
|
78
78
|
#else
|
|
79
|
-
vec3 computeSH(Splat splat,vec3
|
|
80
|
-
{return
|
|
79
|
+
vec3 computeSH(Splat splat,vec3 dir)
|
|
80
|
+
{return vec3(0.,0.,0.);}
|
|
81
81
|
#endif
|
|
82
82
|
vec4 gaussianSplatting(vec2 meshPos,vec3 worldPos,vec2 scale,vec3 covA,vec3 covB,mat4 worldMatrix,mat4 viewMatrix,mat4 projectionMatrix)
|
|
83
83
|
{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
|
|
@@ -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;AAExD,MAAM,IAAI,GAAG,mBAAmB,CAAC;AACjC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8DAsG+C,CAAC;AAC/D,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\";\n\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\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};Splat readSplat(float splatIndex)\n{Splat splat;vec2 splatUV=getDataUV(splatIndex,dataTextureSize);splat.center=texture2D(centersTexture,splatUV);splat.color=texture2D(colorsTexture,splatUV);splat.covA=texture2D(covariancesATexture,splatUV)*splat.center.w;splat.covB=texture2D(covariancesBTexture,splatUV)*splat.center.w;\n#if SH_DEGREE>0\nivec2 splatUVint=getDataUVint(splatIndex,dataTextureSize);splat.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\nreturn splat;}\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\nvec3 computeColorFromSHDegree(vec3 dir,const vec3 sh[16])\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;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#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
|
|
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;AAExD,MAAM,IAAI,GAAG,mBAAmB,CAAC;AACjC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8DAsG+C,CAAC;AAC/D,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\";\n\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\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};Splat readSplat(float splatIndex)\n{Splat splat;vec2 splatUV=getDataUV(splatIndex,dataTextureSize);splat.center=texture2D(centersTexture,splatUV);splat.color=texture2D(colorsTexture,splatUV);splat.covA=texture2D(covariancesATexture,splatUV)*splat.center.w;splat.covB=texture2D(covariancesBTexture,splatUV)*splat.center.w;\n#if SH_DEGREE>0\nivec2 splatUVint=getDataUVint(splatIndex,dataTextureSize);splat.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\nreturn splat;}\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\nvec3 computeColorFromSHDegree(vec3 dir,const vec3 sh[16])\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;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#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[16];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\nreturn computeColorFromSHDegree(dir,sh);}\n#else\nvec3 computeSH(Splat splat,vec3 dir)\n{return vec3(0.,0.,0.);}\n#endif\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);mat3 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);mat3 invy=mat3(1,0,0,0,-1,0,0,0,1);mat3 T=invy*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);return vec4(\nvCenter \n+ ((meshPos.x*majorAxis\n+ meshPos.y*minorAxis)*invViewport*pos2d.w)*scale,pos2d.zw);}`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStore[name]) {\n ShaderStore.IncludesShadersStore[name] = shader;\n}\n/** @internal */\nexport const gaussianSplatting = { name, shader };\n"]}
|
|
@@ -19,7 +19,7 @@ const shader = `#include<__decl__gaussianSplattingVertex>
|
|
|
19
19
|
#include<fogVertexDeclaration>
|
|
20
20
|
#include<logDepthDeclaration>
|
|
21
21
|
#include<helperFunctions>
|
|
22
|
-
attribute float splatIndex;uniform vec2 invViewport;uniform vec2 dataTextureSize;uniform vec2 focal;uniform float kernelSize;uniform sampler2D covariancesATexture;uniform sampler2D covariancesBTexture;uniform sampler2D centersTexture;uniform sampler2D colorsTexture;
|
|
22
|
+
attribute float splatIndex;uniform vec2 invViewport;uniform vec2 dataTextureSize;uniform vec2 focal;uniform float kernelSize;uniform vec3 eyePosition;uniform sampler2D covariancesATexture;uniform sampler2D covariancesBTexture;uniform sampler2D centersTexture;uniform sampler2D colorsTexture;
|
|
23
23
|
#if SH_DEGREE>0
|
|
24
24
|
uniform highp usampler2D shTexture0;
|
|
25
25
|
#endif
|
|
@@ -33,8 +33,8 @@ varying vec4 vColor;varying vec2 vPosition;
|
|
|
33
33
|
#include<gaussianSplatting>
|
|
34
34
|
void main () {Splat splat=readSplat(splatIndex);vec3 covA=splat.covA.xyz;vec3 covB=vec3(splat.covA.w,splat.covB.xy);vec4 worldPos=world*vec4(splat.center.xyz,1.0);vColor=splat.color;vPosition=position;
|
|
35
35
|
#if SH_DEGREE>0
|
|
36
|
-
mat3 worldRot=mat3(world);mat3 normWorldRot=inverseMat3(worldRot);vec3 dir=normalize(normWorldRot*(worldPos.xyz-
|
|
37
|
-
vColor.xyz=
|
|
36
|
+
mat3 worldRot=mat3(world);mat3 normWorldRot=inverseMat3(worldRot);vec3 dir=normalize(normWorldRot*(worldPos.xyz-eyePosition));dir*=vec3(1.,1.,-1.);
|
|
37
|
+
vColor.xyz=splat.color.xyz+computeSH(splat,dir);
|
|
38
38
|
#endif
|
|
39
39
|
gl_Position=gaussianSplatting(position,worldPos.xyz,vec2(1.,1.),covA,covB,world,view,projection);
|
|
40
40
|
#include<clipPlaneVertex>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gaussianSplatting.vertex.js","sourceRoot":"","sources":["../../../../dev/core/src/Shaders/gaussianSplatting.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,qDAAqD,CAAC;AAC7D,OAAO,kDAAkD,CAAC;AAC1D,OAAO,6CAA6C,CAAC;AACrD,OAAO,uCAAuC,CAAC;AAC/C,OAAO,sCAAsC,CAAC;AAC9C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,oCAAoC,CAAC;AAC5C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,4BAA4B,CAAC;AACpC,OAAO,iCAAiC,CAAC;AAEzC,MAAM,IAAI,GAAG,+BAA+B,CAAC;AAC7C,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8Bd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;IAClC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAC5C,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,6BAA6B,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\nimport \"./ShadersInclude/gaussianSplattingVertexDeclaration\";\nimport \"./ShadersInclude/gaussianSplattingUboDeclaration\";\nimport \"./ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"./ShadersInclude/fogVertexDeclaration\";\nimport \"./ShadersInclude/logDepthDeclaration\";\nimport \"./ShadersInclude/helperFunctions\";\nimport \"./ShadersInclude/gaussianSplatting\";\nimport \"./ShadersInclude/clipPlaneVertex\";\nimport \"./ShadersInclude/fogVertex\";\nimport \"./ShadersInclude/logDepthVertex\";\n\nconst name = \"gaussianSplattingVertexShader\";\nconst shader = `#include<__decl__gaussianSplattingVertex>\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<logDepthDeclaration>\n#include<helperFunctions>\nattribute float splatIndex;uniform vec2 invViewport;uniform vec2 dataTextureSize;uniform vec2 focal;uniform float kernelSize;uniform sampler2D covariancesATexture;uniform sampler2D covariancesBTexture;uniform sampler2D centersTexture;uniform sampler2D colorsTexture;\n#if SH_DEGREE>0\nuniform highp usampler2D shTexture0;\n#endif\n#if SH_DEGREE>1\nuniform highp usampler2D shTexture1;\n#endif\n#if SH_DEGREE>2\nuniform highp usampler2D shTexture2;\n#endif\nvarying vec4 vColor;varying vec2 vPosition;\n#include<gaussianSplatting>\nvoid main () {Splat splat=readSplat(splatIndex);vec3 covA=splat.covA.xyz;vec3 covB=vec3(splat.covA.w,splat.covB.xy);vec4 worldPos=world*vec4(splat.center.xyz,1.0);vColor=splat.color;vPosition=position;\n#if SH_DEGREE>0\nmat3 worldRot=mat3(world);mat3 normWorldRot=inverseMat3(worldRot);vec3 dir=normalize(normWorldRot*(worldPos.xyz-
|
|
1
|
+
{"version":3,"file":"gaussianSplatting.vertex.js","sourceRoot":"","sources":["../../../../dev/core/src/Shaders/gaussianSplatting.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,qDAAqD,CAAC;AAC7D,OAAO,kDAAkD,CAAC;AAC1D,OAAO,6CAA6C,CAAC;AACrD,OAAO,uCAAuC,CAAC;AAC/C,OAAO,sCAAsC,CAAC;AAC9C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,oCAAoC,CAAC;AAC5C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,4BAA4B,CAAC;AACpC,OAAO,iCAAiC,CAAC;AAEzC,MAAM,IAAI,GAAG,+BAA+B,CAAC;AAC7C,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8Bd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;IAClC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAC5C,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,6BAA6B,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\nimport \"./ShadersInclude/gaussianSplattingVertexDeclaration\";\nimport \"./ShadersInclude/gaussianSplattingUboDeclaration\";\nimport \"./ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"./ShadersInclude/fogVertexDeclaration\";\nimport \"./ShadersInclude/logDepthDeclaration\";\nimport \"./ShadersInclude/helperFunctions\";\nimport \"./ShadersInclude/gaussianSplatting\";\nimport \"./ShadersInclude/clipPlaneVertex\";\nimport \"./ShadersInclude/fogVertex\";\nimport \"./ShadersInclude/logDepthVertex\";\n\nconst name = \"gaussianSplattingVertexShader\";\nconst shader = `#include<__decl__gaussianSplattingVertex>\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<logDepthDeclaration>\n#include<helperFunctions>\nattribute float splatIndex;uniform vec2 invViewport;uniform vec2 dataTextureSize;uniform vec2 focal;uniform float kernelSize;uniform vec3 eyePosition;uniform sampler2D covariancesATexture;uniform sampler2D covariancesBTexture;uniform sampler2D centersTexture;uniform sampler2D colorsTexture;\n#if SH_DEGREE>0\nuniform highp usampler2D shTexture0;\n#endif\n#if SH_DEGREE>1\nuniform highp usampler2D shTexture1;\n#endif\n#if SH_DEGREE>2\nuniform highp usampler2D shTexture2;\n#endif\nvarying vec4 vColor;varying vec2 vPosition;\n#include<gaussianSplatting>\nvoid main () {Splat splat=readSplat(splatIndex);vec3 covA=splat.covA.xyz;vec3 covB=vec3(splat.covA.w,splat.covB.xy);vec4 worldPos=world*vec4(splat.center.xyz,1.0);vColor=splat.color;vPosition=position;\n#if SH_DEGREE>0\nmat3 worldRot=mat3(world);mat3 normWorldRot=inverseMat3(worldRot);vec3 dir=normalize(normWorldRot*(worldPos.xyz-eyePosition));dir*=vec3(1.,1.,-1.); \nvColor.xyz=splat.color.xyz+computeSH(splat,dir);\n#endif\ngl_Position=gaussianSplatting(position,worldPos.xyz,vec2(1.,1.),covA,covB,world,view,projection);\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<logDepthVertex>\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStore[name]) {\n ShaderStore.ShadersStore[name] = shader;\n}\n/** @internal */\nexport const gaussianSplattingVertexShader = { name, shader };\n"]}
|
|
@@ -70,8 +70,8 @@ f32((value ) & 255u),
|
|
|
70
70
|
f32((value>>u32( 8)) & 255u),
|
|
71
71
|
f32((value>>u32(16)) & 255u),
|
|
72
72
|
f32((value>>u32(24)) & 255u));return components*vec4f(2./255.)-vec4f(1.);}
|
|
73
|
-
fn computeSH(splat: Splat,
|
|
74
|
-
{var sh: array<vec3<f32>,16>;sh[0]=
|
|
73
|
+
fn computeSH(splat: Splat,dir: vec3f)->vec3f
|
|
74
|
+
{var sh: array<vec3<f32>,16>;sh[0]=vec3f(0.,0.,0.);
|
|
75
75
|
#if SH_DEGREE>0
|
|
76
76
|
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);
|
|
77
77
|
#endif
|
|
@@ -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;AAExD,MAAM,IAAI,GAAG,mBAAmB,CAAC;AACjC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2Hd,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\";\n\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};fn 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);splat.covA=textureLoad(covariancesATexture,splatUVi32,0)*splat.center.w;splat.covB=textureLoad(covariancesBTexture,splatUVi32,0)*splat.center.w;\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\nreturn splat;}\nfn computeColorFromSHDegree(dir: vec3f,sh: array<vec3<f32>,16>)->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 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#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,
|
|
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;AAExD,MAAM,IAAI,GAAG,mBAAmB,CAAC;AACjC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2Hd,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\";\n\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};fn 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);splat.covA=textureLoad(covariancesATexture,splatUVi32,0)*splat.center.w;splat.covB=textureLoad(covariancesBTexture,splatUVi32,0)*splat.center.w;\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\nreturn splat;}\nfn computeColorFromSHDegree(dir: vec3f,sh: array<vec3<f32>,16>)->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 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#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>,16>;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\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 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);let invy=mat3x3<f32>(\n1.0,0.0,0.0,\n0.0,-1.0,0.0,\n0.0,0.0,1.0\n);let T=invy*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);return vec4f(\nvCenter+((meshPos.x*majorAxis+meshPos.y*minorAxis)*invViewport*pos2d.w)*scale,\npos2d.z,\npos2d.w\n);}\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStoreWGSL[name]) {\n ShaderStore.IncludesShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const gaussianSplattingWGSL = { name, shader };\n"]}
|
|
@@ -17,7 +17,7 @@ const shader = `#include<sceneUboDeclaration>
|
|
|
17
17
|
#include<clipPlaneVertexDeclaration>
|
|
18
18
|
#include<fogVertexDeclaration>
|
|
19
19
|
#include<logDepthDeclaration>
|
|
20
|
-
attribute splatIndex: f32;attribute position: vec2f;uniform invViewport: vec2f;uniform dataTextureSize: vec2f;uniform focal: vec2f;uniform kernelSize: f32;var covariancesATexture: texture_2d<f32>;var covariancesBTexture: texture_2d<f32>;var centersTexture: texture_2d<f32>;var colorsTexture: texture_2d<f32>;
|
|
20
|
+
attribute splatIndex: f32;attribute position: vec2f;uniform invViewport: vec2f;uniform dataTextureSize: vec2f;uniform focal: vec2f;uniform kernelSize: f32;uniform eyePosition: vec3f;var covariancesATexture: texture_2d<f32>;var covariancesBTexture: texture_2d<f32>;var centersTexture: texture_2d<f32>;var colorsTexture: texture_2d<f32>;
|
|
21
21
|
#if SH_DEGREE>0
|
|
22
22
|
var shTexture0: texture_2d<u32>;
|
|
23
23
|
#endif
|
|
@@ -32,8 +32,8 @@ varying vColor: vec4f;varying vPosition: vec2f;
|
|
|
32
32
|
@vertex
|
|
33
33
|
fn main(input : VertexInputs)->FragmentInputs {var splat: Splat=readSplat(input.splatIndex,uniforms.dataTextureSize);var covA: vec3f=splat.covA.xyz;var covB: vec3f=vec3f(splat.covA.w,splat.covB.xy);let worldPos: vec4f=mesh.world*vec4f(splat.center.xyz,1.0);vertexOutputs.vPosition=input.position;
|
|
34
34
|
#if SH_DEGREE>0
|
|
35
|
-
let worldRot: mat3x3f= mat3x3f(mesh.world[0].xyz,mesh.world[1].xyz,mesh.world[2].xyz);let normWorldRot: mat3x3f=inverseMat3(worldRot);var dir: vec3f=normalize(normWorldRot*(worldPos.xyz-
|
|
36
|
-
vertexOutputs.vColor=vec4f(
|
|
35
|
+
let worldRot: mat3x3f= mat3x3f(mesh.world[0].xyz,mesh.world[1].xyz,mesh.world[2].xyz);let normWorldRot: mat3x3f=inverseMat3(worldRot);var dir: vec3f=normalize(normWorldRot*(worldPos.xyz-uniforms.eyePosition.xyz));dir*=vec3f(1.,1.,-1.);
|
|
36
|
+
vertexOutputs.vColor=vec4f(splat.color.xyz+computeSH(splat,dir),splat.color.w);
|
|
37
37
|
#else
|
|
38
38
|
vertexOutputs.vColor=splat.color;
|
|
39
39
|
#endif
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gaussianSplatting.vertex.js","sourceRoot":"","sources":["../../../../dev/core/src/ShadersWGSL/gaussianSplatting.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,sCAAsC,CAAC;AAC9C,OAAO,qCAAqC,CAAC;AAC7C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,6CAA6C,CAAC;AACrD,OAAO,uCAAuC,CAAC;AAC/C,OAAO,sCAAsC,CAAC;AAC9C,OAAO,oCAAoC,CAAC;AAC5C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,4BAA4B,CAAC;AACpC,OAAO,iCAAiC,CAAC;AAEzC,MAAM,IAAI,GAAG,+BAA+B,CAAC;AAC7C,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+Bd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;IACtC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,iCAAiC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\nimport \"./ShadersInclude/sceneUboDeclaration\";\nimport \"./ShadersInclude/meshUboDeclaration\";\nimport \"./ShadersInclude/helperFunctions\";\nimport \"./ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"./ShadersInclude/fogVertexDeclaration\";\nimport \"./ShadersInclude/logDepthDeclaration\";\nimport \"./ShadersInclude/gaussianSplatting\";\nimport \"./ShadersInclude/clipPlaneVertex\";\nimport \"./ShadersInclude/fogVertex\";\nimport \"./ShadersInclude/logDepthVertex\";\n\nconst name = \"gaussianSplattingVertexShader\";\nconst shader = `#include<sceneUboDeclaration>\n#include<meshUboDeclaration>\n#include<helperFunctions>\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<logDepthDeclaration>\nattribute splatIndex: f32;attribute position: vec2f;uniform invViewport: vec2f;uniform dataTextureSize: vec2f;uniform focal: vec2f;uniform kernelSize: f32;var covariancesATexture: texture_2d<f32>;var covariancesBTexture: texture_2d<f32>;var centersTexture: texture_2d<f32>;var colorsTexture: texture_2d<f32>;\n#if SH_DEGREE>0\nvar shTexture0: texture_2d<u32>;\n#endif\n#if SH_DEGREE>1\nvar shTexture1: texture_2d<u32>;\n#endif\n#if SH_DEGREE>2\nvar shTexture2: texture_2d<u32>;\n#endif\nvarying vColor: vec4f;varying vPosition: vec2f;\n#include<gaussianSplatting>\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {var splat: Splat=readSplat(input.splatIndex,uniforms.dataTextureSize);var covA: vec3f=splat.covA.xyz;var covB: vec3f=vec3f(splat.covA.w,splat.covB.xy);let worldPos: vec4f=mesh.world*vec4f(splat.center.xyz,1.0);vertexOutputs.vPosition=input.position;\n#if SH_DEGREE>0\nlet worldRot: mat3x3f= mat3x3f(mesh.world[0].xyz,mesh.world[1].xyz,mesh.world[2].xyz);let normWorldRot: mat3x3f=inverseMat3(worldRot);var dir: vec3f=normalize(normWorldRot*(worldPos.xyz-
|
|
1
|
+
{"version":3,"file":"gaussianSplatting.vertex.js","sourceRoot":"","sources":["../../../../dev/core/src/ShadersWGSL/gaussianSplatting.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,sCAAsC,CAAC;AAC9C,OAAO,qCAAqC,CAAC;AAC7C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,6CAA6C,CAAC;AACrD,OAAO,uCAAuC,CAAC;AAC/C,OAAO,sCAAsC,CAAC;AAC9C,OAAO,oCAAoC,CAAC;AAC5C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,4BAA4B,CAAC;AACpC,OAAO,iCAAiC,CAAC;AAEzC,MAAM,IAAI,GAAG,+BAA+B,CAAC;AAC7C,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+Bd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;IACtC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,iCAAiC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\nimport \"./ShadersInclude/sceneUboDeclaration\";\nimport \"./ShadersInclude/meshUboDeclaration\";\nimport \"./ShadersInclude/helperFunctions\";\nimport \"./ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"./ShadersInclude/fogVertexDeclaration\";\nimport \"./ShadersInclude/logDepthDeclaration\";\nimport \"./ShadersInclude/gaussianSplatting\";\nimport \"./ShadersInclude/clipPlaneVertex\";\nimport \"./ShadersInclude/fogVertex\";\nimport \"./ShadersInclude/logDepthVertex\";\n\nconst name = \"gaussianSplattingVertexShader\";\nconst shader = `#include<sceneUboDeclaration>\n#include<meshUboDeclaration>\n#include<helperFunctions>\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<logDepthDeclaration>\nattribute splatIndex: f32;attribute position: vec2f;uniform invViewport: vec2f;uniform dataTextureSize: vec2f;uniform focal: vec2f;uniform kernelSize: f32;uniform eyePosition: vec3f;var covariancesATexture: texture_2d<f32>;var covariancesBTexture: texture_2d<f32>;var centersTexture: texture_2d<f32>;var colorsTexture: texture_2d<f32>;\n#if SH_DEGREE>0\nvar shTexture0: texture_2d<u32>;\n#endif\n#if SH_DEGREE>1\nvar shTexture1: texture_2d<u32>;\n#endif\n#if SH_DEGREE>2\nvar shTexture2: texture_2d<u32>;\n#endif\nvarying vColor: vec4f;varying vPosition: vec2f;\n#include<gaussianSplatting>\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {var splat: Splat=readSplat(input.splatIndex,uniforms.dataTextureSize);var covA: vec3f=splat.covA.xyz;var covB: vec3f=vec3f(splat.covA.w,splat.covB.xy);let worldPos: vec4f=mesh.world*vec4f(splat.center.xyz,1.0);vertexOutputs.vPosition=input.position;\n#if SH_DEGREE>0\nlet worldRot: mat3x3f= mat3x3f(mesh.world[0].xyz,mesh.world[1].xyz,mesh.world[2].xyz);let normWorldRot: mat3x3f=inverseMat3(worldRot);var dir: vec3f=normalize(normWorldRot*(worldPos.xyz-uniforms.eyePosition.xyz));dir*=vec3f(1.,1.,-1.); \nvertexOutputs.vColor=vec4f(splat.color.xyz+computeSH(splat,dir),splat.color.w);\n#else\nvertexOutputs.vColor=splat.color;\n#endif\nvertexOutputs.position=gaussianSplatting(input.position,worldPos.xyz,vec2f(1.0,1.0),covA,covB,mesh.world,scene.view,scene.projection,uniforms.focal,uniforms.invViewport,uniforms.kernelSize);\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<logDepthVertex>\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const gaussianSplattingVertexShaderWGSL = { name, shader };\n"]}
|