1
votes

In ThreeJS, I have a particle with a texture of the top image that is being applied using a fragment shader. I'm using TweenJS to update attributes, but am unsure how to do rotation. How do I rotate the top texture using a fragment shader so that the texture animates to the bottom image? I prefer not to use a canvas and keep the code in the shaders.

Here is my fragment shader:

uniform sampler2D myTexture;

void main() {
    gl_FragColor = texture2D(myTexture, gl_PointCoord);
}

Start

Finish

1

1 Answers

2
votes

A solution to rotating a texture using a fragment shader can be found at: https://github.com/mrdoob/three.js/issues/1891#issuecomment-5923058