2

I have an image that is a panorama 360 photo (example). I'd like to convert it to a format that fits in VR - either equirectangular (example) or cubemap.

The only solution I've seen is http://ggnome.com/pano2vr but it does not seem to work for me. Is there a different approach I can take?

1 Answer 1

1

I went ahead a wrote a C++ application that (hopefully) does what you want and posted it on GitHub.

Given the cylinder x^2 + y^2 = 1 inscribed inside a 2x2x2 cube centered at the origin, we can project the cylindrical panorama onto the coresponding four faces of the cube as follows. For every pixel in the output image we cast a ray from the cube's center at (0,0,0) through the corresponding point on one of the cube's faces and determine where that ray intersects the cylinder. We then map this point on the cylinder to the corresponding point in the input image and (bilinearly) sample the input image at the point. The resulting pixel color is assigned to the current output pixel.

You can read the gory details in the associated docs.

Here are some thumbnails of the input and output image you suggested:

enter image description here enter image description here

2
  • Very cool, thank you. One note - the output should be length = 2X height so that it can wrap perfectly around a sphere.
    – Sekoul
    Feb 11, 2017 at 15:27
  • 1
    I don't think I really did what you wanted. I need to use a sphere instead of a cylinder. I mapped a cylinder to four sides of cube (no top or bottom on cube) which would work with cave VR with no up or down movement. I'll take another crack at it when I get a chance.
    – wcochran
    Feb 11, 2017 at 16:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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