将6个立方体(立方体、天空盒)面映射为等矩形(圆柱投影、天空球)贴图的实用程序
cube2sphere的Python项目详细描述
立方球面
cube2sphere是映射6多维数据集(cube map,skybox)的python脚本 面成等矩形(圆柱投影,天球)地图。
用法
$ 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
支持的输出格式取决于搅拌器的安装,但是 通常包括tga、iris、jpeg、movie、iriz、rawtga、aviraw、avijpeg、png, bmp和frameserver。
cube2sphere可以在无头环境中运行(例如 服务器)。
示例
如果要将6个名为${face}.jpg的立方体面缝合到2048x102tga等矩形映射中,可以使用以下命令:
$ cube2sphere front.jpg back.jpg right.jpg left.jpg top.jpg bottom.jpg -r 2048 1024 -fTGA -ostitched
这将在工作目录中生成stitched.tga。
安装
cube2sphere可以用pip轻松安装。
它假定blender已安装,并且blender可执行文件列在系统路径环境变量中。如果无法编辑路径(与未授权用户的情况一样),则指向blender可执行文件的路径可以通过-b标志传递。
Linux
$ apt-get install blender $ pip install cube2sphere