I'm trying to scale the texture of TextureEffect so that it maintains the correct aspect ratio. To enable texture transforms, I believe I should be setting uvTransform to 1, like this:
const webcamEffect = new TextureEffect({
texture: camTexture,
})
webcamEffect.uvTransform = 1
Doing this causes a shader compile error and I'm not sure why.
Here's a sandbox with the same issue replicated (uncomment line 57 to see the error)
https://codesandbox.io/s/loving-tesla-emoux
Hi, thanks for reporting this!
The uvTransform setting is supposed to be a boolean flag, but the outcome will be the same if 1 is used instead. The documentation is wrong in this regard.
The shader error is caused by an awkward combination of compressed shader code that ends up with an #ifdef at the end of a long line of code:
55: uniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;#ifdef ASPECT_CORRECTION
This error went unnoticed in the texture demo because here the SMAAEffect comes before the TextureEffect.
A fix is on the way.
Fixed in [email protected].