mpetroff / pannellum

Pannellum is a lightweight, free, and open source panorama viewer for the web.
https://pannellum.org/
MIT License
4.29k stars 726 forks source link

Why do high-resolution panoramas choose cube grid instead of spherical grid? #868

Closed hopepdm closed 4 years ago

hopepdm commented 4 years ago

Can't we choose the equirectangular panorama as the texture of the spherical mesh and make the high-definition panorama?

mpetroff commented 4 years ago

Spherical meshes are inaccurate because spheres are not made of planar faces; a spherical mesh is an approximation. This is why Pannellum's equirectangular mode does not use a mesh and instead does a proper projection, which prevents nadir and zenith artifacts among other distortions. The equirectangular projection itself is only used because it is a de facto standard for spherical panoramas, likely due to its simplicity. It has extremely high area and angle distortions, which leads to much larger images than would otherwise be necessary. Thus, since the multiresolution mode requires the image to be processed anyway, it doesn't make any sense to use the equirectangular format.

Pannellum's multiresolution format is based on a cube map projection in an attempt to maintain compatibility with the tiled panoramas used by the Flash-based panorama viewers that were in widespread use when it was created. These viewers used a cube map projection because it is also a simple projection, which is probably the easiest projection to implement a viewer for with a 3D graphics API. While the cube map projection is more efficient than an equirectangular projection, it is still far from optimal.

Ideally, an equal area projection with relatively low angular distortion would be used. At some point, I want to implement such a projection, likely based on an octahedron.

hopepdm commented 4 years ago

@mpetroff thanks for your answer.