Project a plane/grid onto a sphere
Posted: Tue Apr 08, 2014 11:53 am
Ok, one for maths people: Does anyone know how to go about projecting a plane/grid onto a sphere?
Lets say you're projecting it from the view frustum of the camera, so you've divide the screen up into a grid where each square is of a uniform size and you're looking at a planet.
My first though would be to just do some kind of ray projection onto a sphere, the maths for that isn't too bad.
However, now imagine the sphere is only partially visible, how do you handle the bits of the grid that are projected off into space?
I really have no idea how to handle this, I suspect that you wrap them around onto the side of the sphere that you cannot actually see, but I don't know how to go about doing this.
Any suggestions, ideas, existing code(!!!) is most welcome. Even if you just find something on Google and help summarise it so a five year old (i.e. me) could understand it :)
Lets say you're projecting it from the view frustum of the camera, so you've divide the screen up into a grid where each square is of a uniform size and you're looking at a planet.
My first though would be to just do some kind of ray projection onto a sphere, the maths for that isn't too bad.
However, now imagine the sphere is only partially visible, how do you handle the bits of the grid that are projected off into space?
I really have no idea how to handle this, I suspect that you wrap them around onto the side of the sphere that you cannot actually see, but I don't know how to go about doing this.
Any suggestions, ideas, existing code(!!!) is most welcome. Even if you just find something on Google and help summarise it so a five year old (i.e. me) could understand it :)