Right assuming you are using vertex program version 1-1.
And that the code is optimised as it can be (feel free to correct me)
Is the maximum number of bones to be loaded into the const table ie the matrix palette 30?
i made this caculation by
Now remebering there is a limit of 128 instructions in this version (1-1) of vertex programs:
Each bone requires 9 instructions to process if i use a vertex program like this one
Load the matrix index for mat0
ARL A0.x, v[TEX0].x;
We transform the offset by bone one’s tranform
DP4 R0.x, c[A0.x + 8], v[OPOS];
DP4 R0.y, c[A0.x + 9], v[OPOS];
DP4 R0.z, c[A0.x + 10], v[OPOS];
We multiply the transformed offset by the weight
MUL R0.xyz, R0, v[WGHT].x;
We transform the normal offset by bone one’s tranform
DP3 R1.x, c[A0.x + 8], v[NRML];
DP3 R1.y, c[A0.x + 9], v[NRML];
DP3 R1.z, c[A0.x + 10], v[NRML];
We multiply the transformed normal offset by the weight
MUL R1.xyz, R1, v[WGHT].x;
Load the matrix index for mat1
ARL A0.x, v[TEX0].y;
We transform the offset by bone two’s tranform
DP4 R2.x, c[A0.x + 8], v[OPOS];
DP4 R2.y, c[A0.x + 9], v[OPOS];
DP4 R2.z, c[A0.x + 10], v[OPOS];
We multiply the transformed offset by the weight
MAD R0.xyz, R2, v[WGHT].y, R0;
We transform the normal offset by bone two’s tranform
DP3 R3.x, c[A0.x + 8], v[NRML];
DP3 R3.y, c[A0.x + 9], v[NRML];
DP3 R3.z, c[A0.x + 10], v[NRML];
We multiply the transformed normal offset by the weight
MAD R1.xyz, R3, v[WGHT].y, R1;
… keep going for mat2 and mat3…
then load up mat4…
Load the matrix index for mat1
ARL A0.x, v[TEX1].x;
We transform the offset by bone two’s tranform
DP4 R2.x, c[A0.x + 8], v[OPOS];
DP4 R2.y, c[A0.x + 9], v[OPOS];
DP4 R2.z, c[A0.x + 10], v[OPOS];
We multiply the transformed offset by the weight
MAD R0.xyz, R2, v[COL0].x, R0;
We transform the normal offset by bone two’s tranform
DP3 R3.x, c[A0.x + 8], v[NRML];
DP3 R3.y, c[A0.x + 9], v[NRML];
DP3 R3.z, c[A0.x + 10], v[NRML];
We multiply the transformed normal offset by the weight
MAD R1.xyz, R3, v[COL0].x, R1;
…and so on and so forth…until the last bone
set the vertex w to 1.0
SGE R0.w, R1, R1;
normalize(R1) → R1
DP3 R1.w, R1, R1;
RSQ R1.w, R1.w;
MUL R1, R1, R1.w;
Still needs to be projected…
DP4 o[HPOS].x, c[0], R0;
DP4 o[HPOS].y, c[1], R0;
DP4 o[HPOS].z, c[2], R0;
DP4 o[HPOS].w, c[3], R0;
DP3 R3, c[5], R1; # light position DOT normal
MUL o[COL0].xyz, R3, c[4];
END