PDA

View Full Version : vertex program question (relative adressing and matrices)



Chuck0
07-13-2003, 02:22 PM
hi
i have searched quite a bit around but im afraid i didnt find what i was looking for, so ill post my question here...

im trying to do skinning in my vertex program and thus i need to load the bone matrices that affect the vertex. im trying this by using a generic attribute for each vertex which stores the matrix indices. my problem is now loading only those matrices.
i have tried it this way:

ATTRIB iMatrInd=vertex.attrib[6];

ADDRESS matrInd;

ARL matrInd, iMatrInd.x;
PARAM skin0[4]={state.matrix.program[matrInd]};
ARL matrInd, iMatrInd.y;
PARAM skin1[4]={state.matrix.program[matrInd]};
ARL matrInd, iMatrInd.z;
PARAM skin2[4]={state.matrix.program[matrInd]};
ARL matrInd, iMatrInd.w;
PARAM skin3[4]={state.matrix.program[matrInd]};

but it seems that i cant use relative adressing this way (get the error string that is telling me that the program matrices limit is exceeded).
so do i have to load all matrices and do the relative adressing later, and if thats the case how can i load all state.matrix.program matrices into one PARAM array?

[This message has been edited by Chuck0 (edited 07-13-2003).]

jwatte
07-13-2003, 03:24 PM
I would suggest doing the DP3/DP4 with the address register directly. This means that the matrix index must be multiplied by 3 (or 4, if you wastefully use a 4x4 instead of a 4x3). Treat each matrix row (or column, depending on your preference) as a separate 4-component register.

Chuck0
07-13-2003, 04:39 PM
thx for the answer
i already figured out how to load all the matrices into one program pameter and now it works quite well.

and i guess ill really only use 4x3 matrices now that you mention it http://www.opengl.org/discussion_boards/ubb/smile.gif