Original research and vex code by Matt Estela and his sources. This is just a little tweak on top.
Latest HIP file: stereopanorama_v05.hip.
The removal of factor
cy from position offsets in step 6 introduces distortion artifacts at poles. The result is incorrect for Gear VR stereoscopic panoramas, and I assume it to be incorrect for every other use as well, though have no test results to back that up. The factor
cy reduces eye separation towards the poles, removing the artifacts in the process. After this little tweak the vex code looks like this:
float pi = 3.1415926; float xa = -pi * x; float ya = (0.5 * pi) * y; float sx = sin(xa); float cx = cos(xa); float sy = sin(ya); float cy = cos(ya); p.x = -ipd * -sx * cy; p.z = -ipd * cx * cy; i = set(cx * cy, sy, sx * cy); $P = p; $I = i;
The stock Oculus 360 Photos application expects a
1536 x 1536 px per face cubemap with all faces stacked vertically on top of each other. 6 faces for monoscopic image (
1536 x 9216 px) and 12 faces for stereoscopic image (
1536 x 18432 px). For the stereoscopic image right eye cubemap is on top, left eye cubemap on bottom.
Cubemap face order:
I converted the equirectangular renders to cubemaps as a separate step as I happened to have PTGui Pro license at hand, but in theory you could stuff the whole process into the lens shader. After you have constructed the cubemap you can follow the official instructions on how to view it with your Gear VR.
Wrote a little Python script to automate the cubemap conversion process. Currently only monoscopic panoramas, but I will extend it to support stereoscopic pics soon-ish. Depends on PIL, nona from Hugin and erect2cubic from Panotools::Script.
The Python script: cubemap4gearvr.py.
Using cubemaps instead of equirectangular images gives you better end resolution with Gear VR, as the Oculus 360 Photos app appers to have 4k texture size limit. The app also expects the images to be mirrored for some odd reason, the script has an option to handle that as well.