Skeletal Animation: Rotations per Vertex

Started by
11 comments, last by vajuras 19 years, 6 months ago
Quote:Original post by dachande
I *think* I'm beginning to understand - does that mean that for all the 20 matrices that have been set as constants in the vertex shader, that only 3-4 of those matrices will actually be used on any one vertex?

Yes.
Quote:Setting all the matrices at the beginning of the render speeds things up, as setting constants before drawing each bone is too slow.

No.

It's not just an optimization, it's needed. First lets consider a simple case.

1---2|  /|| / ||/  |3---4


Lets say vertex 1 uses bone 1, and vertex 2-4 use bone 2. How can you render that one bone at a time? You can't. You have to render full faces.

1--2,5--7|  /|  /|| / | / ||/  |/  |3--4,6--8


The middle vertices are split such that we can assign different bones (this isn't really done, this is just trying to make the faces use individual bones).

Now lets say vertices 1-4 use bone 1, and vertices 5-8 use bone 2. Now lets translate bone 2 to the side.

1---2  5---7|  /|  |  /|| / |  | / ||/  |  |/  |3---4  6---8

Hmm. We've got a hole in the mesh. Unless different vertices of the same face use different bones, you cannot avoid holes. If a face uses more than 1 bone, then we can't possibly render one bone at a time.

Ok, so then how do you render them?
x..x.. . . .. a..x|\ .| \.b--c---d...x\  |  /.  .. \ | / . . .  \|/  ..  .   e...x...x

Imagine this L shaped "elbow" joint... I've greyed out some vertices and faces to show the shape. The bone assignments here would be as this:

(single influence)
a,b,c = bone1
d,e = bone2

In this case, all three polys around the joint need 2 bones. Using a single bone per vertex can produce ugly artifacts though. Great for metal objects, like robot arms.

(2 influences)
a = bone1
b = bone1 70%, bone 2 30%
c = bone1 50%, bone 2 50%
d = bone2
e = bone1 30%, bone 2 70%

In this case, not only do the three polys require 2 bones, but most of the vertices require 2 bones. Extra influence, and gradually changing influences can produce nice curved joints. Great for organic fleshy objects that have a curve to their joints.
Advertisement
Thanks, that's what I needed to know. To be honest, I'd already figured out the majority of the stuff in the last post - but it's very helpful to have someone confirm that you're on the right tracks. (Thanks for putting in the effort to draw me some ascii pictures too! :) )

Vajuras, I quite like the tutorial you've posted on your site - I look forward to seeing the shader version, it's always a good idea to comapare notes with with something that's already been implemented. I've been unable to run your GODZ download though - it crashes as soon as it's clicked ;)

I've done a quick search for the post describing Namethatnobodyelsetook's method for splitting meshes so that I can reference it here for anyone else finding this post useful. There are a few hundred posts to dig through though! I assume Vajuras knows the link? Could you post it if you get a sec? ;)

Thanks,

Dachande
here ya go: skeletal animation in Direct3D

Never seen the engine crash unless dx9.0c (summer 2004 release) wasn;t installed. make sure you have that. Btw, feel free to post what the log says. That way I know 4 sure where it crashes.

[Edited by - vajuras on October 4, 2004 9:32:20 AM]

This topic is closed to new replies.

Advertisement