Skip to main content

Utility to map 6 cube (cubemap, skybox) faces into an equirectangular (cylindrical projection, skysphere) map

Project description

cube2sphere PyPI version PyPI

cube2sphere is a Python script to map 6 cube (cubemap, skybox) faces into an equirectangular (cylindrical projection, skysphere) map. See also sphere2cube.

Usage

$ cube2sphere -h
usage: cube2sphere [-h] [-v] [-r <width> <height>] [-R <rx> <ry> <rz>]
               [-o <path>] [-f <name>] [-b <path>] [-t <count>] [-V]
               <front> <back> <right> <left> <top> <bottom>

Maps 6 cube (cubemap, skybox) faces into an equirectangular (cylindrical
projection, skysphere) map.

positional arguments:
  <front>               source front cube face filename
  <back>                source back cube face filename
  <right>               source right cube face filename
  <left>                source left cube face filename
  <top>                 source top cube face filename
  <bottom>              source bottom cube face filename

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  -r <width> <height>, --resolution <width> <height>
                        resolution for rendered map (defaults to 1024x512)
  -R <rx> <ry> <rz>, --rotation <rx> <ry> <rz>
                        rotation in degrees to apply before rendering map (z
                        is up)
  -o <path>, --output <path>
                        filename for rendered map (defaults to "out")
  -f <name>, --format <name>
                        format to use when saving map, i.e. "PNG" or "TGA"
  -b <path>, --blender-path <path>
                        filename of the Blender executable (defaults to
                        "blender")
  -t <count>, --threads <count>
                        number of threads to use when rendering (1-64)
  -V, --verbose         enable verbose logging

Supported output formats depend on the Blender installation, but will generally include TGA, IRIS, JPEG, MOVIE, IRIZ, RAWTGA, AVIRAW, AVIJPEG, PNG, BMP, and FRAMESERVER.

cube2sphere can be run in a headless environment (e.g., a server).

Examples

If we wanted to stitch 6 cube faces named ${face}.jpg into a 2048x1024 TGA equirectangular map, we could use the following command:

$ cube2sphere front.jpg back.jpg right.jpg left.jpg top.jpg bottom.jpg -r 2048 1024 -fTGA -ostitched

This would generate stitched.tga in the working directory.

Installation

cube2sphere can be easily installed with pip. It requires a Python 3 installation.

It assumes that Blender is installed and the blender executable is listed in the system PATH environment variable. If it is not possible for PATH to be edited (as in the case of an unprivileged user), the path to the blender executable may instead be passed through the -b flag.

Windows

Install Blender, and add blender.exe to PATH. Finally,

pip install cube2sphere

Linux

$ apt-get install blender
$ pip install cube2sphere

Mac OS X

Similar to Windows, install Blender, and add the blender executable to $PATH. Then,

$ pip install cube2sphere

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cube2sphere-0.2.1.tar.gz (150.7 kB view details)

Uploaded Source

File details

Details for the file cube2sphere-0.2.1.tar.gz.

File metadata

  • Download URL: cube2sphere-0.2.1.tar.gz
  • Upload date:
  • Size: 150.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.7.7

File hashes

Hashes for cube2sphere-0.2.1.tar.gz
Algorithm Hash digest
SHA256 e3d02ca842570e4a150cc7962f0ea736a008bc400e817e6b19cbc6a469f89343
MD5 cd65e61d71ec85476c1131da77115f44
BLAKE2b-256 5ef62ce7f7417029b80f69ef40901ad244d80b81ec97f6343b0743fe1cd24312

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page