I'm making a 360 viewer, so textures are inside a cylinder. Problem is that they appear inverted horizontally.
I know about texture.flipY
but I haven't found a texture.flipX
on the source.
So how can I flip a texture horizontally, or along the x axis, directly in the code? (not using an image editor)
The answer was easier than I thought.
cylinder.scale.x = -1;
And don't forget to add
material.side = THREE.DoubleSide;
To flip a texture horizontally, you can do the following:
texture.wrapS = THREE.RepeatWrapping;
texture.repeat.x = - 1;
As mentioned in the comments, this approach requires the texture to be a power-of-two in size.
three.js r.87
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With