readme
This commit is contained in:
39
README.md
39
README.md
@@ -19,16 +19,20 @@
|
||||
## 🛠️ 安装
|
||||
|
||||
### 1. 安装 Blender
|
||||
|
||||
从官网下载并安装: https://www.blender.org/download/
|
||||
|
||||
### 2. 验证安装
|
||||
|
||||
```bash
|
||||
# 确保可以从命令行访问Blender
|
||||
blender --version
|
||||
```
|
||||
|
||||
### 3. 准备数据文件
|
||||
|
||||
确保您的 JSON 数据文件格式正确,包含以下结构:
|
||||
|
||||
```json
|
||||
{
|
||||
"p": [0.0, 0.0, 0.0],
|
||||
@@ -52,27 +56,44 @@ blender --version
|
||||
## 🎯 使用方法
|
||||
|
||||
### 方法 1: 使用运行脚本(推荐)
|
||||
|
||||
```bash
|
||||
python run_blender.py -i jsonfile.json
|
||||
```
|
||||
|
||||
### 方法 2: 直接运行 Blender 脚本
|
||||
|
||||
```bash
|
||||
blender --background --python toModel.py
|
||||
```
|
||||
|
||||
### 方法 3: 在 Blender GUI 中运行
|
||||
|
||||
1. 打开 Blender
|
||||
2. 切换到 Scripting 工作区
|
||||
3. 打开 `toModel.py` 文件
|
||||
4. 点击运行按钮
|
||||
|
||||
### 综合
|
||||
|
||||
python3 run_fused_system.py
|
||||
(.venv) ~/Desktop/BL/ [main*] python3 run_fused_system.py
|
||||
🎨 融合光学系统脚本运行器
|
||||
========================================
|
||||
✅ 找到 Blender: /Applications/Blender.app/Contents/MacOS/Blender
|
||||
🚀 开始运行融合光学系统脚本...
|
||||
光学系统数据:./e8caffb4622e03b1495bbc1ed13fce13.json
|
||||
光路数据:./miao_light_path_tsingtao.json
|
||||
Blender 命令:/Applications/Blender.app/Contents/MacOS/Blender
|
||||
执行命令:/Applications/Blender.app/Contents/MacOS/Blender --background --python ./fused_optical_system.py -- ./e8caffb4622e03b1495bbc1ed13fce13.json ./miao_light_path_tsingtao.json
|
||||
✅ 融合光学系统脚本执行成功!
|
||||
|
||||
## 📁 输出文件
|
||||
|
||||
运行成功后,将生成以下文件:
|
||||
|
||||
| 文件名 | 格式 | 用途 |
|
||||
|--------|------|------|
|
||||
| --------------------------- | ------- | ------------------------------------------- |
|
||||
| `optical_system.obj` | OBJ | 通用 3D 模型格式,可在大多数 3D 软件中打开 |
|
||||
| `optical_system.glb` | GLB | Web 友好格式,适合在线展示 |
|
||||
| `optical_system.blend` | Blender | 完整的 Blender 工程文件,包含所有材质和设置 |
|
||||
@@ -81,16 +102,19 @@ blender --background --python toModel.py
|
||||
## ⚙️ 配置选项
|
||||
|
||||
### 几何体类型支持
|
||||
|
||||
- **plane**: 平面镜/透镜
|
||||
- **parabola**: 抛物面镜,使用 `face_f` 参数控制焦距
|
||||
- **hyperbola**: 双曲面镜,使用 `face_f` 和 `face_g` 参数
|
||||
|
||||
### 材质类型
|
||||
|
||||
- **metal**: 金属反射材质(淡蓝色)
|
||||
- **nothing**: 透明材质(10%不透明度)
|
||||
- **其他**: 发光材质(橙色光)
|
||||
|
||||
### 渲染设置
|
||||
|
||||
- 分辨率: 1920x1080
|
||||
- 引擎: Cycles(支持高质量材质)
|
||||
- 格式: PNG
|
||||
@@ -98,7 +122,9 @@ blender --background --python toModel.py
|
||||
## 🔧 自定义
|
||||
|
||||
### 修改材质
|
||||
|
||||
编辑 `toModel.py` 中的材质创建函数:
|
||||
|
||||
```python
|
||||
def create_metal_material():
|
||||
# 修改金属材质属性
|
||||
@@ -108,12 +134,15 @@ def create_metal_material():
|
||||
```
|
||||
|
||||
### 调整几何体精度
|
||||
|
||||
修改分辨率参数:
|
||||
|
||||
```python
|
||||
mesh = create_parabolic_surface(face_f, size=2.0, resolution=64) # 更高精度
|
||||
```
|
||||
|
||||
### 修改渲染设置
|
||||
|
||||
```python
|
||||
scene.render.resolution_x = 3840 # 4K分辨率
|
||||
scene.render.resolution_y = 2160
|
||||
@@ -124,21 +153,27 @@ scene.render.resolution_y = 2160
|
||||
### 常见问题
|
||||
|
||||
**Q: 找不到 Blender**
|
||||
|
||||
```
|
||||
❌ 错误:未找到Blender安装
|
||||
```
|
||||
|
||||
A: 确保 Blender 已正确安装并添加到系统 PATH 中
|
||||
|
||||
**Q: 几何体创建失败**
|
||||
|
||||
```
|
||||
创建几何体时出错: ...
|
||||
```
|
||||
|
||||
A: 检查 JSON 数据中的 `face_f` 和 `face_g` 参数是否为有效数值
|
||||
|
||||
**Q: 导出失败**
|
||||
|
||||
```
|
||||
模型导出失败
|
||||
```
|
||||
|
||||
A: 确保有写入权限,检查磁盘空间
|
||||
|
||||
### 调试技巧
|
||||
@@ -150,11 +185,13 @@ A: 确保有写入权限,检查磁盘空间
|
||||
## 📈 性能优化
|
||||
|
||||
### 大型数据集
|
||||
|
||||
- 对于超过 100 个对象的数据集,考虑分批处理
|
||||
- 降低几何体分辨率以提高性能
|
||||
- 使用后台模式避免 GUI 开销
|
||||
|
||||
### 内存使用
|
||||
|
||||
- 大型模型可能需要 8GB+内存
|
||||
- 监控内存使用,必要时重启 Blender
|
||||
|
||||
|
||||
Reference in New Issue
Block a user