@babylonjs/core
Version:
Getting started? Play directly with the Babylon.js API using our [playground](https://playground.babylonjs.com/). It also contains a lot of samples to learn how to use it.
114 lines • 5.04 kB
JavaScript
// Do not edit.
import { ShaderStore } from "../Engines/shaderStore.js";
import { gaussianSplattingVertexDeclaration } from "./ShadersInclude/gaussianSplattingVertexDeclaration.js";
import { sceneUboDeclaration } from "./ShadersInclude/sceneUboDeclaration.js";
import { meshUboDeclaration } from "./ShadersInclude/meshUboDeclaration.js";
import { gaussianSplattingUboDeclaration } from "./ShadersInclude/gaussianSplattingUboDeclaration.js";
import { clipPlaneVertexDeclaration } from "./ShadersInclude/clipPlaneVertexDeclaration.js";
import { fogVertexDeclaration } from "./ShadersInclude/fogVertexDeclaration.js";
import { logDepthDeclaration } from "./ShadersInclude/logDepthDeclaration.js";
import { helperFunctions } from "./ShadersInclude/helperFunctions.js";
import { gaussianSplatting } from "./ShadersInclude/gaussianSplatting.js";
import { clipPlaneVertex } from "./ShadersInclude/clipPlaneVertex.js";
import { fogVertex } from "./ShadersInclude/fogVertex.js";
import { logDepthVertex } from "./ShadersInclude/logDepthVertex.js";
const name = "gaussianSplattingVertexShader";
const shader = `
uniform vec2 invViewport;uniform vec2 dataTextureSize;uniform vec2 focal;uniform float kernelSize;uniform vec3 eyePosition;uniform float alpha;
uniform mat4 partWorld[MAX_PART_COUNT];uniform float partVisibility[MAX_PART_COUNT];
uniform sampler2D covariancesATexture;uniform sampler2D covariancesBTexture;uniform sampler2D centersTexture;uniform sampler2D colorsTexture;
uniform sampler2D sogQuatsTexture;uniform vec3 sogMeansMin;uniform vec3 sogMeansMax;
uniform sampler2D sogCodebookTexture;
uniform vec3 sogScalesMin;uniform vec3 sogScalesMax;uniform vec4 sogSh0Min;uniform vec4 sogSh0Max;uniform float sogShnMin;uniform float sogShnMax;
uniform sampler2D sogShNCentroidsTexture;uniform sampler2D sogShNLabelsTexture;uniform float sogShCoeffCount;
uniform highp usampler2D shTexture0;
uniform highp usampler2D shTexture1;
uniform highp usampler2D shTexture2;
uniform highp usampler2D shTexture3;uniform highp usampler2D shTexture4;
uniform sampler2D partIndicesTexture;
varying vec4 vColor;varying vec2 vPosition;
void main () {
float 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);
mat4 splatWorld=getPartWorld(splat.partIndex);
mat4 splatWorld=world;
vec4 worldPos=splatWorld*vec4(splat.center.xyz,1.0);vColor=splat.color;vPosition=position.xy;
mat3 worldRot=mat3(splatWorld);mat3 normWorldRot=inverseMat3(worldRot);vec3 eyeToSplatLocalSpace=normalize(normWorldRot*(worldPos.xyz-eyePosition));
{vec4 _row3=texelFetch(dbgPartData,ivec2(int(splat.partIndex),3),0);
float _so4=texelFetch(dbgPartData,ivec2(int(splat.partIndex),4),0).x;
float _so4=1.0;
vColor.xyz=_row3.x*splat.color.xyz+computeSHWeighted(splat,eyeToSplatLocalSpace,_row3.y,_row3.z,_row3.w,_so4);}
vColor.xyz=computeSH(splat,eyeToSplatLocalSpace);
vColor.xyz=splat.color.xyz+computeSH(splat,eyeToSplatLocalSpace);
{float _shDc=texelFetch(dbgPartData,ivec2(int(splat.partIndex),3),0).x;vColor.xyz=_shDc*splat.color.xyz;}
vColor.xyz=vec3(0.0);
vColor.w*=alpha;
vColor.w*=partVisibility[splat.partIndex];
vec2 scale=vec2(1.,1.);
gl_Position=gaussianSplatting(position.xy,worldPos.xyz,scale,covA,covB,splatWorld,view,projection);
}
`;
// Sideeffect
if (!ShaderStore.ShadersStore[name]) {
ShaderStore.ShadersStore[name] = shader;
}
const includes = [gaussianSplattingVertexDeclaration, sceneUboDeclaration, meshUboDeclaration, gaussianSplattingUboDeclaration, clipPlaneVertexDeclaration, fogVertexDeclaration, logDepthDeclaration, helperFunctions, gaussianSplatting, clipPlaneVertex, fogVertex, logDepthVertex];
for (const inc of includes) {
if (!ShaderStore.IncludesShadersStore[inc.name]) {
ShaderStore.IncludesShadersStore[inc.name] = inc.shader;
}
}
/** @internal */
export const gaussianSplattingVertexShader = { name, shader };
//# sourceMappingURL=gaussianSplatting.vertex.js.map