Author Topic: Animated models  (Read 25351 times)

Offline daboo

  • byte
  • *
  • Posts: 2
    • View Profile
Animated models
« on: October 09, 2011, 01:42:09 am »
Hi, first post!

I'm a Blender user and am wondering about model formats which export from that nicely, especially concerning animated characters. For example say I make a character, rig it with a skeleton and key some actions... then what...?

Any guidance and code examples would be good.

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: Animated models
« Reply #1 on: October 09, 2011, 04:14:20 pm »
* export your model and animation to a Bones supported format (for example Ogre3d format)
http://www.ogre3d.org/tikiwiki/Tools%3A+Blender
* convert that to Bones' native format with the scripts provided
* load your model and animation into your application via BonesIO class

Offline bili

  • byte
  • *
  • Posts: 39
    • View Profile
Re: Animated models
« Reply #2 on: December 16, 2011, 01:27:33 am »
Help plz, I got below exception when I try to convert the ogre3d xml to bones format. I used Blender exporter to export the model and mesh to ogre3d.
Code: [Select]
Skeleton created out of jME OGRE skeleton, 18 joints
Exception in thread "main" java.lang.NullPointerException
at raft.jpct.bones.BonesImporter.convertJMEMeshData(BonesImporter.java:438)
at raft.jpct.bones.BonesImporter.importOgre(BonesImporter.java:193)
at raft.jpct.bones.util.JMEOgreImporter.loadGroup(JMEOgreImporter.java:112)
at raft.jpct.bones.util.JMEOgreImporter.loadGroup(JMEOgreImporter.java:88)
at raft.jpct.bones.util.JMEOgreImporter.run(JMEOgreImporter.java:69)
at raft.jpct.bones.util.JMEOgreImporter.main(JMEOgreImporter.java:170)

Grrr I guess it got something to do with my model. Try a few from ogre3d samples, they all converted without even a warning  :o

« Last Edit: December 16, 2011, 01:48:37 am by bili »

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: Animated models
« Reply #3 on: December 16, 2011, 10:09:40 am »
seems as your model does not have texture coordinates. either add it or replace the line 438 in BonesImporter with the following line. i will do it myself tonight or tomorrow

Code: [Select]
if ((mesh.getTextureCoords() == null) || mesh.getTextureCoords().isEmpty()) {

Offline bili

  • byte
  • *
  • Posts: 39
    • View Profile
Re: Animated models
« Reply #4 on: December 16, 2011, 09:51:34 pm »
Thanks! that fixes the null pointer exception error.

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: Animated models
« Reply #5 on: December 16, 2011, 10:15:07 pm »
cool. seems as we were working at the sametime on the project. i've uploaded the corrected version

Offline bili

  • byte
  • *
  • Posts: 39
    • View Profile
Re: Animated models
« Reply #6 on: December 17, 2011, 11:07:56 pm »
could you briefly explain some steps how to create multiple animation like the ninja example in autodesk maya or 3d or whichever modeling software you use plz?


Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: Animated models
« Reply #7 on: December 18, 2011, 02:56:24 pm »
I prepared the model used in animation blend demo in 3dsMax. I used the OgreMx plugin and i suggest it.

Briefly steps are:
* Prepare the model
* Rig it (attach a skeleton to it)
* Animate the model by animating skeleton
* Export model and animation via OgreMax plugin. You can specify in timeline when each animation starts and ends, that's how multiple animations are exported to a single file.

Offline bili

  • byte
  • *
  • Posts: 39
    • View Profile
Re: Animated models
« Reply #8 on: December 18, 2011, 04:19:58 pm »
Many thanks. Your help is much appreciated.

Ahhhh! Is there any other way to create  multiple animation? I got a student version of 3d max but I can't really use it for commercial purpose for this android game im developing.

I got hold of this multiple animation in blender from http://jmonkeyengine.org/groups/graphics/forum/topic/multiple-animations-in-blender/ but  when I tried to convert it to bones.
Code: [Select]
Skeleton created out of jME OGRE skeleton, 60 joints
[ Sun Dec 18 15:40:39 GMT 2011 ] - WARNING: Mesh has no texture coodinates
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 5921
at com.threed.jpct.Object3D.<init>(Unknown Source)
at raft.jpct.bones.Animated3D.<init>(Animated3D.java:120)
at raft.jpct.bones.BonesImporter.importOgre(BonesImporter.java:198)
at raft.jpct.bones.util.JMEOgreImporter.loadGroup(JMEOgreImporter.java:112)
at raft.jpct.bones.util.JMEOgreImporter.loadGroup(JMEOgreImporter.java:88)
at raft.jpct.bones.util.JMEOgreImporter.run(JMEOgreImporter.java:69)
at raft.jpct.bones.util.JMEOgreImporter.main(JMEOgreImporter.java:170)
Any ideas why this happening?

or should I just abandon blender entirely?

Edit: I found this thread  http://www.jpct.net/forum2/index.php/topic,2111.0.html will try things out i guess.

Big Edit: Wooo I'm estatic! Just edit the skeleton.xml from the blender multiple animation above to match some attribute order and edited out sharedgeometric in the ninja demo xml and it works.... >:( Been trying all sort of things and none work hahaha me almost *cry* lool. Cheers.

But everything appears much dark, hardly see the model at all.
« Last Edit: December 18, 2011, 11:30:18 pm by bili »

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: Animated models
« Reply #9 on: December 23, 2011, 02:03:01 pm »
sorry for late answer. somehow i didn't notice your post ???

yes, as you have found out, many single animation files can be merged into one. that should work for both Ogre and Collada files.

I'm not sure about the exeption, do you still get it? if so providing a test case may help.

i can't say abondon Blender, but I can say I really suggest 3dsMax + OgreMax ;)

Offline bili

  • byte
  • *
  • Posts: 39
    • View Profile
Re: Animated models
« Reply #10 on: December 28, 2011, 01:51:16 am »
sorry for late answer. somehow i didn't notice your post ???

yes, as you have found out, many single animation files can be merged into one. that should work for both Ogre and Collada files.

I'm not sure about the exeption, do you still get it? if so providing a test case may help.

i can't say abondon Blender, but I can say I really suggest 3dsMax + OgreMax ;)

Im guessing you're using forum watch, but since I edited my post I dont think it will trigger the thread email update...just a guess.

I edited few attributes from the xml file  that cause the Exception to match the ninja model so it gone away now. However the model appears to be very dark. I can hardly see it! I guess it's cause by me playing with the XML attributes.

i wished I could use 3dsMax+OgreMax but I'm more efficient and comfortable with Blender so I will stick to it for now. Cheers.

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: Animated models
« Reply #11 on: December 28, 2011, 11:10:57 am »
i won't suggest modifying xml files manually.

i can't think of any xml property causing a dark scene. maybe you changed light settings or have a very dark texture?

Offline bili

  • byte
  • *
  • Posts: 39
    • View Profile
Re: Animated models
« Reply #12 on: December 28, 2011, 01:17:40 pm »
Yes, that is plausible. I will check.

I didn't really edit the xml files but more like swapping the attributes order to make it similar to the ninja model xml.

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: Animated models
« Reply #13 on: December 28, 2011, 01:37:49 pm »
while playing with values, i've faced the dark scene you mentioned too. it was caused by the absence of texture coordinates.