I'm running in a problem. I would like to create an application that allows people to watch their panorama photos taken with their phone in a skybox view.
For that, I need to slice the photo into a cubeMap. I searched hard the internet to find an algorithm but I didn't find anything (that I could understand).
There are some programs that are doing a skyboxes from a panorama pictures, but I don't know their algorithm :/
The easy way is to keep the image in its original format and to use a sky cylinder instead of a sky box. Then you can apply texture coordinates according to the height and angle of the vertex and you're done.
If you want to use a sky box, you could calculate the correct texture coordinates in the pixel shader with:
Where
scale1
andscale2
are parameters that specify the picture's horizontal and vertical field of view.In neither the cylinder nor the box you need the top or bottom surface.