I've always heard morphs are more expensive than bones for real-time applications, but I don't understand why, and haven't had luck googling an explanation. Can anyone explain or point me to reading materials or videos that explain or illustrate? Surely this has been covered here before, but I couldn't find a relevant thread.
Maybe my original assumption is incorrect and bones aren't cheaper than morphs? Someone set me straight!
Replies
Also do you mean processing-, memory- or man-hour-expensive?
To compare both you would need a use case where you have one and the same end result but done twice with both solutions.
E.g. a facial rig
Also it's not for a facial rig: picture a hose disconnecting from a valve. So a simple spline-tube animating from connected to disconnected.
A group my coworker is working with wants to use morph targets to animate that, but it makes more sense to me to use bones, but when I tried to explain why bones were cheaper, I realized that I couldn't, meaning that I was operating from an incomplete assumption (which is likely outdated).
I suppose that he could just rig up a duplicate using each option and check it out in unity. I just figured someone would say something like "per vertex animation is more expensive because it has to store the position of each vertex, as opposed to the rotation value of a single bone" or something like that. I really thought this would be easier to google.
Bones animation is based on a combination of matrix calculations to retrieve the final vertex position and the other is just a simple interpolation between to coordinates.
So if it's just one vertex I would argue blend shapes are faster to calculate.
But:
This can change with the complexity of the required animation(s).
Also this is usually all calculated on the GPU today and you never know what optimizations are done to speed up specific tasks. Best bet would be to simply test it out on a certain hardware with hundreds or thousands of not-instances (instances could get optimized).
And there might exist indirect influences on the performance e.g. through memory bandwidth (as vertex animation needs to store way more data)
But I guess the main reason the one is used instead of the other is ease-of-use reasons. Facial animations are a good case because both can be used at the same time to use the advantages of both techniques.
Disclaimer: at least that's my knowledge
I'm mostly going to talk about faces, because that's my point of reference but it applies a lot of other things.
If you can use morphs, great! Just make sure you aren't uselessly throwing a giant pile of morph data at a problem that bones can handle pretty well at a cheaper cost. Balance the solution. Learn which one is good at solving certain problems and deploy them together if you can.
Joints are better for...
For example why use a bunch of morphs to open, close the jaw, slip it side to side, in and out and to rotate it slightly left and a right? The mesh is already skinned and a single joint for the jaw will get a wider range of flexibility with better control over the position of the jaw.
Those 8 morphs that you're using to manipulate a large selection of verts can be used much more effectively to push the mesh into shapes the skinning can't when it hits certain poses. You can crease the mouth, squint the eyes, furrow the brow and add emotion instead of trying to use morphs to do transnational operations.
Morphs are better for...
Likewise, if you try to use bones to do things morphs do easily like manipulate the lips for emotion and speech, then you end up with a bunch of joints tripping all over each other. It's hard to animate, its hard to make look natural, your skeleton is joint heavy and that impacts a huge list of things that iterate over the skeleton. Not to mention it make your process extremely slow and cumbersome. You spend a lot of time skinning and your animation pipeline needs some tools written to help manipulate all of those joints into the right places so the animators aren't bogged down fiddling with a million little controllers. What you've done by closing yourself off to morphs is costing you in time, tech and quality.
Vert influences...
The more bones you allow to influence a vert the larger the skinned data set becomes and the more expensive it becomes to operate. For the vast majority of skinned objects 3-4 bone influences will be all you need per vert.
Pause... Let me back up a min and explain something about skin data. Every vert has a number. Every set of skin data stores the position of each vert and records the bones that are assigned to it and what their values are. If you record 3 values per (vert * 3) vert that's better than storing 4-5-6 joints/weights per vert. So in general you want the least number of influences possible.
When you skin the face with joints...
You end up needing a lot of joints in close proximity to each other and to get smooth deformation you need the influences set higher. So you're skin data is now bloated, even for verts around the ears and the back of the head that don't need 4-5 influences. That's a giant pool of unused influences that aren't necessary for the majority of the mesh, but because a few key points in the face really need it and you've decided not to use morphs for subtle details, every vert in the skin data table gets unused data added to it.
You also have a 3rd option, materials...
Blending in wrinkle maps and expressions can really help push the details that both morphs and joints have trouble doing. When you combine all 3 effectively you get an amazingly expressive rig. But of course materials and blending have a cost so it has to be weighed against everything else and balanced for performance.
Now there might be a perfectly good reason you need a rig to be entirely joint driven so you might have to accept the trade off as a limitation put on the project. That's how it goes in games, everything has a cost and often something needs to be sacrificed so something else can function. Facial animation might be a low priority so you only get 7 joints to make the faces as expressive as you can. It all depends on the project.
It's more a matter of functionality and what is a good solution that solves the problem without being too expensive, in either tech or time. If morphs in that case don't cause an issue and it keeps the project moving, great. Just make sure that it doesn't override other decisions later on and you end up in a weird spot where "this is how we handle cables and ropes!" and you end up trying to shoehorn a solution that doesn't really work.
I think my main concern with the morphs is making sure that the mesh and the animation are two separate files, so that if you have to change the mesh, for like optimization or what have you, then you don't have to re-animate it.
I thought there would also be performance concerns, but from what I'm hearing here that's not actually the case, which may explain why they chose to use morphs in the first place.
Thanks for your help guys!
I'm in the process of deciding whether to use bone weights or blendshapes/ morphs for a game I'm making. Its for a herd of animals all with different characteristics, but they will all be made from the same base mesh, will this still use a lot of RAM?
Interested to know if morphs are still worthwhile outside of facial animations.
animation with morphs is relatively expensive and doesn't support non-linear translations- which is why we use bones