My shader comes up with the following error and I cannot work out why. I am hoping someone with greater knowledge would know exactly what is causing it.
These are the equivalent lines that I have taken from my shader… #import “Common/ShaderLib/Parallax.glsllib” #import “Common/ShaderLib/Optics.glsllib” #define ATTENUATION
uniform sampler2D m_HeightMap;
varying vec3 vViewDir;
varying vec2 texCoord;
vec2 newTexCoord
uniform float m_ParallaxHeight;
newTexCoord = classicParallaxOffset(m_HeightMap, vViewDir, texCoord, m_ParallaxHeight);
The error is…
ERROR: 0:262: error(#202) No matching overloaded function found: classicParallaxOffset
WARNING: 0:262: warning(#402) Implicit truncation of vector from size: 1 to size: 2
I am hoping someone can explain what the issue is here.
Many Thanks
The Lighting.j3md shader works as expected with normals so I am guessing the library can be uploaded ok.
The import lines are identical between Lighting.j3md and my shader.
My understanding from the error is that “no matching overload” is that somehow the parameter list is different, but I cant see any difference.
When the error is output in the console, the entire shader code is also output. at this moment the import has been resolved and the content of parallax.glsllib is inserted in the shader code. so you should see it in the console.
Yes That’s what the error says, it can be that one of your parameters is not what the function expect.
Check for your vectors cardinality for example. texCoord should be a vec2, vViewDir a vec3 (as far as I remember).
But this error most often means that the function was not found at all, so it may be that too…
Ok thanks for that.
I found in the error code that the function was not included because I had not defined PARALLAXMAP. This is because I renamed it to HIEGHTMAP. I put it in and the function was imported and my shader now works.
I have basically strimmed out all of the stuff that my shader will never use in the view for it to be more efficient. Having to define PARALLAXMAP to simply have the function inported seems like unnecessary overhead. Is there any advantage to using the glsllib file for this instance? I might just hard copy the function into my shader.
The glsllib import is just here for convenience/readability/modularity, and the end the code inserted into the shader code. So there is absolutely no difference if you insert the code yourself.