Skip to main content

sphere2cube PyPI version PyPI

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

Usage

$ sphere2cube -h
usage: sphere2cube [-h] [-v] [-r <size>] [-R <rx> <ry> <rz>] [-p <pattern>]
                   [-o <dir>] [-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)
  -F <angle>, --fov <angle>
                        field of view of camera used for rendering cube faces
  -p <pattern>, --path <pattern>
                        filename pattern for rendered faces: default is
                        "face_%n_%r", where %n is replaced by the face number
                        and %r by the resolution
  -o <dir>, --output-dir <dir>
                        directory to save rendered faces to (it must already
                        exist)
  -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 be 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 requires a Python 3 installation, and at least Blender 2.8.

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

Metadata

Release files for sphere2cube 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sphere2cube 0.3.0
File Size Uploaded Provenance Actions
sphere2cube-0.3.0.tar.gz 135.0 kB Without provenance Details for sphere2cube-0.3.0.tar.gz

Release files / sphere2cube-0.3.0.tar.gz

Download URL sphere2cube-0.3.0.tar.gz
Size 135.0 kB
Tags Source
SHA-256 checksum
How to use checksums
366b4e5d330d377c240c9e6d33f4236fef5d0d10b404d143e2350fc6875f9b94
BLAKE2b-256 checksum
How to use checksums
d33af55bd0dcfa2ddf8191d53dbbd487b5d1be07adf826ec88db59df4bdadd6f
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for sphere2cube 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page