Wave Shader Compilation error

So I was trying to setup a simple wave shader and trying to render it on a plane. Was not trying to do a lot just wanted the plane to give that wave effect. I am getting an ‘unable to compile effect’ on the material.
The shader code looks alright but it looks I am missing something when I am setting up the shader material.

Playgorund link - https://playground.babylonjs.com/#5IAHHK#5

Press F12 to get the console and you should see that:

babylon.js:16 BJS - [15:51:47]: Offending line [125] in vertex code: float output4 = output5 / wavelength;
babylon.js:16 BJS - [15:51:47]: Error: VERTEX SHADER ERROR: 0:125: 'wavelength' : undeclared identifier
ERROR: 0:133: 'u_World' : undeclared identifier

Ok I fixed the above errors. Also I don’t seem to be getting these errors on my console


BJS - [16:06:49]: Error: FRAGMENT varying vUV does not match any VERTEX varying

ok some progress. looks like I am missing a library. Any idea what it is?


viewProjection missing from uniform list

wave shader | Babylon.js Playground

ohh my bad. thanks a lot. We have something at least. The result is different than what I saw in the node material editor.
Thanks a lot anyway. I will explore further

1 Like

sorry to annoy you once again.
I exported the shader after adding a texture in the node material and am running into new issues now. Apologies I am not super familiar with shaders


Node material - https://nodematerial-editor.babylonjs.com/#XB44SA#1

Did you know you can use an NME shader directly using snippet without copy/paste shader:

Node Material | Babylon.js Documentation

1 Like

Ok yes that worked. But is there no way to run it with the shader exported

The generated code is not meant to be used in a ShaderMaterial.

See this thread for eg: #include directives in shader code output from Node Material Editor - #2 by Evgeni_Popov

yes I did change the uniforms in the shader code as well. Still getting the same issue. I guess it needs all of the NME wrapper code that you wrote
That rgb issue is weird.


You miss a #define VMAINUV in each shader. It will work but without lighting. As explained in the post linked earlier, ShaderMaterial materials don’t support standard lighting out of the box.

1 Like