I would like to point out some features so it was easier or at least, i think so, and check how posible would that be.
The current system uses the bones as the structures to store the meshbuffer ID, vertex ID and the weights, it reads the aprpriate meshbuffer, and builds one mesh for the rendering on the fly. the meshbuffer is then rendered as always using a normal material. While 100% flexible, this ends being slow on multiple ways, because:
- the mesh is built per frame
- it is transformed on the CPU
- and it is sent per frame to the video card.
The solution to the problems of the skinned meshes rely:
- on the ability to store the vertex influence on the mesh, and take it from the bones
- to be able to split the amount of bones that affect a single meshbuffer
- to be able to store statically the meshes on the video card
- and send to the meshbuffers only the necesary bone matrices.
The point here is that the bone influences shouldn't be the ones from the original animated mesh, but from a reduced set which was associated to the meshbuffer that contains the vertex. Why? because the amount of bones would be limited otherwise, either using the fixed function palleted skinning, or a shader based approach, the amount of matrices that can be used here is limited. hence, there is need for a new type of hardware friendly meshbuffer in which there was a limited set of matrices that referenced the animations of the original mesh, and that these matrices were available for the meshbuffers to render using either a shader or a paletted skinning system.
Then, for the animation system, it would be necesary to store the bone transformation matrices after they were animated, and the rendering would use them.
This would solve everything:
- the mesh building process would be done on rendering time, and the CPU overhead for mesh creating/deleting would be avoided.
- It would help to move the whole vertex transformation process to the video card, gaining speed
- and finally, the mesh could be static, so there would be no need to send it multiple times, saving bandwidth.