Convert OBJ to Cesium 3D Tiles (B3DM + tileset.json)
Project description
obj2tiles — OBJ → Cesium 3D Tiles
将大型 OBJ 三维模型转换为 Cesium 3D Tiles 格式(B3DM + tileset.json),适用于 CesiumJS 等 3D 地图/地球场景加载。
安装
# 从 PyPI 安装
pip install obj2tiles
# 处理纹理的可选依赖(自动缩放大纹理到 2048 以内)
pip install obj2tiles[texture]
# 本地开发安装
cd obj2tiles && pip install -e .
前置依赖
编码需要 draco_encoder 命令行工具:
# macOS
brew install draco
# Linux(从 Draco GitHub Release 下载)
# https://github.com/google/draco/releases
draco_encoder不是 Python 包,需要单独安装。运行时缺少它会给出提示。
用法
# 基本用法(本地坐标系)
obj2tiles model.obj ./output
# 指定地理位置(例如龙门石窟大佛)
obj2tiles model.obj ./output --lon 112.47 --lat 34.56
# 控制精度/大小
obj2tiles model.obj ./output --pos-bits 12 --compress 7 --levels 5
输出结构
output/
├── tileset.json Cesium 3D Tiles 清单文件
├── metadata.json 处理统计信息
├── index.html CesiumJS 查看器页面
├── lod_0.b3dm 最粗糙 LOD 层级
├── lod_1.b3dm
├── ...
└── lod_N.b3dm 最精细 LOD 层级
查看方式
cd output && python -m http.server 8080
# 打开 http://localhost:8080
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
obj2tiles-0.1.0.tar.gz
(23.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
obj2tiles-0.1.0-py3-none-any.whl
(24.8 kB
view details)
File details
Details for the file obj2tiles-0.1.0.tar.gz.
File metadata
- Download URL: obj2tiles-0.1.0.tar.gz
- Upload date:
- Size: 23.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34d169ca33130688bfcd6ceca87764d8e3985eeb7511c3d88d7827aabec6803f
|
|
| MD5 |
42e5ec42096a56541935742a41388767
|
|
| BLAKE2b-256 |
f0345086bab69200bfc632125335d304b57792b4d0ba81cc9b584a69528bcd97
|
File details
Details for the file obj2tiles-0.1.0-py3-none-any.whl.
File metadata
- Download URL: obj2tiles-0.1.0-py3-none-any.whl
- Upload date:
- Size: 24.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b72a4373635ec3380fb678de16e3b8d2faa542595263457c3d08bfe1beea11b8
|
|
| MD5 |
31296bd6c0993969f3972fa709d0757e
|
|
| BLAKE2b-256 |
ab9a4cf57f0cf585f360a67561c79a4378f0d810f9c3f93ea49daefb9f9ae50a
|