Morphing infinite texture-mapped plane into sphere
Members - Reputation: 103
Posted 04 March 2013 - 02:43 PM
I'm trying to come up with a program which will be able to display an infinite plane in 3D space (with a tiled texture) which will be able to morph into a spehre (with as little texture distortion as possible). Kind of like an infinitely repeating world map which can wrap up into a rotatable Earth-like sphere (doesn't need to be accurate, it's just a crude visual effect). I have only very basic knowledge of graphics theory, and am not sure where to look for algorithms which would allow me to perform such manipulations. Can anyone offer any advice as to how I might be able to form the mathematical basis for such a program?
Thanks a lot
(I should mention that I'm new to these forums - please let me know if what I'm asking is too vague)
Members - Reputation: 502
Posted 04 March 2013 - 06:19 PM
Ok, I think I know what you want. Unfortunately, it's a little impossible so you have to cheat. Suppose we have a rectangular map. When flying/walking over the map, repeating this same map over and over is easy. The problem is there's no clean way to wrap a plane onto a sphere. There will be a lot of distortion, especially at the poles. http://en.wikipedia.org/wiki/Map_projection
What you can do, if you don't need any kind of accuracy or correctness, is cheat. When you're close to the ground, I imagine you just draw a subrectangle of the rectangular map, just the area immediately around the player. When you want to view the sphere at a distance, just map a circle of the map around the player onto a hemisphere. The area in the center of the circle will look mostly correct, but near the poles will be wrong. Instead of rotating the sphere, just change the center point. This way you can rotate on either 'axis' and come back to where you started.
Interesting enough, if your world is a donut shape, an infinitely repeating rectangular map works perfectly!