- December 3, 2009 at 2:03 pm #29996
I want to render skinned animated meshes without using matrix palettes
(not to improve performance, but to enable skinning on more mobile devices).
Therefor I have to transform the vertices and normals with the according
bone matrix by hand at cpu level.
My current approach would be to compute the bone matrices for the entire
model and store them in a matrix vector. In a second pass I would run
through the whole interleaved vector and multiply each vertex and normal vector
with the according matrix.
For doing so I need the mapping between the vertex data and the according bone/weight. As far as I understood the bone indices refer to the matrix palette of
the current bone batch and not to the node index of the bone or am I confusing something?
Any hint about how to interprete the direct mapping of vertices and bone nodes in
the pod file would be appreciated.
lukasDecember 3, 2009 at 6:33 pm #33571
If you want to do software skinning then you are much better off exporting your models without bone batching altogether.December 3, 2009 at 6:46 pm #33572
Actually, looking at the code again … you can easily map bone indices to POD nodes by iterating over
pnBatches member of the CPVRTBoneBatches class.
These values map directly into pod node index.
Someting like this:
nodeid = mesh->sBoneBatches.pnBatches[currentindex];
and then :
SPODNode *node = &scene.pNode[nodeid ];
where the SPODNode instance is a logical equivalent of your single matrix in the array.December 4, 2009 at 1:45 pm #33573
so what I’ll do is to create a cached mapping for each bone batch and its associated triangles into the interleaved vertex vector. Then the “currentindex” from the bone index should map correctly into my cpu matrix palette computed from for each bone.
lukasDecember 4, 2009 at 3:35 pm #33574
Yeah, but as I said, if you are doing software skinning then , if you can help it , make sure that whatever exporter you are using , is putting all bones into a single batch.
Since you are not using GPU hardware you are not bound by its limitations and there is no need to create multiple batches because that will only slow you down.