I recently try to implement a carrousel with a warping effect based on this codrops article.
I refactored the project by migrating it on Vue and using an OrthographicCamera.
My goal
Getting the same warping effect on drag
My problem
As you can see on my codesandbox I think i’m not far of the truth.
There’s some weird ancient magic happening in the code - the strength is a bit too small to see any effect - but your main issue seems to be the calculation of strength vector.
You pass Three.Vector3 as vec2 vOffset. The y value of the strength vector you pass is always 0, that’s why you can’t see any effect in the shader. It should be enough to pass:
this.uniforms.uOffset.value = new THREE.Vector2(offset.x, offset.z);
And adjust the scale of the strength displacement (I kept the original value of strength at 0.00075):
Thank you for your fast answer
I’ve tried your solution but didn’t get the effect
I think that’s my problem is rather on the value of uv.y.
I don’t get very well the functionnaluty of it but it seems to control the derformation on x axis.
On the absolute I just realized that I don’t need the position.y because I only want a deformation on x axis.
I’m going to continu to work on this, if you have any other idea, don’t hesitate to share it or directly edit my sandbox (I have a local copy of it) ^^
Anyway thank you for your reactivity, realy appreciate it !
Sorry for my occasional bad english, I’m French and try to do my best haha
I copied the code directly from a working codesandbox, if you paste it there it should work (I’m not sure if you modified something else in your local code, or maybe I forgot smthn.)
Ah, yes, I did forget. Subdivide the plane more in the constructor - you don’t see difference because there’s simply not enough vertical vertices to move around (+ the code I shared above):
const geometry = new THREE.PlaneBufferGeometry(
item.width,
item.height,
10,
10
);