Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

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

share|improve this answer
    
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. –  rioki Feb 12 '13 at 9:35
    
Thank you I will try out the resources. Hugin looks interesting, even for other texture related issues. –  rioki Feb 12 '13 at 13:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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