Shader to software skinning method conversation

An almost monolog on stackoverflow helped me to get skeleton animations at least usably working in render demo that I’ve put up in android market. By the way on how the shader computes mat4 * vec4 can be found in the opengles shading language specification.

All right I’ve got a mesh with around 8000+ vertices, it’s sekelon with up to 128 bones and all it’s bone keyframe transformations up to 400 each animation.

Ahri SkeletonAhri Skeleton

Ahri MeshAhri Mesh

On desktop I could use this in vertex shader in order to compute the skinning:

As you can see there are a lot of bones. On android I don’t have the luxury of wasting variables to make simple lookups. I’d need 128 mat4  * 4 vec4 = 512 shader uniform vector variables and my samsung galaxy s2 only supports 304. Anyway I can think of 2 solutions:

  1. divide the mesh into an ‘ok’ amount of bones and render the mesh with less bone matrices
  2. do the skinning in software and update the vertex/normal buffers

I’d prefer the first solution, because I’d have to update merely the bone matrices uniform each frame instead of the entire vertex buffer. At this point however I have no idea how to divide the mesh because each vertex can have up to 4 bone influences and so I implemented the 2nd choice for now. Work in progress…

Here is the equivalent java code:

Facebook comments:

comments

3 Comments

  1. Major thankies for the article.Thanks Again. Much obliged.

  2. Excellent read, I just passed this onto a friend who was doing some research on that. And he just bought me lunch as I found it for him smile Thus let me rephrase that: Thanks for lunch! “Any man would be forsworn to gain a kingdom.”

Leave a Reply