If you haven’t checked out our recent World Trade Center model, you should click on that link now! Given the crazy amount of security we had to go through to gain access to the top floor of the building, including signing our lives away to a >100-page security compliance document, we will probably have the best panorama from the top floor of the building for as long as the building is closed to the general public.
One of these days–maybe if our cool boss Dave makes a final selection for Floored’s Catered Lunch Program™ (might he be reading this?)–we will write about how these panoramas are generated. Meanwhile, we thought we’d point out one weird thing about Unity’s skybox renders.
Assume that our secret+magical sauce has given us a beautiful panorama for a model…
Since we rely on the Unity engine to render our models across devices, our panoramas have to be displayed in models via Unity Skyboxes. Here, the term “skybox” refers to the special construct that allows 3D worlds to render pretty scenes at a distant using images.
Imagine a 3D world similar to one shown below.
If the objects are sufficiently far away, we could replace the objects with flat images. This helps reduce the rendering complexity of the 3D world while creating an illusion that the surroundings remain in 3D. To the observer at the viewpoint at center, the surroundings near the horizon are identical whether they are in 2D or in 3D, as shown in the image below.
For this reason, once we have an equirectangular panorama for a model, we project the panorama into a cube by generating six images that correspond to the six sides of the skybox cube–up, down, front, back, left, and right. These images are viewed by an observer at the position indicated by the black dot in the 3D environment, so intuitively, the assignment of images to each of the six sides should the order shown below.
Counterintuitively, Unity’s skybox convention has the left and right assignment swapped as indicated below.
This results in an odd situation where the correct assignment of our skybox images for the World Trade Center panorama has the left and right labels swapped.
Isn’t this weird?
After some head-scratching, it turns out that the reason this happens is because the Unity game engine that we rely upon operates on a left-handed coordinate system. By Unity’s arbitrary convention, ‘left’ is assigned to the +X direction and ‘right’ is assigned to the -X direction, as displayed in the image below.
We think that this is a pretty convincing explanation for the left-right weirdness. However, if you have an even better idea, do let us know!