PDA

View Full Version : Skinning on the GPU



Obah
02-09-2005, 07:50 AM
Hi there,
I'm working on a school project which is to create a game, I have successfully implemented smooth skinned animation (with the max of 4 bones/joints) I now want to off load some computations to the GPU, my question however is in regards to the best way to send data to the GPU. Right now I was testing using attribute variables but I have a very limited amount of those available (16). Is it bad to send uniform variables over constantly? My new idea was to send all of the bones/joints for each character (~300 matrices total) then index them in the vertex shader. Is that too much to be sending over? I guess I'm just looking for a little insight, any help would be appreciated. Thanks!

Relic
02-09-2005, 08:01 AM
Yes, that's too much. There is a limited amount of uniforms, e.g. 96 * vec4.
Here's an idea, if you're on a GeForce 6xxx board, you could use a floating point texture to store your matrices and access it in the vertex shader.

Korval
02-09-2005, 12:48 PM
(~300 matrices total)300 matrices is a lot. How do you have so many bones in a model?

In any case, the number of uniforms is limited. ARB_vp and ARB_vertex_shader provides querries to get the number of uniforms available, but these are hardware-dependent. Early vertex shader hardware (GeForce 3/4) only had 96 4-vector floats, while more modern ones have up to 256.

Obah
02-09-2005, 01:45 PM
Thanks for the replies, and to answer the ~300 matrices question, there is 16 characters in the game, all unique and with about 20 bones per character on average, so 16*20 = 320. Thanks again, I think I am going to take the route of storing some information in a texture.

Relic
02-09-2005, 11:25 PM
Mind that GeForce 6xxx are the only ones which can access textures in a vertex shader, and they need to be floating point.

harsman
02-10-2005, 02:27 AM
Well, since each character only has 20 bones, why don't you just upload the uniform data correpsonding to each character before rendering it? It might be more expensive than the vertex texture approach (key word is might, watch out for vertex texture fetch latency) but it works on more hardware.