# Error compiling Gaussian Splat node material

**URL:** <https://forum.babylonjs.com/t/error-compiling-gaussian-splat-node-material/55651>\
**Category:** Bugs\
**Created:** [December 31, 2024, 12:11am UTC](https://forum.babylonjs.com/t/error-compiling-gaussian-splat-node-material/55651 "2024-12-31T00:11:50Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![SonnyC56](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sonnyc56/32/34522_2.png) [@SonnyC56](https://forum.babylonjs.com/u/SonnyC56)\
**Post date:** [December 31, 2024, 12:11am UTC](https://forum.babylonjs.com/t/error-compiling-gaussian-splat-node-material/55651/1 "2024-12-31T00:11:50Z")

</div>

I have been struggling to get a bug squashed surrounding node materials and a gaussian splat.

I am attempting to apply this transition when splats load in my platform - [https://playground.babylonjs.com/#CID4NN#264](https://playground.babylonjs.com/#CID4NN#264)

Here is the node material - [Babylon.js Node Material Editor](https://nme.babylonjs.com/#WD1G7I)

When I apply this in my app, I get errors.

Here is the code in my app-

```auto
    if (fileExtension === ".splat" || fileExtension === ".ply" || fileExtension === '.spz') {
      const nodeMaterial = await NodeMaterial.ParseFromFileAsync('nodeMat', 'https://firebasestorage.googleapis.com/v0/b/story-splat.firebasestorage.app/o/public%2Fmaterials%2FsplatFadeNodeMaterial.json?alt=media&token=00ea0eea-ea77-40bf-9f98-ed9bc54c25f9', scene)
      newMeshes.forEach((mesh) => {
            mesh.material = nodeMaterial;
        });
    }

```

Error below -

> logger.ts:107 BJS - [19:02:39]: Build of NodeMaterial failed:  
> input vector from block VertexOutput[VertexOutputBlock] is not connected and is not optional.  
> input left from block Add[AddBlock] is not connected and is not optional.  
> input left from block Add[AddBlock] is not connected and is not optional.

Following Errors

> **Summary**
>
> BJS - [19:02:40]: Unable to compile effect:
> 
> logger.ts:107 BJS - [19:02:40]: Uniforms: u\_Float, u\_Time, u\_Float1, u\_Float2, u\_Float3
> 
> logger.ts:107 BJS - [19:02:40]: Vertex code:
> 
> logger.ts:107 BJS - [19:02:40]: #version 300 es  
> #define WEBGL2  
> #define PREPASS\_NORMAL\_INDEX -1  
> #define PREPASS\_WORLD\_NORMAL\_INDEX -1  
> #define PREPASS\_POSITION\_INDEX -1  
> #define PREPASS\_LOCAL\_POSITION\_INDEX -1  
> #define PREPASS\_DEPTH\_INDEX -1  
> #define PREPASS\_SCREENSPACE\_DEPTH\_INDEX -1  
> #define SCENE\_MRT\_COUNT 0  
> #define NUM\_BONE\_INFLUENCERS 0  
> #define BonesPerMesh 0  
> #define NUM\_MORPH\_INFLUENCERS 0  
> #define TONEMAPPING 0  
> #define BUMPDIRECTUV 0  
> #define CAMERA\_PERSPECTIVE
> 
> #define SHADER\_NAME fragment:nodeMaterial1  
> precision highp sampler2DArray;  
> precision highp float;  
> uniform float u\_Float;  
> uniform float u\_Time;  
> uniform float u\_Float1;  
> uniform float u\_Float2;  
> uniform float u\_Float3;  
> const float PI=3.1415926535897932384626433832795;  
> const float RECIPROCAL\_PI=0.3183098861837907;  
> const float RECIPROCAL\_PI2=0.15915494309189535;  
> const float HALF\_MIN=5.96046448e-08;  
> const float LinearEncodePowerApprox=2.2;  
> const float GammaEncodePowerApprox=1.0/LinearEncodePowerApprox;  
> const vec3 LuminanceEncodeApprox=vec3(0.2126,0.7152,0.0722);  
> const float Epsilon=0.0000001;  
> #define saturate(x) clamp(x,0.0,1.0)  
> #define absEps(x) abs(x)+Epsilon  
> #define maxEps(x) max(x,Epsilon)  
> #define saturateEps(x) clamp(x,Epsilon,1.0)  
> mat3 transposeMat3(mat3 inMatrix) {vec3 i0=inMatrix[0];  
> vec3 i1=inMatrix[1];  
> vec3 i2=inMatrix[2];  
> mat3 outMatrix=mat3(  
> vec3(i0.x,i1.x,i2.x),  
> vec3(i0.y,i1.y,i2.y),  
> vec3(i0.z,i1.z,i2.z)  
> );  
> return outMatrix;  
> }  
> mat3 inverseMat3(mat3 inMatrix) {float a00=inMatrix[0][0],a01=inMatrix[0][1],a02=inMatrix[0][2];  
> float a10=inMatrix[1][0],a11=inMatrix[1][1],a12=inMatrix[1][2];  
> float a20=inMatrix[2][0],a21=inMatrix[2][1],a22=inMatrix[2][2];  
> float b01=a22_a11-a12_a21;  
> float b11=-a22_a10+a12_a20;  
> float b21=a21_a10-a11_a20;  
> float det=a00_b01+a01_b11+a02_b21;  
> return mat3(b01,(-a22_a01+a02_a21),(a12_a01-a02_a11),  
> b11,(a22_a00-a02_a20),(-a12_a00+a02_a10),  
> b21,(-a21_a00+a01_a20),(a11_a00-a01_a10))/det;  
> }  
> float toLinearSpace(float color)  
> {  
> return pow(color,LinearEncodePowerApprox);  
> }  
> vec3 toLinearSpace(vec3 color)  
> {  
> return pow(color,vec3(LinearEncodePowerApprox));  
> }  
> vec4 toLinearSpace(vec4 color)  
> {  
> return vec4(pow(color.rgb,vec3(LinearEncodePowerApprox)),color.a);  
> }  
> float toGammaSpace(float color)  
> {  
> return pow(color,GammaEncodePowerApprox);  
> }  
> vec3 toGammaSpace(vec3 color)  
> {  
> return pow(color,vec3(GammaEncodePowerApprox));  
> }  
> vec4 toGammaSpace(vec4 color)  
> {  
> return vec4(pow(color.rgb,vec3(GammaEncodePowerApprox)),color.a);  
> }  
> float square(float value)  
> {return value_value;  
> }  
> vec3 square(vec3 value)  
> {return value_value;  
> }  
> float pow5(float value) {float sq=value_value;  
> return sq_sq_value;  
> }  
> float getLuminance(vec3 color)  
> {return clamp(dot(color,LuminanceEncodeApprox),0.,1.);  
> }  
> float getRand(vec2 seed) {return fract(sin(dot(seed.xy ,vec2(12.9898,78.233)))_43758.5453);  
> }  
> float dither(vec2 seed,float varianceAmount) {float rand=getRand(seed);  
> float normVariance=varianceAmount/255.0;  
> float dither=mix(-normVariance,normVariance,rand);  
> return dither;  
> }  
> const float rgbdMaxRange=255.0;  
> vec4 toRGBD(vec3 color) {float maxRGB=maxEps(max(color.r,max(color.g,color.b)));  
> float D =max(rgbdMaxRange/maxRGB,1.);  
> D =clamp(floor(D)/255.0,0.,1.);  
> vec3 rgb=color.rgb_D;  
> rgb=toGammaSpace(rgb);  
> return vec4(clamp(rgb,0.,1.),D);  
> }  
> vec3 fromRGBD(vec4 rgbd) {rgbd.rgb=toLinearSpace(rgbd.rgb);  
> return rgbd.rgb/rgbd.a;  
> }  
> vec3 parallaxCorrectNormal( vec3 vertexPos,vec3 origVec,vec3 cubeSize,vec3 cubePos ) {vec3 invOrigVec=vec3(1.0,1.0,1.0)/origVec;  
> vec3 halfSize=cubeSize\*0.5;  
> vec3 intersecAtMaxPlane=(cubePos+halfSize-vertexPos)\*invOrigVec;  
> vec3 intersecAtMinPlane=(cubePos-halfSize-vertexPos)_invOrigVec;  
> vec3 largestIntersec=max(intersecAtMaxPlane,intersecAtMinPlane);  
> float distance=min(min(largestIntersec.x,largestIntersec.y),largestIntersec.z);  
> vec3 intersectPositionWS=vertexPos+origVec_distance;  
> return intersectPositionWS-cubePos;  
> }  
> layout(location = 0) out vec4 glFragColor;  
> void main(void) {  
> float output6 = sin(u\_Time);  
> float output5 = output6 \* u\_Float1;  
> float output4 = + output5;  
> float output3 = clamp(output4, (0.0), (1.0));  
> float output2 = smoothstep(float(u\_Float2), float(u\_Float3), output3);  
> float output1 = u\_Float - output2;  
> float output0 = + output1;  
> glFragColor = vec4(output0, output0, output0, 1.0);  
> }
> 
> logger.ts:107 BJS - [19:02:40]: Offending line [26] in vertex code: gl\_Position = ;
> 
> logger.ts:107 BJS - [19:02:40]: Error: VERTEX SHADER ERROR: 0:26: ‘;’ : syntax error

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [December 31, 2024, 12:25am UTC](https://forum.babylonjs.com/t/error-compiling-gaussian-splat-node-material/55651/2 "2024-12-31T00:25:40Z")

</div>

It is really hard to tell without a repro in the playground, but it feels like some nodes are missing in your case ? Are you using the latest version ?

---

<div class="post-metadata">

**Author:** ![SonnyC56](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sonnyc56/32/34522_2.png) [@SonnyC56](https://forum.babylonjs.com/u/SonnyC56)\
**Post date:** [December 31, 2024, 1:01am UTC](https://forum.babylonjs.com/t/error-compiling-gaussian-splat-node-material/55651/3 "2024-12-31T01:01:45Z")

</div>

yeah I am using version 7.42.0, and loading the exact same JSON file in both cases. I have tried deleting node\_modules and reinstalling them.

This is a react app if that matters at all

Here is more of my code for some context, it is doing nothing fancy at all here

```
let result: ISceneLoaderAsyncResult;
let isLocal = false;

// Configure loading options with progress tracking
const loadingOptions = {
  onProgress: (event: ISceneLoaderProgressEvent) => {
    if (onProgress && event.lengthComputable) {
      const progressPercent = (event.loaded / event.total) * 100;
      console.log("Loading progress:", progressPercent.toFixed(2) + "%");
      onProgress(progressPercent);
    }
  }
};

if (typeof fileOrUrl === "string") {
  console.log("Loading model from URL:", fileOrUrl);
  // Load from URL with progress tracking
  result = await SceneLoader.ImportMeshAsync("", fileOrUrl, "", scene, loadingOptions.onProgress);
  isLocal = false;
} else {
  console.log("Loading model from file:", fileOrUrl.name);
  result = await SceneLoader.ImportMeshAsync("", "", fileOrUrl, scene, loadingOptions.onProgress);
  isLocal = true;
}

const newMeshes = result.meshes;
newMeshes.forEach((mesh) => {
  if (mesh instanceof Mesh) {
    mesh.position = Vector3.Zero();
  }
});

//if mesh type === splat apply node material to the mesh
if (fileExtension === ".splat" || fileExtension === ".ply" || fileExtension === ".spz") {
  const nodeMaterial = await NodeMaterial.ParseFromFileAsync('nodeMat', 'https://firebasestorage.googleapis.com/v0/b/story-splat.firebasestorage.app/o/public%2Fmaterials%2FsplatFadeNodeMaterial.json?alt=media&token=00ea0eea-ea77-40bf-9f98-ed9bc54c25f9', scene)
  newMeshes.forEach((mesh) => {
        mesh.material = nodeMaterial;
    });
}

```

Appreciate any ideas you have that I can explore as a solution

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [December 31, 2024, 6:26pm UTC](https://forum.babylonjs.com/t/error-compiling-gaussian-splat-node-material/55651/4 "2024-12-31T18:26:57Z")

</div>

A repro even on Github would be necessary in your case unfortunately

---

<div class="post-metadata">

**Author:** ![SonnyC56](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sonnyc56/32/34522_2.png) [@SonnyC56](https://forum.babylonjs.com/u/SonnyC56)\
**Post date:** [December 31, 2024, 7:00pm UTC](https://forum.babylonjs.com/t/error-compiling-gaussian-splat-node-material/55651/5 "2024-12-31T19:00:55Z")

</div>

I can do that and link it here shortly

---

<div class="post-metadata">

**Author:** ![SonnyC56](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sonnyc56/32/34522_2.png) [@SonnyC56](https://forum.babylonjs.com/u/SonnyC56)\
**Post date:** [January 1, 2025, 4:27pm UTC](https://forum.babylonjs.com/t/error-compiling-gaussian-splat-node-material/55651/6 "2025-01-01T16:27:25Z")

</div>

FYI I am struggling to reproduce it, it works in an isolated repo. It must be something with my current set up for StorySplat that is causing problems. I will fix this and report back here for others with the same issue in the future

---

<div class="post-metadata">

**Author:** ![SonnyC56](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sonnyc56/32/34522_2.png) [@SonnyC56](https://forum.babylonjs.com/u/SonnyC56)\
**Post date:** [January 2, 2025, 4:05am UTC](https://forum.babylonjs.com/t/error-compiling-gaussian-splat-node-material/55651/7 "2025-01-02T04:05:45Z")

</div>

@sebavan I was able to get it to work running npm start directly, so the issue lies within my docker container for some reason. I will report back here with a final solution.

---

<div class="post-metadata">

**Author:** ![SonnyC56](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sonnyc56/32/34522_2.png) [@SonnyC56](https://forum.babylonjs.com/u/SonnyC56)\
**Post date:** [January 2, 2025, 4:23am UTC](https://forum.babylonjs.com/t/error-compiling-gaussian-splat-node-material/55651/8 "2025-01-02T04:23:16Z")

</div>

Well, I deleted my docker container completely and restarted it, and it worked. I think at one point I installed a version of Babylon by mistake that was conflicting with the @babylonjs/core installation. I fixed it but docker held onto it.

---

<div class="post-metadata">

**Author:** ![Nuno\_Sousa](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/nuno_sousa/32/44585_2.png) [@Nuno\_Sousa](https://forum.babylonjs.com/u/Nuno_Sousa)\
**Post date:** [January 9, 2025, 7:02pm UTC](https://forum.babylonjs.com/t/error-compiling-gaussian-splat-node-material/55651/9 "2025-01-09T19:02:23Z")

</div>

can you share the final result, i think im trying to do something similar, this might be the answer

---

<div class="post-metadata">

**Author:** ![SonnyC56](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sonnyc56/32/34522_2.png) [@SonnyC56](https://forum.babylonjs.com/u/SonnyC56)\
**Post date:** [January 9, 2025, 7:56pm UTC](https://forum.babylonjs.com/t/error-compiling-gaussian-splat-node-material/55651/10 "2025-01-09T19:56:02Z")

</div>

[Storysplat.com](http://Storysplat.com) uses it now, check out the discover page [Story Splat - Interactive 3D Story Creation with Gaussian Splats](http://StorySplat.com/discover)

---

<div class="post-metadata">

**Author:** ![SonnyC56](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sonnyc56/32/34522_2.png) [@SonnyC56](https://forum.babylonjs.com/u/SonnyC56)\
**Post date:** [January 9, 2025, 7:56pm UTC](https://forum.babylonjs.com/t/error-compiling-gaussian-splat-node-material/55651/11 "2025-01-09T19:56:36Z")

</div>

> **[Story Splat - Interactive 3D Story Creation](https://storysplat.com/sonny-cirasuolo?sceneId=1734672282029)**
>
> Create and view immersive 3D stories with Gaussian Splat technology. Export your stories to HTML and share them with the world.
