39 lines
1.7 KiB
Markdown
39 lines
1.7 KiB
Markdown
---
|
||
title: "PCG"
|
||
type: concept
|
||
tags: ["unreal-engine", "procedural-generation", "open-world"]
|
||
sources: ["unreal-technical-artist", "unreal-world-builder"]
|
||
last_updated: 2026-04-26
|
||
---
|
||
|
||
## Definition
|
||
Procedural Content Generation(程序化内容生成),UE5 框架,通过图节点控制开放世界资产分布、地形采样、密度过滤和实例化放置。输出确定性:相同输入图和参数始终产生相同结果。
|
||
|
||
## Core Pipeline
|
||
1. **Input**:Landscape Surface Sampler → 密度和坡度过滤
|
||
2. **Transform Points**:Jitter 位置(±1.5m XY)、随机旋转(仅 Yaw)、缩放变化(0.8–1.3)
|
||
3. **Density Filter**:Poisson Disk 最小间距(防止重叠)、Biome 密度纹理采样
|
||
4. **Exclusion Zones**:道路缓冲(5m)、玩家路径缓冲(3m)、手动放置 Actor 排除半径(10m)
|
||
5. **Static Mesh Spawner**:权重分配(橡树 40%、松树 35%、桦树 20%、枯树 5%),全启用 Nanite
|
||
|
||
## Parameter Interface(必须文档化)
|
||
- GlobalDensityMultiplier(0.0–2.0)
|
||
- MinSeparationDistance(1.0–5.0m)
|
||
- EnableRoadExclusion(bool)
|
||
|
||
## Performance Constraints
|
||
- 最差情况下生成时间 < 3 秒
|
||
- 流式加载不得造成帧卡顿(World Partition 配合)
|
||
- PCG 密度控制:PCG → Nanite,密度可扩展至数千实例
|
||
|
||
## Advanced Patterns
|
||
- Gameplay Tags 查询驱动环境分布规则
|
||
- 递归 PCG:图 A 的输出作为图 B 的输入
|
||
- Runtime PCG:几何体破坏后重新运行图
|
||
- PCG 调试工具:编辑器视口内可视化点密度、属性值、排除区边界
|
||
|
||
## Related
|
||
- [[Nanite]] — PCG 放置资产的首选渲染模式
|
||
- [[WorldPartition]] — 与 PCG 流式加载协同
|
||
- [[Procedural-Level-Design]] — 更广义的程序化关卡设计概念
|