Wednesday, June 28, 2017

opengl - Efficient skeletal animation


I am looking at adopting a skeletal animation format (as prompted here) for an RTS game. The individual representation of each model on-screen will be small but there will be lots of them!


In skeletal animation e.g. MD5 files, each individual vertex can be attached to an arbitrary number of joints.


How can you efficiently support this whilst doing the interpolation in GLSL? Or do engines do their animation on the CPU?



Or do engines set arbitrary limits on maximum joints per vertex and invoke nop multiplies for those joints that don't use the maximum number?


Are there games that use skeletal animation in an RTS-like setting thus proving that on integrated graphics cards I have nothing to worry about in going the bones route?



Answer



Limiting the number of bone influences is common, yes. You can either 0-weight unused influences, or have a loop/early-out mechanism to skip.


As for whether it works for an RTS, I don't have a reference for you, but I imagine you're going to need LOD if working with a large number of characters on-screen, and also if those characters are small.


LODing skeletal characters is much the same as LODing anything else, except you'll probably want to LOD the bone influences and skeleton as well as the mesh.


For example, a low-ish level of detail might only use a single bone with the highest influence per-vertex (also known as "hard skinning").


You would probably also limit the number of bones in the skeleton for a low LOD model.


Finally - consider whether you ever need to render the characters close-up. You probably only want to model, skin and animate the characters for the closest view distance... certainly you don't want to be storing all the runtime data at a resolution far higher than you'll ever render. You might find that you just don't need more than a very basic skeleton and a couple of influences per-vertex for your situation.


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...