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
Here is the node material - Babylon.js Node Material Editor
When I apply this in my app, I get errors.
Here is the code in my app-
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=a22a11-a12a21;
float b11=-a22a10+a12a20;
float b21=a21a10-a11a20;
float det=a00b01+a01b11+a02b21;
return mat3(b01,(-a22a01+a02a21),(a12a01-a02a11),
b11,(a22a00-a02a20),(-a12a00+a02a10),
b21,(-a21a00+a01a20),(a11a00-a01a10))/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 valuevalue;
}
vec3 square(vec3 value)
{return valuevalue;
}
float pow5(float value) {float sq=valuevalue;
return sqsqvalue;
}
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.rgbD;
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+origVecdistance;
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