How can I get perfect matching texture to part of sphere

I’m new in Three.js. I’m working on spherical panorama using three.js and i have got problem with matching. I would like to get matching separate texture to original sphere. At the moment I’m trying resolve my problem by using PlaneGeometry object with texture applied and manually updating position of them, but it seems to me that this is bad idea… The sphere is curved, against plane.

This is my :demo

if I find middle point P and corners P1,P2,P3,P4 like below photo, is it possible to get matching correctly, using PlaneGeometry?

I extra found that is posible create part of sphere using Theta and Phi but i don’t know how calculate proportion theta and phi to my original sphere…

I’m stuck… Please somebody help me.

Greetings!

Your image is equirectangular, which is warped to project nicely inside a sphere, but it won’t map well onto a flat plane without distortions. You might need to write a custom shader that changes the projection. What are you trying to accomplish? There might be a simpler way to achieve your desired result.

Thank you for interesting :slight_smile: Wow shaders… this is horrible challenge, I never wrote any shader :smiley: I don’ t quite understand

You might need to write a custom shader that changes the projection

Do you mean vertex or fragmet or maybe both?

Well, what are you trying to accomplish? You could just take a Photoshop screenshot of the area you want, and avoid writing shaders… it all depends on what you’re trying to do. Why do you need to duplicate the image onto a plane?

At the first step wanted get matching any kind part of texture, so that I could later swap another variants like: red tv, brown tv or create animation on this place.

Ah, in that case you might want to skip using a flat plane, and instead use sphere segments, so you don’t have to modify the projection of the image. If you visit this page you’ll see you can mess with the phiStart, phiLength, thetaStart, and thetaLength attributes to create small segments of the sphere, like in this screenshot:
28%20PM

Yehaa I knew about it. I just wrote as second idea, but don’t know how to calculate theta and phi for my part of image :confused:

Phi is in radians!

  • 0 is left side of the image
  • PI (3.14159) is the middle
  • 2*PI (6.28318) is the right side of the image.

Theta is similar:

  • 0 is the top of the image
  • PI / 2 is the halfway point
  • PI is the bottom

You could simply divide PI by whatever fraction of the image that you want.

1 Like