Search code examples
angulartypescriptthree.js3d

Three.js - rotating texture on sphere geometry


Is it possible to rotate loaded texture on sphere geometry in Three.js? I don't want to rotate the object, just texture that is applied to material. Let's say I have a sphere that looks like that: enter image description here

And I just want it to rotate in x/y/z direction by n degrees to look like that: enter image description here


Solution

  • There is no way you can do this. Even If you wanted to offset the texture, it wouldn't work, especially in a loop.

    You should simply rotate the sphere:

    function render(){
        requestAnimationFrame(render);
        renderer.render(scene, camera);
    
        sphere.rotation.y += 0.01;
    }
    
    render();