• Advertisement
Sign in to follow this  

Need a tip to load biped animation

This topic is 2051 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,

I want to load a character animation from a 3ds max. I'm capable to export transformation based animations (when objects are translated/rotated) into my engine. However in this case there is a mesh of the character which is put on top of the animated skeleton.

With my current techniques of exporting/importing I get the skeleton animated in my engine, but the actual character is not.

What is the technique to make my character to animate instead? Do I need to do some calculations in my engine, or there is more information to grab from 3ds max to make that happen?

Thank you,
Ruben

Share this post


Link to post
Share on other sites
Advertisement
[quote name='RobMaddison' timestamp='1337629755' post='4941994']
Google or search GD for skinning, hardware skinning or GPU skinning - there are hundreds of great sites to help with this
[/quote]

At this point I'd like to do that on a CPU. Later on might consider doing that on a GPU. Came across this article: [url="http://software.intel.com/file/25267"]http://software.intel.com/file/25267[/url] .
Is it good enough? The basic idea is to multiply the vertex by transformation matrix of the bone and the weight coefficient. Am I going in the correct direction?

Also, how can I pull the information about vertex coefficients from 3ds max? I'm currently using a special 3ds max script that exports the model and transformation animations from the model into my internal format.

Thank you!

Share this post


Link to post
Share on other sites
[quote name='rubenhak' timestamp='1337635377' post='4942011']
The basic idea is to multiply the vertex by transformation matrix of the bone and the weight coefficient. Am I going in the correct direction?
[/quote]
Yes, this is the right direction. In general the movment of a vertex depends upon a number of bones (max 4 bones in games is quite common) . How much it depends on the bone is described by the weight, whereas the weights of each vertex sums up to 1. A simple example:
[CODE]
A vertex near the neck depends on the neck, left_shoulder,right_shoulder and spine bone. The weights could look like this:
weight_neck = 0.3
weight_spine = 0.2
weight_left_shoulder = 0.25
weight_right_shoulder = 0.25
Each bone is associated with a transformation matrix, the final vertex position is calculated this way:
final_vertex =
(neck_bone_transformation * vertex) * 0.3 +
(spine_bone_transformation * vertex) * 0.2 +
(left_shoulder_bone_transformation * vertex) * 0.25 +
(right_shoulder_bone_transformation * vertex) * 0.25;
The X_bone_transformation matricies are actually animated (interpolation between two key frames).
[/CODE]

To get this information from max, you should export to a format which supports this, i.e. collada or FBX.

But be aware, getting animation running is not trivial, the basic idea is simple, but there're many pitfalls and debugging hours ahead of you [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]

Share this post


Link to post
Share on other sites
Ashaman73, for optimization purposes could I do the vertex multiplication only once like this:?
[CODE]
final_vertex =
( neck_bone_transformation * 0.3 +
spine_bone_transformation * 0.2 +
left_shoulder_bone_transformation * 0.25 +
right_shoulder_bone_transformation * 0.25 ) * vertex;
[/CODE]

I'm thinking about writing a max script to export that information into a proprietary format and my engine would load that. That way I would not need to deal with other formats.

At this point I've got the animation of the skeleton loaded into my engine. I just need to animate my object based on that. With this approach I would not be able to benefit from VBO if I decide to perform caculations on the CPU, right?

Share this post


Link to post
Share on other sites
[quote name='rubenhak' timestamp='1337714273' post='4942301']
Ashaman73, for optimization purposes could I do the vertex multiplication only once like this:?
[/quote]
You need to consider, that the transformations are matricies (4 vectors) , but matrix-scalar multiplication is commutative and matrix multiplication distributive, therefore you can rewrite the code for better performance.

[quote name='rubenhak' timestamp='1337714273' post='4942301']
I'm thinking about writing a max script to export that information into a proprietary format and my engine would load that. That way I would not need to deal with other formats.
[/quote]
Better to take a known export format like FBX/collada and write a converter between export file and your binary file. This way you can easily support other modelling tools like blender or maya.

[quote name='rubenhak' timestamp='1337714273' post='4942301']
At this point I've got the animation of the skeleton loaded into my engine. I just need to animate my object based on that. With this approach I would not be able to benefit from VBO if I decide to perform caculations on the CPU, right?
[/quote]
The bone interpolation should be done on the CPU, the vertex transformation on the GPU. Edited by Ashaman73

Share this post


Link to post
Share on other sites
[quote name='Ashaman73' timestamp='1337751251' post='4942441']
Better to take a known export format like FBX/collada and write a converter between export file and your binary file. This way you can easily support other modelling tools like blender or maya.
[/quote]
I've already got a MAXScript that exports from 3ds max to an intermediate format which my engine consumed. It already exports transformation based animations. I've enhanced it to export vertex weights for skinned meshes and everything worked like a charm. Follow this article if somebody would need a similar thing: [url="http://www.gamedev.net/topic/567949-maxscript-getting-vertex-weights/"]http://www.gamedev.net/topic/567949-maxscript-getting-vertex-weights/[/url]. I had some troubles with "Physique" modifier and could not manage to extract weights from it, but found a utility that converts "Physique" to "Skin" modifier which is a lot simpler to export.

[quote name='Ashaman73' timestamp='1337751251' post='4942441']
The bone interpolation should be done on the CPU, the vertex transformation on the GPU.
[/quote]
Currently do everything with CPU. How would I calculate vertex transformations on GPU?
I can have about 30-40 bones, should I need to have those bone information loaded into the shader?
Isn't there a limitation on the amount of input data the at the shader can accept?

Share this post


Link to post
Share on other sites
[quote name='rubenhak' timestamp='1339121564' post='4947245']
[quote name='Ashaman73' timestamp='1337751251' post='4942441']
The bone interpolation should be done on the CPU, the vertex transformation on the GPU.
[/quote]
Currently do everything with CPU. How would I calculate vertex transformations on GPU?
[/quote]
You load the bone transformation matrices as uniforms into the vertex shader, and perform the per-vertex skinning computation there.
[quote name='rubenhak' timestamp='1339121564' post='4947245']
I can have about 30-40 bones, should I need to have those bone information loaded into the shader?[/quote]
load as an array of uniform matrices.
[quote name='rubenhak' timestamp='1339121564' post='4947245']
Isn't there a limitation on the amount of input data the at the shader can accept?
[/quote]
Yes, but that will depend on the make/model of the GPU used.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement