• Stars
    star
    200
  • Rank 195,325 (Top 4 %)
  • Language
    Python
  • License
    GNU Affero Genera...
  • Created over 9 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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

More Repositories

1

wsl-dotfiles

My dotfiles for running an i3-based environment within the Windows Subsystem for Linux (WSL).
Shell
262
star
2

Emulator.NES

📺 Nintendo Entertainment System emulator written in C#.
C#
164
star
3

sphere2cube

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

ASM-Late-Bind-Agent

A demo late binding Java agent utilising ASM for transforming classes.
Java
32
star
5

chrome-os-i3-dotfiles

My dotfiles for running an i3-based environment within Chrome OS (via Crostini).
Shell
29
star
6

Nitrous-Emulator

🎮 High-performance Java emulator for Nintendo Gameboy and Gameboy Color hardware.
Java
25
star
7

macro8080

An Intel 8080 emulator implemented entirely in C macros, capable of running Altair BASIC. 😨
C
8
star
8

wayland-dotfiles

My dotfiles for running swaywm on Debian.
Shell
6
star
9

dmoj-env

Vagrant setup for easy DMOJ development.
Python
4
star
10

t258-cpu

A simple RISC CPU implemented in Verilog, as well as compilation toolchain for it.
Verilog
4
star
11

atari11

Atari 2600 emulator in C++11.
C++
3
star
12

Xwing

XML Swing layout engine - XML Windowing Toolkit
Java
2
star
13

OCR

A demo neural network OCR app.
Java
2
star
14

Visual-Cellular-Automata

Visualization for cellular automata.
Java
2
star
15

JBL

A library for JVM bytecode modification, implemented in Java.
Java
2
star
16

GRAPHic-Traveler

Visualization for various graph traversal algorithms.
Java
2
star
17

Pycraft

A partial Python Minecraft-like client implementation.
Python
2
star
18

withhost

🌐 Linux/FreeBSD utility for overriding DNS address lookup responses.
C
2
star
19

Jalgo

Java Unicode text polluter. HE COMES!
Java
1
star
20

web-photosphere-viewer

A Dart + WebGL photosphere viewer webapp.
Dart
1
star
21

SpaceTorus

Flying through tori in a scenic universe.
C
1
star
22

gol-cell-cycle

The Game of Life, "Cell Edition".
Java
1
star
23

slack-mathoid

Math rendering as a Slack integration via Wikimedia Mathoid.
Python
1
star
24

Swing-Debugger

A simple visual debugger for Swing/AWT applications.
Java
1
star