matrix skinning how does it work???

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
seewan
Posts: 6
Joined: Wed Oct 19, 2005 8:14 pm

matrix skinning how does it work???

Post by seewan »

I have look through the skinning sample and the article in the forum but still does not understand how the skinning works? can any one explain how it works?

what does the weight in the vertex structure does? does it specify the amount of inflenue by each bone matrix on that vertex?

how do i set the bone matrix and how do know which bone matrix each vertex is influence by

also do i need to sort the vertex to draw sort by the bone matrix?

thanks
chp
Posts: 313
Joined: Wed Jun 23, 2004 7:16 am

Post by chp »

Matrix skinning on the PSP works by multiplying each skinning matrix with its associated weight (matrix0 * weight0 and so on), adding them together and then multiplying the vertex with this resulting matrix.

sceGuBoneMatrix(...) is used to upload the matrices to the hardware. Since the PSP does not support indexed matrix blending, you have to slice the model into partitions that are influenced by different bones.
GE Dominator
seewan
Posts: 6
Joined: Wed Oct 19, 2005 8:14 pm

Post by seewan »

so if i have 15 bones i have to draw the model 15 times and each time with all the verteices affected by the particular bone?
chp
Posts: 313
Joined: Wed Jun 23, 2004 7:16 am

Post by chp »

No, if you have fifteen bones you have to determine which vertices are affected by which bones, cut the model into appropriate parts associated with those bones and render. If you for example set a maximum of 4 bones affecting a vertex (very common on other platforms), you would probably cut the model into 4-5 parts which you render using different bones loaded. Look at normal matrix skinning, there's nothing special about it on the PSP except the fact that you can have 8 matrices applying at once.
GE Dominator
seewan
Posts: 6
Joined: Wed Oct 19, 2005 8:14 pm

Post by seewan »

How should i cut the part? Can you illustrate

another question is that since the matrix affect vertices but the vertices affected may not form triangle . how do you handle case like this . for sample vertice 1 -4 is affected by bone 1-8 , vertex 5-20 is affected by bon4 5 and 6 and 1 -3 from a tri and 4 - 6 form another tri so if i load bone matrixc 1-8 which part of hte meash should draw?

1 more thing sceGuMorphWeight what does this function do interm of skinning
Jabberwocky
Posts: 43
Joined: Wed Aug 03, 2005 6:58 pm

Post by Jabberwocky »

Ok, here's a full description of how skinning works. Each vertex in a model is influenced by a number of bones (matrices), with a weight representing the desired influence of each bone on that vertex. The skinning hardware takes the vertex and translates it by each bone in succession to get several new vertices. The weight of each vertex is then used to blend it with the other verts, resulting in one final vertex.

To actually use the skinning you have to be a bit clever. As mentioned in a previous post, the hardware does not support indexed bones. In other words, if you have 3 bones influencing your vertex, these have to be bones 0-2. This is a pain...

What you need to do is sort your faces based on what bones influence the face (ie. the all bones affecting all verts of the face). Now strip your model based on similar bones -- this minimises bone upload. Before rendering each strip, upload the bones needed to render the strip. If you are clever about your face ordering you should only need to upload 1 or 2 new matrices for each successive strip (the previous bones already having been uploaded). You can also do some other clever optimisation to do with how bones are uploaded (a bit like a bone palette) and pregenerate the whole display list for the skinned character, which is a big speedup. And don't even think about clipping... :o)

There's a lot to juggle about to get the data in the most efficient form, and it's not a problem you can easily get an optimal solution to. However it is easy to get going in the first place, then work on optimising later on. It's actually quite fun... if you're a masochist like me... ;o)
Post Reply