- Home /
Animated Mesh LOD
Hey all,
I've seen the mesh LOD system which has been proposed and it makes a lot of sense (see here for instance). My question is: is it possible to make something similar for an animated mesh?
I guess I need to keep one Animation component on my main object so that the crossfades/blends that are currently being applied keep running throughout the LOD level changes. But that means I have only one set of animations, and these must be compatible with all the skeletons for the various LOD levels. Correct?
If so, is there a way in Unity to have one animation play on two different skeletons? Are the bones mapped by name, for instance?
Thanks, Ben
Answer by Paulius-Liekis · Sep 13, 2010 at 12:29 PM
Yes and no, you can play same animation on two different skeletons, but it will only will play animation on the joints which have matching paths. Which means if you have this sturecture in animation:
Root/Hips/Spine/Arm/Hand
Root/Hips/Spine/Arm/Hand/Thumb
Root/Hips/Spine/Arm/Hand/Thumb/Thumb1
Root/Hips/Spine/Arm/Hand/Finger1
Root/Hips/Spine/Arm/Hand/Finger2
You can throw away some child bones, for exmaple:
Root/Hips/Spine/Arm/Hand
Root/Hips/Spine/Arm/Hand/Finger2
Buf if you decide to throw away Thumb, like this
Root/Hips/Spine/Arm/Hand
Root/Hips/Spine/Arm/Hand/Thumb1
Root/Hips/Spine/Arm/Hand/Finger1
Root/Hips/Spine/Arm/Hand/Finger2
The animation Thumb1 won't be played. I hope this helps.
Actually you should first understand what you're trying to achieve. The usual goal of mesh LOD is to reduce vertex count, by thinking in that direction you could make lower-vertex-count mesh and skin it to the same skeleton, that would allow you to play same animations on it. That should be doable without a lot of trouble. Once people start doing LOD on animated meshes they usually think about animation LODing, because animations are expensive CPU wise, but that's actually hard to do without getting into internals of Unity.
Thanks a lot Paulius, that's exactly what I needed. On the topic of using the same skeleton or not, I guess the question is: does Unity evaluates an animation faster if it's missing some bones? Presumably, only missing leaf bones can be ignored, so I'd wager it doesn't change much performance-wise. But that may be worth a benchmark to me since I may end up with high bone counts in the faces that I would be able to entirely discard in secondary LODs.
I would guess that it doesn't sample animations if there are no corresponding bones in the mesh, but I wouldn't give 100%. I would recommend doing some tests on that ;)
@Ben. did you got the benchmark results? any comment would be nice. we're on the same issues now.
@groscalin (joli pseudo) Just got to benchmarking it, at last. Setup was: Unity 3.4, character using 2.2$$anonymous$$ vertice and 48 bones, bones per vertex maxed to 2 in Unity quality settings. I tried removing all bones from the face and hands which reduced the bone count to a mere 18, then playing the exact same anim on both versions. There is a perf increase but it's somewhat disappointing: roughly 10% on skinning and 30% on animation. That's not surprising for skinning seeing that basically I must be converting a few 2-bones vertice to 1-bone, but not that many. It's weirder for animation since I'm removing 60% of the bone count but only gaining 30%. Ah well, it's an easy gain anyways.
Your answer
Follow this Question
Related Questions
Why can't you use the bone influence tool in the Sprite Skinning Editor? 0 Answers
Add more bones to skeleton - vertebraes definition...? 0 Answers
Animating bones and the entire skeleton together 0 Answers
Can I make animations snap to a frame? 1 Answer
How do you allow the joints in a character to freely fall based on gravity? 1 Answer