Hey there!
I’m extending / updating an existing material (MeshStandard one) using the onBeforeCompile method.
So far so good, done plenty of times but now i’m using uniformsGroup and apparently i cannot bind them onBeforeCompile for some reasons?
I’ve used uniformsGroup a lot in shader materials, never on existing ones.
material.onBeforeCompile = (shaders => {
shaders.uniformsGroup = [globalUniforms]
shaders.vertexShader = shaders.vertexShader.replace(
`#include <common>`, `
${globalUBO}
#include <common>
`
)
gives
[.WebGL-0x138005baf00] GL_INVALID_OPERATION: It is undefined behaviour to have a used but unbound uniform buffer.
Nothing really helpful
The issue apparently might be not the binding itself but definition in the shader because if i remove the ${globalUBO}
string it doesn’t throw an error (but clearly doesn’t work)
I tried to write it manually too instead of using a variable but still the same issue
Any idea?