3D Molecule Ray Tracer
Advanced molecular visualization tool that generates professional-grade rendering scripts with cinematic effects for creating publication-quality and cover-worthy molecular images.
Features
- - Multi-Software Support: Generate scripts for PyMOL and UCSF ChimeraX
- Photorealistic Rendering: Ray-tracing, depth of field, ambient occlusion
- Cinematic Lighting: Studio, outdoor, and dramatic lighting presets
- Publication Presets: Pre-configured settings for journals, covers, and presentations
- Customizable Scenes: Fine control over camera, materials, and atmosphere
Usage
Basic Usage
CODEBLOCK0
Parameters
| Parameter | Type | Default | Required | Description |
|---|
| INLINECODE0 | str | pymol | No | Target rendering software (pymol/chimerax) |
| INLINECODE1 |
str | None | Yes | PDB file path or 4-letter PDB ID |
|
--preset | str | standard | No | Rendering preset (standard/cover/publication/cinematic) |
|
--style | str | cartoon | No | Molecular representation style |
|
--resolution | int | from preset | No | Output resolution in pixels |
|
--bg-color | str | white | No | Background color |
|
--ao-on | flag | False | No | Enable ambient occlusion |
|
--shadows | flag | False | No | Enable shadow casting |
|
--fog | float | from preset | No | Fog density (0-1) |
|
--dof-on | flag | False | No | Enable depth of field |
|
--dof-focus | str | center | No | DOF focus point |
|
--dof-aperture | float | from preset | No | Aperture size (higher = more blur) |
|
--lighting | str | from preset | No | Lighting preset |
|
--output | str | auto | No | Output script filename |
Advanced Usage
CODEBLOCK1
Rendering Presets
| Preset | Resolution | Ray Trace | DOF | AO | Shadows | Use Case |
|---|
| Standard | 2400px | ✓ | ✗ | ✗ | ✗ | Quick high-quality |
| Cover |
3000px | ✓ | ✓ | ✓ | ✓ | Journal covers |
|
Publication | 2400px | ✓ | ✗ | ✓ | ✗ | Manuscript figures |
|
Cinematic | 3840px | ✓ | ✓ | ✓ | ✓ | Presentations |
Supported Software
| Software | Best For | Features |
|---|
| PyMOL | Traditional rendering, ease of use | Ray tracing, shadows, AO |
| ChimeraX |
Modern effects, large structures | PBR lighting, ambient occlusion, VR |
Technical Difficulty: MEDIUM
⚠️ AI自主验收状态: 需人工检查
This skill requires:
- - Python 3.8+ environment
- PyMOL 2.5+ or ChimeraX 1.5+ installed separately
- Understanding of molecular visualization concepts
Dependencies
Required Python Packages
CODEBLOCK2
External Software
- - PyMOL: https://pymol.org/
- UCSF ChimeraX: https://www.cgl.ucsf.edu/chimerax/
Risk Assessment
| Risk Indicator | Assessment | Level |
|---|
| Code Execution | Python scripts executed locally | Medium |
| Network Access |
Fetches PDB structures from RCSB (optional) | Low |
| File System Access | Writes rendering scripts | Low |
| Instruction Tampering | Standard prompt guidelines | Low |
| Data Exposure | No sensitive data exposure | Low |
Security Checklist
- - [x] No hardcoded credentials or API keys
- [x] No unauthorized file system access (../)
- [x] Output does not expose sensitive information
- [x] Prompt injection protections in place
- [x] Input file paths validated
- [x] Output directory restricted to workspace
- [x] Script execution in sandboxed environment
- [x] Error messages sanitized
- [x] Dependencies audited
Prerequisites
CODEBLOCK3
Output Example
CODEBLOCK4
Evaluation Criteria
Success Metrics
- - [ ] Successfully generates valid PyMOL/ChimeraX scripts
- [ ] Scripts execute without errors in target software
- [ ] Output images meet quality standards
- [ ] Handles edge cases gracefully
Test Cases
- 1. Basic Functionality: Generate script for PDB ID → Valid script created
- File Input: Generate script from PDB file → Valid script created
- Preset Override: Custom parameters override preset → Correct settings applied
- Both Software: Generate for PyMOL and ChimeraX → Both scripts valid
Lifecycle Status
- - Current Stage: Draft
- Next Review Date: 2026-03-15
- Known Issues: None
- Planned Improvements:
- Blender integration
- AI-assisted composition suggestions
- Real-time preview mode
References
See references/ for:
- - PyMOL-specific rendering techniques
- ChimeraX lighting documentation
- Colorblind-friendly palettes
- Journal submission guidelines
Limitations
- - Static Images Only: Generates scripts for still images, not animations
- Software Dependency: Requires separately installed PyMOL or ChimeraX
- Rendering Time: High-quality renders can take 10-30 minutes per image
- Learning Curve: Advanced effects require understanding of photography concepts
- File Sizes: High-res images can be 10-50 MB each
- No Automatic Layout: Creates single images; figure assembly requires separate tools
💡 Tip: For creating multiple related figures, save your complete scene setup (lighting, camera, colors) as a PyMOL session file (.pse) or ChimeraX session (.cxs), then modify only the specific elements needed for each figure. This ensures consistency across figure panels.
3D分子光线追踪器
高级分子可视化工具,可生成具有电影级效果的专业级渲染脚本,用于创建达到出版质量和封面水准的分子图像。
功能特性
- - 多软件支持:为PyMOL和UCSF ChimeraX生成脚本
- 照片级渲染:光线追踪、景深、环境光遮蔽
- 电影级光照:工作室、户外和戏剧化光照预设
- 出版预设:为期刊、封面和演示文稿预配置的设置
- 可定制场景:精细控制相机、材质和氛围
使用方法
基本用法
bash
使用默认设置生成PyMOL脚本
python scripts/main.py --pdb 1mbn
生成封面质量渲染脚本
python scripts/main.py --pdb 1mbn --preset cover
生成ChimeraX脚本
python scripts/main.py --software chimerax --pdb 1abc --preset publication
参数说明
| 参数 | 类型 | 默认值 | 必需 | 描述 |
|---|
| --software | 字符串 | pymol | 否 | 目标渲染软件(pymol/chimerax) |
| --pdb |
字符串 | 无 | 是 | PDB文件路径或4字母PDB ID |
| --preset | 字符串 | standard | 否 | 渲染预设(standard/cover/publication/cinematic) |
| --style | 字符串 | cartoon | 否 | 分子表示样式 |
| --resolution | 整数 | 来自预设 | 否 | 输出分辨率(像素) |
| --bg-color | 字符串 | white | 否 | 背景颜色 |
| --ao-on | 标志 | False | 否 | 启用环境光遮蔽 |
| --shadows | 标志 | False | 否 | 启用阴影投射 |
| --fog | 浮点数 | 来自预设 | 否 | 雾密度(0-1) |
| --dof-on | 标志 | False | 否 | 启用景深 |
| --dof-focus | 字符串 | center | 否 | 景深焦点 |
| --dof-aperture | 浮点数 | 来自预设 | 否 | 光圈大小(越大越模糊) |
| --lighting | 字符串 | 来自预设 | 否 | 光照预设 |
| --output | 字符串 | auto | 否 | 输出脚本文件名 |
高级用法
bash
带景深的封面质量渲染
python scripts/main.py \
--software pymol \
--pdb 1mbn \
--preset cover \
--dof-on \
--dof-focus A:64 \
--dof-aperture 2.0 \
--style surface \
--output cover_render.pml
电影级4K渲染
python scripts/main.py \
--software pymol \
--pdb complex.pdb \
--preset cinematic \
--resolution 3840 \
--ao-on \
--shadows \
--lighting cinematic
渲染预设
| 预设 | 分辨率 | 光线追踪 | 景深 | 环境光遮蔽 | 阴影 | 使用场景 |
|---|
| 标准 | 2400px | ✓ | ✗ | ✗ | ✗ | 快速高质量 |
| 封面 |
3000px | ✓ | ✓ | ✓ | ✓ | 期刊封面 |
|
出版 | 2400px | ✓ | ✗ | ✓ | ✗ | 手稿图表 |
|
电影级 | 3840px | ✓ | ✓ | ✓ | ✓ | 演示文稿 |
支持的软件
| 软件 | 最佳用途 | 功能特性 |
|---|
| PyMOL | 传统渲染,易用性 | 光线追踪、阴影、环境光遮蔽 |
| ChimeraX |
现代效果,大型结构 | PBR光照、环境光遮蔽、VR |
技术难度:中等
⚠️ AI自主验收状态:需人工检查
此技能需要:
- - Python 3.8+环境
- 单独安装PyMOL 2.5+或ChimeraX 1.5+
- 理解分子可视化概念
依赖项
必需的Python包
bash
pip install -r requirements.txt
外部软件
- - PyMOL:https://pymol.org/
- UCSF ChimeraX:https://www.cgl.ucsf.edu/chimerax/
风险评估
| 风险指标 | 评估 | 等级 |
|---|
| 代码执行 | Python脚本本地执行 | 中等 |
| 网络访问 |
从RCSB获取PDB结构(可选) | 低 |
| 文件系统访问 | 写入渲染脚本 | 低 |
| 指令篡改 | 标准提示词指南 | 低 |
| 数据暴露 | 无敏感数据暴露 | 低 |
安全检查清单
- - [x] 无硬编码凭据或API密钥
- [x] 无未经授权的文件系统访问(../)
- [x] 输出不暴露敏感信息
- [x] 已实施提示注入保护
- [x] 输入文件路径已验证
- [x] 输出目录限制在工作空间内
- [x] 脚本在沙盒环境中执行
- [x] 错误消息已清理
- [x] 依赖项已审计
先决条件
bash
Python依赖项
pip install -r requirements.txt
单独安装PyMOL或ChimeraX
输出示例
✓ 渲染脚本已生成:/path/to/cover_render.pml
配置:
软件:pymol
预设:cover
样式:cartoon
分辨率:3000px
景深:开启
环境光遮蔽:开启
阴影:开启
光照:cinematic
渲染方法:
pymol cover_render.pml
# 或在PyMOL中:
@ cover_render.pml
评估标准
成功指标
- - [ ] 成功生成有效的PyMOL/ChimeraX脚本
- [ ] 脚本在目标软件中无错误执行
- [ ] 输出图像达到质量标准
- [ ] 优雅处理边缘情况
测试用例
- 1. 基本功能:为PDB ID生成脚本 → 创建有效脚本
- 文件输入:从PDB文件生成脚本 → 创建有效脚本
- 预设覆盖:自定义参数覆盖预设 → 应用正确设置
- 双软件:为PyMOL和ChimeraX生成 → 两个脚本均有效
生命周期状态
- - 当前阶段:草稿
- 下次审核日期:2026-03-15
- 已知问题:无
- 计划改进:
- Blender集成
- AI辅助构图建议
- 实时预览模式
参考资料
参见 references/ 目录:
- - PyMOL特定渲染技术
- ChimeraX光照文档
- 色盲友好调色板
- 期刊投稿指南
局限性
- - 仅静态图像:生成静态图像脚本,不支持动画
- 软件依赖:需要单独安装PyMOL或ChimeraX
- 渲染时间:高质量渲染每张图像可能需要10-30分钟
- 学习曲线:高级效果需要理解摄影概念
- 文件大小:高分辨率图像每张可达10-50 MB
- 无自动布局:创建单张图像;图表组装需要单独工具
💡 提示:如需创建多个相关图表,请将完整场景设置(光照、相机、颜色)保存为PyMOL会话文件(.pse)或ChimeraX会话文件(.cxs),然后仅修改每个图表所需的特定元素。这确保了图表面板间的一致性。