Files
BlueRoseNote/03-UnrealEngine/卡通渲染相关资料/渲染功能/ARC/Animation/常量关键帧压缩.md

57 lines
1.6 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: 常量关键帧压缩
date: 2026-05-03 00:00:00
excerpt: 60fps 帧限动画和 4F 间隔自动校正,确保格斗游戏帧精确播放
tags:
- ARC
- Animation
rating: ⭐
---
# 常量关键帧压缩
返回 [[Animation]]
## 概述
新增 `AnimCompress_Constant` 压缩方案,将动画关键帧限定在 60fps 的固定帧率网格上。格斗游戏的核心机制(攻击判定、无敌帧、帧优势等)要求动画在每一帧的状态都是确定性的,不能依赖插值。
## 实现
### AnimCompress_Constant
```cpp
// AnimCompress_Constant.h/.cpp
// 常量关键帧插值 — 不做帧间插值,直接使用最近的关键帧
```
核心行为:
- 每帧独立存储(不做 delta 编码)
- 运行时取值不做线性插值,直接 snap 到最近关键帧
- 确保 60fps 下每帧状态与 DCC 工具导出完全一致
### 4F 间隔自动校正
Avatar 动画使用 4 帧间隔15fps 的关键帧),自动校正导入的帧时间到 4F 网格:
```
原始帧: 0, 3, 7, 11, ...
校正后: 0, 4, 8, 12, ... (snap 到 4F 倍数)
```
### AnimCompress_Automatic 扩展
标准 UE4 的 `AnimCompress_Automatic` 也被扩展以支持常量帧模式选项。
## 关联文档
- [[FBX导入扩展]] — `bImportREDAnimationData` 控制导入时的帧限处理
## 修改文件列表
| 文件 | 修改类型 |
|------|---------|
| `Source/Runtime/Engine/Public/Animation/AnimCompress_Constant.h` | **新增** |
| `Source/Runtime/Engine/Private/Animation/AnimCompress_Constant.cpp` | **新增** |
| `Source/Runtime/Engine/Public/Animation/AnimCompress_Automatic.h` | 扩展 |