---
name: forest.aiimage
description: 森林背景图封包 - 热带/温带森林场景，适合休闲消除类游戏的背景贴图生成
triggers: 森林,forest,背景,background,热带,自然,绿色,nature,casual,tree
---

# forest.aiimage

森林主题背景图封包。适合休闲消除、跑酷等类型游戏，营造自然清新的视觉氛围。

## Recipe

生成方式：调用 AI 图像生成接口，基于以下参数生成或 fork：

- **基础 prompt**：`lush green forest clearing, dappled sunlight through canopy, casual mobile game style, flat design, vibrant colors`
- **宽高比**：9:16（竖屏移动端）
- **风格**：cartoon / flat design
- **可 fork 的变体方向**：
  - 热带雨林：在 prompt 中加入 `tropical rainforest, palm trees, exotic flowers`
  - 秋季森林：替换为 `autumn forest, golden leaves, warm tones`
  - 夜间森林：替换为 `moonlit forest, bioluminescent plants, dark atmosphere`

**生成步骤：**
1. 确认 Prefab 容器对背景贴图的尺寸约束（默认 1080×1920 PNG）
2. 调用图像生成 API，传入 prompt 和宽高比
3. 验证输出尺寸 ≥ 1080px 宽
4. 将生成图写入封包目录为 `background.png`
5. 更新 `manifest.json` 中 `generation.prompt` 和 `generation.seed` 字段

## Result

- **产物文件**：`background.png`
- **格式**：PNG，透明度可选
- **最小分辨率**：1080×1920
- **引用方式**：通过 `manifest.json.result.outputFile` 引用，Binding 层写入 scene 路径

## Binding

- **Binding Role**：`backgroundTexture`
- **挂载目标**：`scene://entities/Background/element/textureAsset`
- **引用类型**：`texture-asset-reference`
- **约束**：format=png，minWidth=1080
- **从 Prefab 读取 Binding 模板**：`.prefab/manifest.json` → `bindingTemplates.backgroundTexture`
- **写入路径**：将 `background.png` 的 asset id 写入 scene 对应实体的 textureAsset 字段

## 生成方式

Platform Skill: `playcraft-image-generation`

```bash
# 1. 生成图片（参考 ref/ 中的参考图）
playcraft tools generate-image \
     --prompt "lush green forest clearing, dappled sunlight through canopy, casual mobile game style, flat design, vibrant colors" \
     --aspect-ratio 9:16 \
     --image-model google/imagen-3.0-generate-002 \
     --output ta-workspace/raw.png

# 2. 后处理（去白底 + 格式转换）
playcraft image remove-background --input ta-workspace/raw.png --output ta-workspace/trimmed.png
playcraft image convert --input ta-workspace/trimmed.png --output ta-workspace/background.webp --quality 85

# 3. 将产物写入 sandbox 对应路径（见 binding.target）
```
## Skill Definition

tools:
  - bash
  - write
  - read
prompt_extension: |
  You are generating a forest background image for a mobile casual game.
  Follow the Recipe section to call the image generation API with the specified prompt and parameters.
  After generation, verify the output meets the Result constraints, then apply the Binding to wire it into the scene.
  If forking this skill, modify the prompt in manifest.json to reflect the new visual style before generating.
