Importing Animations from Blender 2.62 using ogre XML: Things to check if you are getting problems

Updated (June 1st 2012): Fix points 1 and 2.



I’ve been working on import a model with animations into jMonkey. During this process I’ve experienced the same common problems that a lot of people had when they are working with animations on jMonkey (mesh twisted, animation deform the mesh in a wrong way, etc).



I saw that there are several topics about animations problems on the forum and I recolected some tips that helped me to solve my animation’s problems. Thank you for your help by the way :wink:



I thought that it’s a good idea to put all those tips that are scattered on the forum in one place (Perhaps these tips can be move to the documentation section. Feel free to do it if you consider these tips correct and add more tips also).



1.- Apply Location, Rotation and Scate to the mesh on Blender: On 3D View editor on Blender, select the mesh in Object Mode and go to the 3D View Editor’s header → Object Menu → Apply → Location / Rotation / Scale.

2.- Apply Location, Rotation and Scate to the armature on Blender: On 3D View editor on Blender, select the armature in Object Mode and go to the 3D View Editor’s header → Object Menu → Apply → Location / Rotation / Scale.

3.- Set the mesh’s origin point in the bottom of the mesh (see the images bellow).

4.- Set the armature’s origin point in the bottom of the armature (see the images bellow).

5.- Armature’s origin point and mesh’s origin point must be in the same location(see the images bellow).

6.- Use a root bone located in the armature’s origin. This root bone must be in vertical position (see the images bellow) and it is the root bone of the armature. If you rotate the root bone, the the entire armature might be rotate when you import the model into jMonkey (I’m just mentioning the result, I don’t know where is the problem (jmonkey importer or blender’s ogre exporter plugin)).

7.- Uncheck “Bone Envelopes” checkbox on the Armature modifier for the mesh (see the images bellow).

8.- Uncheck “Envelopes” checkbox on the armature (see the images bellow).

9.- User SkeletonDebugger to show the skeleton on your game in order to check if the mesh and the skeleton are loaded correctly:

[java]

final Material soldier2Mat = assetManager.loadMaterial(“Materials/soldier2/soldier2.j3m”);

final Spatial soldier2 = assetManager.loadModel(“Models/soldier2/soldier2.j3o”);

TangentBinormalGenerator.generate(soldier2);

soldier2.setMaterial(soldier2Mat);



final Node soldier2Node = new Node(“Soldier2 Node”);



soldier2Node.attachChild(soldier2);

rootNode.attachChild(soldier2Node);



final AnimControl control = soldier2.getControl(AnimControl.class);

control.addListener(this);

final AnimChanel channel = control.createChannel();



final SkeletonDebugger skeletonDebug = new SkeletonDebugger(“skeleton”, control.getSkeleton());

final Material mat = new Material(assetManager, “Common/MatDefs/Misc/Unshaded.j3md”);

mat.setColor(“Color”, ColorRGBA.Green);

mat.getAdditionalRenderState().setDepthTest(false);

skeletonDebug.setMaterial(mat);

soldier2Node.attachChild(skeletonDebug);

[/java]















These two videos are very useful too. They show how to set the animation name.

blender to jme3 though ogre XML

Animations in Blender 2.61 and JME3



I downloaded the model from blendswap. I changed this model to use only one material with difusse, normal and specular textures.



On blenderguru you can find a complete Introduction to Rigging Tutorial made by Lee Salvemini (the page is not working right now, but it should by online in short period of time).



I hope this can help for the new people.



H

10 Likes

Nice, thanks for the time and effort in putting this all together! This is definitely a candidate for a wiki page :slight_smile:

1 Like

Yeah, cool, thanks!

1 Like

I made a wiki page from this: https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:external:blender It could still contain some more information about texture mapping etc. (no complaint to you @H, this is exactly the stuff we need) Maybe we can make similar pages for separate modeling tools as people looking for such information don’t really want a lot of general info woven into it I guess, we can keep that centrally in another place.

2 Likes

Thank @normen and @sbook

I’m glad to help to the comunity.

1 Like

very nice, thank you!

1 Like

@H



Thanks :slight_smile:

And it would be nice if you added what normen are saying, some texture mapping/uv.

1 Like
@staugaard said:
And it would be nice if you added what normen are saying, some texture mapping/uv.

...well that info is also on this site, so anybody could extend it... :)
1 Like

Hi @staugaard

I’ll post some images showing the materials and textures applied to the model next week (I’m not at home this weekend (today -friday- is national holiday in Argentina, so it is a long weekend :D).

1 Like

@wezrule: thank you!

Hi @staugaard:

On blender, the model has one material with 3 textures: diffuse, specular and normal. To know more about materials, textures and uv mapping check Blender cgcookie, there are a lot of very good video tutorials.



This is the material that I use on jm3:

[java]Material soldier2 : Common/MatDefs/Light/Lighting.j3md {

MaterialParameters {

DiffuseMap : Textures/soldier2/textura cor-2.png

SpecularMap : Textures/soldier2/textura specular.png

NormalMap : Textures/soldier2/textura normal.png

VTangent : true

HighQuality : true

Shininess : 0.5

}

AdditionalRenderState {

}

}[/java]



3 Likes

Hi H,

Nice tips, Which version of blender2ogre exporter did you use : 0.5.5 or 0.5.6preview7 or 0.5.6preview8 ?



thanks for sharing



eriqadams

1 Like

Wow, very well done job! Thx!

1 Like

Yeah thanks, gotta update the wiki with these. If anyone wants to do it, I don’t think I’ll have time during the day :wink: Just remember to actually upload the images to the wiki as else they won’t appear in the SDK manual. :smiley:

1 Like

@H



Thanks :slight_smile:

1 Like

@eriqadams, @duodecimo: Thanks!

@eriqadams: I’m using VERSION = ‘0.5.4’ of blender2ogre exporter. It’s the version that is included in jm3 beta release I think. Blender version: 2.62 (64bits).



@normen @staugaard Thanks again!

1 Like

Very helpful - Will definitely help many others!



Thank you @H

1 Like

More things to check (for a very amateur blender designer as me) - ensure that you have set transform orientation for global.



I have a big question. Is manual copy-paste on animations essential? Is there any workaround with blender and ogre exporter?

1 Like

Hi @ayvango

First of all, sorry to answer you so late.

What do oyu mean with “manual copy-paste on animations”?

When I animate a model in blender, I turn on “automatic key frame insertion” button. I use copy pose, copy x-flipped pose and paste pose also.

1 Like

You had opened ogrexml files that contains animations and had copied animation from one file to another.



I have same problem: all tracks are identical. I have to export same file many times. And then merge animations within ogrexml. It is quite bothersome if you had many animation tracks.



Is there a workaround for the exporting problem?

1 Like

I added the material images to the wiki if anyone wants to extend the page:

https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:external:blender

1 Like