spiralsmile

02-17-2003, 04:01 AM

when weighting bones(transforms) in Matrix Pallete Skinning, must the sum of the bones weights be equal to one?

I've being using nvidias vertex progs and am up to three boned skinning but if the weights dont add up to one eg

w1 = 0.25

w2 = 0.25

w3 = 0.75

sum = 1.25

there is a scaling effect on parts of my model?! has anyone noted this

also what is the maximum number of weighted matrices that can affect one vertice NVs example only goes up to 4 is it possible to go to say 8 or 10 etc. and how might i go about doing this

SORRY FOR _all_ the questions hope someone can help

cheers

tony

Devulon

02-17-2003, 05:15 AM

Originally posted by spiralsmile:

[B]when weighting bones(transforms) in Matrix Pallete Skinning, must the sum of the bones weights be equal to one?

Absolutely not. The weights can be whatever you want (of course). Of course the effect can be quite different depending on the information in the matrices.

I've being using nvidias vertex progs and am up to three boned skinning but if the weights dont add up to one eg

w1 = 0.25

w2 = 0.25

w3 = 0.75

sum = 1.25

there is a scaling effect on parts of my model?! has anyone noted this

I haven't actually used any of nvidia's vp code to do matrix palette skinning but I have seen it and wouldn't think that would cause any weird scaling problems. But weights that don't sum to 1 can cause problems if there is a scale in any of the matrices. Think about the math and it should make sense. Technically it affects translation and rotation too but with "less artifacts and weird effects." Most skinning matrices don't contain and non-uniform scaling. And even if the scaling is uniform its usually implied to be even through all the bones, it just makes more sense to have to scale the entire skinned object. In either case look at the way you export 3dsmax Character Studio models. You actually have to decomp the node matrices to remove the nonuniform scale. The weird scaling on nodes is used to set up the skeleton but the scale is not actually used while animating the skeleton. The scale just shapes the bones and modifies the envelopes which changes the way the weights are assigned to the vertices. So basically in general there shouldn't be any scale other than 1 of course in the matrices. Of course I am not sure of exactly what you are doing so I don't know what the problem really is, I'm just trying to give you some ideas to think about.

also what is the maximum number of weighted matrices that can affect one vertice NVs example only goes up to 4 is it possible to go to say 8 or 10 etc. and how might i go about doing this

If you are using the matrix palettes in either DirectX or opengl/nvidia_extension i think the limit is 4 but don't quote me. There is a limit though. In vertex programs the limit really tends to be how many matrices you can store in registers and the number of instructions you can do. There is a specific limit. Of course you loose instructions to lighting and things of that nature depending on what else you are doing besides the skinning.

Have fun and don't hurt yourself.

Devulon

spiralsmile

02-17-2003, 06:24 AM

at the moment i am only trying to influence a simple set of quads(6 in a row), by giving each vertice a weight relevant to each matrice as i want them affected.

I think you are right about the scaling effect!

since i am only using 3 matrices that i have specified manually there is a scale in one of the matrices which is just getting multiplied up /down bt the weights.

the matrices i specified manually are being loaded them into const registers in the vp like this

for (int k = 0; k < 3; ++k)

{

// build the rows...

col[0] = *(bone_ONE + k);

col[1] = *(bone_ONE + 4 + k);

col[2] = *(bone_ONE + 8 + k);

col[3] = *(bone_ONE + 12 + k);

glProgramParameter4fvNV( GL_VERTEX_PROGRAM_NV, 8 + k, col );

}

where bone one is a matrice like this

float bone_ONE[16] = {1,0,0,0, 0,1,0,0,

0,0,1,0,

0,-.2,0,1

};

then reloading them with updated values for each frame.

Im using the following vertex program

// "# We transform the offset by bone one's tranform"

"DP4 R0.x, c[8], v[OPOS];"

"DP4 R0.y, c[9], v[OPOS];"

"DP4 R0.z, c[10], v[OPOS];"

"DP4 R0.w, c[11], v[OPOS];"

//"# We multiply the transformed offset by the weight"

"MUL R0.xyz, R0, v[WGHT].x;"

//"# We transform the offset by bone two's tranform"

"DP4 R2.x, c[12], v[OPOS];"

"DP4 R2.y, c[13], v[OPOS];"

"DP4 R2.z, c[14], v[OPOS];"

"DP4 R2.w, c[15], v[OPOS];"

//"# We multiply the transformed offset by the weight"

"MAD R0.xyz, R2, v[WGHT].y, R0;"

where the wights are given by a glVertexAttrib4fNV call

such as this one

glVertexAttrib4fNV(1, 0.75, 0.25, 0, 0);

this isnt very efficent (and i'm not entirely sure its right! if some one might have a look),but i'm tring to understand MPS at a low level as i need to explain it in my thesis!

cheers Devulon for the help.

ps do you (or anyone!) know of any tutorials or even just sample code by any chance that might explain MPS better than NVs example

it just i'm tring to really get to grips with it and want to fully understand it both from my own experiences and from someone elses perspective of it.

[This message has been edited by spiralsmile (edited 02-17-2003).]

Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.