Exporting armature animation using genmesh

From Blender2crystal

Jump to: navigation, search

Contents

[edit] Introduction

character already created
character already created

This tutorial is about setting properties that allow to export a blender mesh animated by an armature into a crystalspace genmesh animated by skeleton.

For this it is assumed you already know how to create and model the mesh, parent to an skeleton, rig and animate, if this is not the case there are very good blender tutorials on this, so you should first check those.

We will start with the following:

  • The mesh is modelled, rigged and parented to an armature.
  • Note the rigging must be in vertex groups, not envelopes, if you have the second, take a look at limitations section a bit later for advice.
  • The armature has several actions, each will be exported as an action for the skeleton.

Ok, this is the basic stuff, once that's done we now need to assign several properties using blender2crystal so it will export correctly, this will be explained in detail in the tutorial, but as a resume we have to do the following:

  • Set the mesh for the object to genmesh
  • Possibly set cycle on some of the actions.

[edit] Current limitations

First of all you must know about b2cs limitations when exporting such genmesh animated by skeleton. As genmesh skeletal animation is fairly new in crystalspace there is still some work to do that results in the current limitations.

  • Rigging must be in vertex groups, not envelopes. If you have the second just bake it: How to bake envelopes to vertex groups
  • Mesh must be parented to the armature, using a modifier without parenting doesnt work at the moment.
  • Lighter2 will bork your skeletons. You either need to disable lighter2, or patch your cs version with the following file: lighter2.diff (note this is obviously not supported by cs devs, but works :D).
type set to genmesh in the mesh
type set to genmesh in the mesh

[edit] Setting the type to the meshobj

Well, as a keen reader might have noticed by now, this is talking about genmesh animated by armatures.

This means other object types wont export the animation, or wont result in an skeleton in crystalspace (like spr3d), so first thing to do is to go to the info tab (Image:Icons-info.png) for the object and change the type to genmesh (the default is thing).

This is the only option at the moment for objects animated by armatures.

Note there is another supported meshtype in crystalspace for skeletal animation called sprcal3d, but blender2crystal does not support it directly, so the method to include this is a little different (there is a cal3d meshtype in blender2crystal, but it is for including an already exported cal3d mesh and will ignore the actual geometry from the object you assign it to and use some properties to find the cal3d cfg file. You can read more on this on the Object Type Reference).

[edit] Creating a material

material info for the character
material info for the character

Ok. Now you have a genmesh, although optional it is useful to create a material in the blender mesh if you don't have one already. You can do this from blender's material window. This way you can then control shader properties for the character or set bumpmap if using a renderloop with light iteration (most but standard).

For starters you dont need anything special in this material, but you can check the b2cs material tab (Image:Icons-material.png) as there is something to note there:

  • The shader appears as std_character2. This means b2cs detected this is a genmesh parented to an armature, and so you dont need to set the shader, even more, it is not recommmended to set it manually as when changing the renderloop a different shader must be used, and you'd have to change shader in all materials for animated genmesh.

[edit] Export and see the result

result in crystalspace
result in crystalspace

Ok, this is it. You can export your character already and see the result in crystalspace. Note you dont need to bake animation or any such practices.

The character should be animated, but maybe you dont reach to see it moving, this is because we didnt specify any kind of cycle for the animations, neither did we set an specific animation to play. So what happened is a random animation run only once.

[edit] Setting cycle for the animations

An animation will export as cyclic animation when any of the ipo curves for the bones is set to Cyclic extend mode. To do this go to the ipo window with the armature selected. Once there select the pose ipos, select any curve and in the menu select Curve->Extend Mode->Cyclic. You may need to have the armature also in pose mode, and some bone selected.

Note if any of the curves has extend mode set in this way the full action will be exported as cyclic for crystalspace.

[edit] Properties for the object

Now there is one property for the mesh (at b2cs object properties tab Image:Icons-object.png) that is interesting, this is the animatefirst property. By default it is set to True, and this means the first animation exported will also be set initially on the mesh. In some cases you might want to set this to False (and so the object will be initially static).

[edit] Properties for the armature

armature properties
armature properties

Now selecting the armature and going to the b2cs object properties tab (Image:Icons-object.png) you can see there is one property there: actions. Here you can specify a list of actions you want to export for the mesh, note the first action you specify will be set to the mesh initially as seen in the previous section.

You specify the actions as a comma separated list of action names as seen in the screenshot on the left. You can ignore the animatefirst property as it does not exist here anymore (its now on the genmesh itself as seen previously).

Personal tools
Documentation