Hello,
(I realized this optimization was very iPhone specific)
In short, do I have to optimize my char’s IK baking on the 3D modeling tool, or is Unity’s native keyframe reducer sufficient to do a maximum optimization ?
On every 3D tool, IK baking writes every frame, and this is stunningly hitting performance on iPhone, so devs would face this problem each time they want to implement an IK animated character in their game.
Actually, I can’t find a non-destructive optimization for, let’s say, leg IKs. Imagine, at a 30 fps animation, you would have 30 x 4 bones transform processes per second … That’s way too much !
It is a real important point for every technically advanced games to come, because it’s uselessly eating performance that could be distributed elsewhere.
How do you, gamedevs, manage IKs exports in your iPhone games ? Do you keep each frame written ?
I used motion capture data for Touch KO. Unity’s keyframe reduction handled it fine and this was never an issue. The only issue is data overhead, not computation. No matter how dense your animation data is, all that is fundamentally happening is evaluating a curve at some time. Again though, even data overhead for us was inconsequential for having mocap, so I would just use Unity’s keyframe reduction and not worry about it.
Thank you for your precious answer, there couldn’t be best persons than the ones who made Touch KO to give me an advice on Keyframe reduction.
Ok, I’ll let Unity handle the job then !
I had this interrogation because I thought that each keyframe was a new var to store in memory, resulting in an overall useless written space if we have all the frames recorded.
So if Unity is handling it good, let’s trust it. But there are many, many ways to reduce keyframes : Cinema 4D let the choice between 2 solutions for example, and which are even different from the 3DS one.
I tested all the 3, and 3DS came with the most reducing non-destructive method. So the overall performance does depend on Unity’s reducing method, as it “could” be better to do it with 3DS, for instance.
In theory, that is the case. A curve with 3 keyframes is much less data overhead (download size, memory) than an identical curve with 100 keyframes. In practice, however, the Unity keyframe reducer works well enough that I never had a problem with too much data. My point was just that there is no more computational overhead for determining the final animation this way, as it will use the same interpolation process between keyframes to determine the curve’s value.
Keep in mind that your rotational keyframe data won’t be identical in Unity anyway, even if you use an external reducer as opposed to Unity’s. All of your Euler angles get converted into quaternions, which means they need different keys in order to maintain parity (e.g. if you rotate more than 180 degrees, if you are using weighted tangents, etc.)
FBX can save rotation curves as quaternions as long as your package supports it. I know Maya and Max allow you to animate with quaternions. I still think Unity will change these data though because a quaternion in Maya for example lets you rotate up to 720 degrees, but Unity only 180.
Again, though, I think this discussion is pretty academic. We get the exact same performance on a 1st-generation iPhone as we get on the iPhone 3G without doing anything special. Unity’s keyframe reduction works perfectly fine. There are going to be hundreds of places where you will get real and correctable performance hits; this is not one of them, so I woudln’t bother to invest any more time in it.
Didn’t have the time to test Unity’s reduction via Jakko’s script, but I had the opportunity to test 3DS keyframe reduction.
→ The FBX file went from 11.5 Mo to 1.6 Mo.
But it took 4 hours of processing !
The size was cut down by 10. That’s huge. And finally, I can absolutely see no differences between the original and the reduced animation.
So if 3DS has to take 4 hours of work for 1010 frames of 41 bones, I think Unity might be very good at reducing, but it will never come close to a native 3D tool reduction process.
Although, I will make those tests with before/after reduction, thanks to Jakko’s script, and keep you informed.
edit : Overall, I can see no difference either with the old 11.5 Mo FBX on my 3GS. The FPS is the same.
I have to test it with a 3G, but Unity still wins a point on this.
Just out of personal curiosity, what are you using in Max to reduce keys? Maya’s built-in keyframe reducer work pretty much instantaneously, so this comes as news to me.
Maybe that high process time comes from the fact that I got 41 animated bones to reduce, for a total animation of 1010 frames, with some of them having a key on each frame.
Curves are very precise and saw-like, too, due to quick and wild character movements.
I launched the calculation on an Intel core2 E8500 + 4 Go RAM (1333 MHz), under Vista in 3DS 64-bit mode.
That’s still really surprising to me I guess. My characters were only around 20 bones apiece (with keyframes on every frame) but I could still reduce an animation that was several thousand frames long instantaneously.