I am working on a hobby project and implemented a skybox, no big deal. Now I bought (licensed) a few really nice sky textures. Unfortunately the textures are projected for a skysphere.

I could implement a skysphere handling/rendering, but I figure rendering a box is way more efficient. (That may actually not matter on modern devcies though.) So I decided to transform the textures into 6 textures for a skybox.

My hodge podge solution to convert the textures is I create a scene in blender and render out the appropriate 6 views. If you ask google that is aproptatly the common sollution.

It there a tool that can do the conversion in a more automated way?


Note, that there is no pixel-to-pixel projection (one pixel can map into several pixels etc).

You should implement a geometric ray/cube intersection. It sounds complicated, but it is very easy. Choose a pixel on sphere map. From that pixel, you compute azimuth and elevation. Compute unit-length 3D vector, pointing from the center of the sphere to your pixel. Now scale that vector, so the largest coordinate is 1. Now you have coordinates on cube, so put your pixel color onto that coordinate in cube.

It would be better to do it backwards - request a pixel on cube and then look for that pixel in sphere map, so you don't have "empty spaces" in your cube map.

If you are looking for a tool, here is a discussion about it http://forum.quest3d.com/index.php?topic=46542.0

  • \$\begingroup\$ Implementing my own is also an option, though I was hoping on something already done. The real trick with this approach is a robust filtering/supersamling scheme to reduce aliasing. The reason being that implementing my own is more work than just using blender for my dozen textures, but if everybody said that, it explains why there is apparently no tool for it. \$\endgroup\$ – rioki Feb 12 '13 at 9:35
  • \$\begingroup\$ Thank you I will try out the resources. Hugin looks interesting, even for other texture related issues. \$\endgroup\$ – rioki Feb 12 '13 at 13:54

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.