2
\$\begingroup\$

I've implemented a batch rendering technique that is described in detail here: http://www.gamedev.net/page/resources/_/technical/opengl/opengl-batch-rendering-r3900

I'd like to extend it now to support 3D skeletal animation data, but I'm not sure what is the best way to do that so that the bone transformation can happen on the GPU rather than on the CPU. The Batches as they are defined right now depend on a transform matrix but that means that if I try to render a human, each limb would go into its own Batch, which means I would not get any performance gain by using the BatchManager as described in the article above.

Can someone suggest how to do batch rendering that works with 3D skeletal animation data?

\$\endgroup\$
2
\$\begingroup\$

The animation of skinned characters is usually performed using vertex shader constants. The model matrix is usually ignored, or used to define the local-to-world of the entire bone rig. Each bone is uploaded into a fixed, known constant offset. That same offset is cooked into the vertex data so that each vertex can extract the correct shader constant. In some cases there is one bone per vertex (rigid skinning) but in others there are more - they are blended together.

A quick search of the net found this example here:

http://mmmovania.blogspot.ca/2012/11/skeletal-animation-and-gpu-skinning.html

We render each skeletal model one at a time because we do per-model culling (hierarchical, but you end up with a single model) plus we split the models into parts anyways - on some platforms we run out of shader registers for the bones, or we have to switch materials. I imagine you could batch draw them in a special case by using a dependent read texture for bone data for crowd systems, perhaps, but that's a more bespoke solution.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ thank you for the link. I understand how skeletal animation works, what I'm not clear about is how to batch render multiple skeletal animated characters at once. Is that even possible? How do people handle this or does everyone just send one skeletal model at a time to the GPU to render? \$\endgroup\$ – Marek Krzeminski Nov 21 '14 at 21:49
  • \$\begingroup\$ @Steven: +1. You could add that to the answer to make it more complete ;-) \$\endgroup\$ – Kromster Dec 20 '14 at 22:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.