GithubHelp home page GithubHelp logo

dyxmo / sphere2cube Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xyene/sphere2cube

0.0 0.0 0.0 242 KB

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

Home Page: https://pypi.python.org/pypi/sphere2cube

License: GNU Affero General Public License v3.0

Python 100.00%

sphere2cube's Introduction

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

sphere2cube's People

Contributors

madhawav avatar phaseone avatar wayde2014 avatar xyene avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.