Jump to content

  • Log In with Google      Sign In   
  • Create Account


Need a tip to load biped animation


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 rubenhak   Members   -  Reputation: 154

Like
0Likes
Like

Posted 21 May 2012 - 11:53 AM

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

Sponsor:

#2 RobMaddison   Members   -  Reputation: 642

Like
0Likes
Like

Posted 21 May 2012 - 01:49 PM

Google or search GD for skinning, hardware skinning or GPU skinning - there are hundreds of great sites to help with this

#3 rubenhak   Members   -  Reputation: 154

Like
0Likes
Like

Posted 21 May 2012 - 03:22 PM

Google or search GD for skinning, hardware skinning or GPU skinning - there are hundreds of great sites to help with this


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: http://software.intel.com/file/25267 .
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!

#4 Ashaman73   Crossbones+   -  Reputation: 6939

Like
2Likes
Like

Posted 21 May 2012 - 11:33 PM

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?

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:
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).

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 Posted Image

#5 rubenhak   Members   -  Reputation: 154

Like
0Likes
Like

Posted 22 May 2012 - 01:17 PM

Ashaman73, for optimization purposes could I do the vertex multiplication only once like this:?
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;

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?

#6 Ashaman73   Crossbones+   -  Reputation: 6939

Like
1Likes
Like

Posted 22 May 2012 - 11:34 PM

Ashaman73, for optimization purposes could I do the vertex multiplication only once like this:?

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.

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.

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.

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?

The bone interpolation should be done on the CPU, the vertex transformation on the GPU.

Edited by Ashaman73, 23 May 2012 - 02:02 AM.


#7 rubenhak   Members   -  Reputation: 154

Like
0Likes
Like

Posted 07 June 2012 - 08:12 PM

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.

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: http://www.gamedev.net/topic/567949-maxscript-getting-vertex-weights/. 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.

The bone interpolation should be done on the CPU, the vertex transformation on the GPU.

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?

#8 RobTheBloke   Crossbones+   -  Reputation: 2325

Like
0Likes
Like

Posted 08 June 2012 - 09:26 AM


The bone interpolation should be done on the CPU, the vertex transformation on the GPU.

Currently do everything with CPU. How would I calculate vertex transformations on GPU?

You load the bone transformation matrices as uniforms into the vertex shader, and perform the per-vertex skinning computation there.

I can have about 30-40 bones, should I need to have those bone information loaded into the shader?

load as an array of uniform matrices.

Isn't there a limitation on the amount of input data the at the shader can accept?

Yes, but that will depend on the make/model of the GPU used.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS