[SOLVED] Shader throws error Overload resolution failed

Im trying to write a custom shader, but for some reason it throws an error when trying to calculate the min of 2 vec3.

Error:
Failed to execute ‘uniform3fv’ on ‘WebGL2RenderingContext’: Overload resolution failed.

Here is my code:

void main() {
    gl_FragColor = texture2D(uColorBuffer, vUv0);
    
    vec3 t0 = (uBoundsMin - uRayOrigin) * uRayDir;
    vec3 t1 = (uBoundsMax - uRayOrigin) * uRayDir;
    vec3 tmin = min(t0, t1); // THIS THROWS!
    
    gl_FragColor.rgb = gl_FragColor.rgb;
}

I just found my mistake.
I passed my vec3 like this:

scope.resolve("uCamPos").setValue(this.camPos);

But it expects an array like this:

scope.resolve("uCamPos").setValue([this.camPos.x, this.camPos.y, this.camPos.z]);
2 Likes

Thanks for posting your solution!