Skip to content

Commit

Permalink
docs: update solution, usage and advanced
Browse files Browse the repository at this point in the history
  • Loading branch information
txtxj committed Apr 20, 2023
1 parent db1b782 commit fda0269
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
# Keyframe Reducer In Unity

## Solution

Read the animation curve into several tracks, each track compressed independently.

First, all components of the same variable are combined and stored in the IKeyframeBase implementation.

Then, for each curve, determine whether each keyframe can be interpolated by the two keyframes before and after it, and if so, this frame can be deleted.

## Usage

You can check the scripts under the Editor folder for some examples.

The only interface is

```csharp
KeyframeReducer reducer = new KeyframeReducer();
reducer.ReduceKeyframes(clip, rotationError, positionError, scaleError, checkData);
```

## Advanced

You can easily derive curve classes of other data types and compress them by implement `IKeyframeBase<T>` and `AnimationCurveBase<T>`, and then add an error function to KeyframeReducer.

## Result

Model source: https://github.com/fish-ken/unity-animation-compressor
Expand All @@ -11,6 +34,8 @@ Model source: https://github.com/fish-ken/unity-animation-compressor
| Skill | 446.3 | 415.0 |
| Walk | 78.1 | 74.8 |

Error Rate: 0.5%

## Reference

- https://www.bzetu.com/344/.html
Expand Down

0 comments on commit fda0269

Please sign in to comment.