Files
BlueRoseNote/02-Note/演讲与教程笔记/虚幻开放日2025/Hitch Hunter:排查逐帧瓶颈.md

83 lines
3.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: Untitled
date: 2025-08-22 11:20:14
excerpt:
tags:
rating: ⭐
status: inprogress
destination:
share: false
obsidianUIMode: source
---
# 前言
录制视频:[[UFSH2025]卡顿大追猎:排查逐帧瓶颈 | Ari Arnbiornsson Epic Games 开发者关系资深工程师(官方字幕)](https://www.bilibili.com/video/BV1k44mzWEvq/?share_source=copy_web&vd_source=fe8142e8e12816535feaeabd6f6cdc8e)
# Level Streaming Hitches
## Using Actor for Static Geometry
1. 不要在Actor中放入过多StaticMesh。避免使用Actor—+Stat
应该使用:
1. PLASLevel打包Actor功能。
2. PCG
3. ISM/HISM
4. Foliage Tool
5. Niagara/Mass
## 5- .6 针对大世界流式加载有迭代
- Asynchronous component registration
- Asynchronous physics statecreation/destruction
- Unified/shared budget for AsyncLoading and Level Streaming
## Fast Stream Plugin
巫师四使用了这个插件。
# Physics Hitches
## 优化你的物理
1. 使用Simple Physics
2. 手动关闭Complex Physics
3. 使用Use Simple As Complex
## 设置碰撞通道
1. 关闭不需要的Overlaps也就是关闭不需要Actor的Generate Overlap Events。
2. 设置Update Overlap Method During Level Streaming => OnlyUpdateMovable可以在ini或者PerActor中惊醒设置Actor里可以设置为`UseConfigDefault`)。
ini位于`[/Script/Engine.Actor]`
## 减小物理场景大小
1. 物理调试工具Chaos Visual Debugger
2. 使用物理代理
1. 将多个物理物体替换一个简单物理代理。
3. 使用异步物理
1. 目前只能使用c++实现UE5.5实验性/5.7正式)。
2. 或者在下一帧执行traces。
3. 减少物理场景的大小或者复杂度使得traces更快。
4. 相关命令行
1. LevelStreaming.AllowIncrementalPreRegisterComponents = true
2. LevelStreaming.AllowIncrementalPreUnregisterComponents = true
3. p.Chaos.EnableAsyncInitBody = true
# Actor Spawning Hitches
1. 简化Actor
2. 限制Per Frame Spawn Num
3. **延迟初始化组件**
4. 构建Actor对象池重用Actor。
# PSO Compilation Hittches
## PSO Precaching & Bundled PSO Cache
1. 5.3之后。默认开启Precacheing 5.6支持在LoadingScreen 中获取编译Shader进度。
2. 建议PSO Prechacing、Bundled PSO Cache 混用
使用`-clearPSODriverCache`命令行来清理PSOCache也可以使用[PSOCacheBuster](https://github.com/Flassari/PSOCacheBuster)插件自动清理PSOCache。
使用`r.PSOPrecace.Validaion=2`通过日志来记录Miss情况。
# Garbage Collection Hitches
1. 减少UObject数量
1. StaticMeshActor可能成为一个痛点。
2. 使用WorldPartition或者关卡流送来加载角色附近的可见区域。
2. 使用`obj list -countsort`来查看所有的UObject。
1. 一般低于50w否者就需要去研究如果减少他们。
3. 如果短时间需要创建大量UObejct就得考虑使用对象池。
4. 在LoaddingScreen/黑屏/屏幕冻结 情况下中执行GC操作。
# 同步载入卡
避免使用同步加载逻辑,可以使用下面的插件来检查项目中是否使用:
https://github.com/Flassari/CommonValidators