I created a 3D sphere in a 2D project and applied texture on it. The sphere rotates around X axis. For the given point on the sphere I need to find texture color. The point on the sphere is static and doesn’t rotate with the sphere. Is it possible to find texture color at the point without raycasting?
What about
using raycasting would be easiest, its not heavy operation either…
other option would be to take pixelcolor on the screen, from that point position…(probably bit slow)
should be possible with some math too…
this is kind of near, but pretty much opposite of what you want to do…(no idea how you would do the inverse)
http://stackoverflow.com/questions/7840429/calculate-the-xyz-point-of-a-sphere-given-a-uv-coordinate-of-its-texture
maybe,
Aye, I thought the same thing. He has said though that the texture doesn’t rotate with the sphere. In that case, how he has mapped it may be different.
I didn’t define the problem clearly. The point is independent from the sphere and the texture does rotate with the sphere.
I already implemented solution given at UV mapping - Wikipedia
and it works while the sphere is static but it needs to take rotation into account. I will have about 30-40 static points on the sphere surface and I need to calculate texture color for each of these point in every frame because the sphere is rotated with each frame. If I use raycasting for each point will it cause performance issues?
Raycasting, in this case, will probably be your cheapest solution when it comes to performance.