Postprocessing: TextureEffect and uvTransform not working

Created on 25 Mar 2020  路  2Comments  路  Source: vanruesc/postprocessing

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

bug

All 2 comments

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].

Was this page helpful?
0 / 5 - 0 ratings

Related issues

drcmda picture drcmda  路  4Comments

dghez picture dghez  路  4Comments

Monder87 picture Monder87  路  3Comments

dghez picture dghez  路  4Comments

emmelleppi picture emmelleppi  路  4Comments