For a hobby project of mine I have created a finite voxel world (similar to Minecraft), but as I said, mine is finite. When you reach the edge of it, you are sent to the other side. That is all working fine along with rendering the far side of the map, but I want to be able to render this grid as a sphere.

Looking down from above, the world is a square. I basically want to be able to represent a portion of that square as a sphere, as if you were looking at a planet. Right now I am experimenting with taking a circular section of the map, and rendering that, but it look to flat (no curvature around the edges).

My question then, is what would be the best way to add some curvature to the edges of a 2d circle to make it look like a hemisphere. However, I am not overly attached to this implementation so if somebody has some other idea for representing the square as a planet, I am all ears.


Right now you essentially have a 2D plane, or at least a thick sheet of cubes. That's your map. You want to take that map and wrap it around a sphere. An easy way to do that is to convert your wrapping coordinates into spherical coordinates. Wrapping the same way you would with your current world.

To avoid all the nasty warping effects you get from this conversion at the poles, I would also shift the wrapping so that your player is always on the equator of the sphere.

This can be done entirely in the shader if you like. This keeps things very simple because it's an effect you can just turn on or off and you don't have to worry about changing any of your game logic.

I did a little experimenting with this myself and the above is the method I used. The results were promising:

enter image description here enter image description here

  • \$\begingroup\$ Hmm this looks interesting and you definitely have something to show for it. The only possible problem with this method is the poles. As you mentioned it would be best to hide them, but I am actually going to have two players, one in "space" and one on the ground. Ideally, I will be able to see the player on the ground from space up to a certain distance. So I would not be able to restrict viewing the poles... \$\endgroup\$ – Ross Hays Dec 8 '12 at 22:33
  • \$\begingroup\$ @Roflha Since the deformation can be implemented in the shader, the poles can be hidden per user. \$\endgroup\$ – MichaelHouse Dec 8 '12 at 22:37
  • \$\begingroup\$ Good point. Since you have already tested it though, one last question (sorry I am on my phone right now and cannot try it), the image makes it look like two adjacent towers of blocks would split off as they went high (from the perspective of space). Is that the case? Actually that might be hard to get around if it is. \$\endgroup\$ – Ross Hays Dec 8 '12 at 22:41
  • \$\begingroup\$ @Roflha Nope, it's purely a visual effect. Splitting blocks would have to happen on a lower level. \$\endgroup\$ – MichaelHouse Dec 8 '12 at 22:54
  • \$\begingroup\$ So a 3x3 tower reaching into the upper levels of the game would not fray at the top? Because based on the approach you are describing (mapping the coordinates of the cubes to a sphere) each column of the tower would be mapped to a different position on the sphere's outer edge from what I can tell. I would be curious to see an example image if possible. \$\endgroup\$ – Ross Hays Dec 8 '12 at 22:58

Use the same sort of approach used in Populous III -- just trick the eye as you zoom out. That way you can keep your planar world model, which is easy to work with.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.