Skip to main content

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

Project description

sphere2cube

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

Usage

$ sphere2cube -h
usage: sphere2cube [-h] [-v] [-r <size>] [-R <rx> <ry> <rz>] [-o <path>]
               [-f <name>] [-b <path>] [-t <count>] [-V]
               [<source>]

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

positional arguments:
  <source>              source equirectangular image filename

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  -r <size>, --resolution <size>
                        resolution for each generated cube face (defaults to
                        1024)
  -R <rx> <ry> <rz>, --rotation <rx> <ry> <rz>
                        rotation in degrees to apply before rendering cube
                        faces (z is up)
  -o <path>, --output <path>
                        filename for rendered faces: default is "face_%n_%r",
                        where %n is replaced by the face number, and %r by the
                        resolution
  -f <name>, --format <name>
                        format to use when saving faces, 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.

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

Examples

For instance, to render a 2048-resolution TGA cubemap from source.jpg, we could use the following command:

$ sphere2cube source.jpg -r2048 -fTGA

This would generate face_1_2048.tga, …, face_6_2048.tga in the working directory.

Installation

sphere2cube can be easily installed with pip.

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 sphere2cube

Linux

$ apt-get install blender
$ pip install sphere2cube

Mac OS X

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

$ pip install sphere2cube

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

sphere2cube-0.1.8.zip (107.8 kB view details)

Uploaded Source

File details

Details for the file sphere2cube-0.1.8.zip.

File metadata

  • Download URL: sphere2cube-0.1.8.zip
  • Upload date:
  • Size: 107.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for sphere2cube-0.1.8.zip
Algorithm Hash digest
SHA256 f4bae3af9003a696eb712dd0f64fd010accf94a302e7fc1cb4f8f7b9102df966
MD5 dce32f4b2d3d08ae03efbe13c12f4730
BLAKE2b-256 2e27d0e397407267580b0e397a1f1f6363ecc825fdebb973b862a8de26a50661

See more details on using hashes here.

Supported by

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