Author Topic: "Number of vertices differ" for 2 meshes with one skeleton  (Read 2418 times)

Offline kkl

  • float
  • ****
  • Posts: 291
    • View Profile
"Number of vertices differ" for 2 meshes with one skeleton
« on: October 05, 2015, 05:06:29 pm »
Hi raft,

I got this error message when converting ogre xml to bones. The 2 objects in Blender and the objects are sharing the same skeleton. What actually caused this error, since 2 objects are suppose to be different in their number of vertices and sharing the same skeleton? Did I miss anything when i separate the object into 2 with sharing skeleton?

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1971
    • View Profile
    • http://www.aptalkarga.com
Re: "Number of vertices differ" for 2 meshes with one skeleton
« Reply #1 on: October 05, 2015, 05:18:28 pm »
can you please post the stack trace?

Offline kkl

  • float
  • ****
  • Posts: 291
    • View Profile
Re: "Number of vertices differ" for 2 meshes with one skeleton
« Reply #2 on: October 06, 2015, 02:41:00 am »
Sure. Here's the stack trace:

Code: [Select]
Exception in thread "main" java.lang.IllegalArgumentException: Number of vertices differ!
        at raft.jpct.bones.SkinData.checkAlmostEqual(SkinData.java:63)
        at raft.jpct.bones.Animated3D.mergeAnimations(Animated3D.java:607)
        at raft.jpct.bones.AnimatedGroup.mergeAnimations(AnimatedGroup.java:368)
        at raft.jpct.bones.util.JMEOgreImporter.loadGroup(JMEOgreImporter.java:95)
        at raft.jpct.bones.util.JMEOgreImporter.run(JMEOgreImporter.java:69)
        at raft.jpct.bones.util.JMEOgreImporter.main(JMEOgreImporter.java:170)

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1971
    • View Profile
    • http://www.aptalkarga.com
Re: "Number of vertices differ" for 2 meshes with one skeleton
« Reply #3 on: October 06, 2015, 09:26:21 am »
seems as you are providing multiple input files to ogre importer script. in that case script assumes you are trying to merge multiple animation files. animations can only be merged if they have the same skeleton and mesh.

possibly this is not what you want, you want objects merged into a group, not animations merged. you should be able to export 2 obejcts at the same time from your editor. it's possible with OgreMax.

Offline kkl

  • float
  • ****
  • Posts: 291
    • View Profile
Re: "Number of vertices differ" for 2 meshes with one skeleton
« Reply #4 on: October 06, 2015, 09:42:17 am »
Quote
possibly this is not what you want, you want objects merged into a group, not animations merged.
Yup, you are right. I just want the 2 objects to be in one AnimationGroup but share the same skeleton. I'm able to export 2 objects out of Blender, 2 mesh xml and 2 skeleton xml respectively (the number of bones for the 2 skeleton xml are the same). How do we make the 2 objects merged into 1 AnimationGroup? Not by using the script with multiple input files? Or should we do it manually in code instead?

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1971
    • View Profile
    • http://www.aptalkarga.com
Re: "Number of vertices differ" for 2 meshes with one skeleton
« Reply #5 on: October 06, 2015, 09:49:34 am »
how do you export 2 objects, one by one or at the same time? I'm not a Blender user but with OgreMax when you export multiple objects at the same time, they are exported into a single mesh and skeleton file. like ninja.xml (it contains both the body and the sword mesh)

Offline kkl

  • float
  • ****
  • Posts: 291
    • View Profile
Re: "Number of vertices differ" for 2 meshes with one skeleton
« Reply #6 on: October 06, 2015, 11:32:26 am »
At the same time, but it creates 2 mesh xml and 2 skeleton xml instead. How do you export it from OrgeMax? Maybe I can imitate some similar settings from OrgeMax to blender2orge.

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1971
    • View Profile
    • http://www.aptalkarga.com
Re: "Number of vertices differ" for 2 meshes with one skeleton
« Reply #7 on: October 06, 2015, 11:34:19 am »
in OgreMax there is a dialog box in which you select the objects you want to export and that's all as far as I remember

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1971
    • View Profile
    • http://www.aptalkarga.com
Re: "Number of vertices differ" for 2 meshes with one skeleton
« Reply #8 on: October 06, 2015, 02:24:17 pm »
maybe there is an option like 'export as submesh' in exporter?

Offline kkl

  • float
  • ****
  • Posts: 291
    • View Profile
Re: "Number of vertices differ" for 2 meshes with one skeleton
« Reply #9 on: October 06, 2015, 04:37:31 pm »
No option for export as submesh. The attachment is the screenshot of blender2orge settings.

I read abit of the blender2orge readme and it says this in FAQ:
Quote
Q: I have hundres of objects, is there a way i can merge them on export only?
A: Yes, just add them to a group named starting with "merge", or link the group.

So I tried to put the 2 objects into a merge group. It still exports 2 mesh xml and 2 skeleton xml, but with addition merge.mesh.xml. I use that file to convert to raft bones, it shows another error:
Code: [Select]
Exception in thread "main" java.lang.IllegalArgumentException: No controller found in OgreEntityNode. Means there is no skeleton or pose animation!
        at raft.jpct.bones.BonesImporter.importOgre(BonesImporter.java:135)
        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)

Does it have anything similar like that in OrgeMax?

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1971
    • View Profile
    • http://www.aptalkarga.com
Re: "Number of vertices differ" for 2 meshes with one skeleton
« Reply #10 on: October 06, 2015, 04:46:30 pm »
it has been quite a while since I used OgreMax last time but no, there were nothing like that in OgreMax.

you got that error, because somehow skeleton and your mesh is not associated. please compare your merge.mesh.xml with ninja.mesh.xml. do they look similar? in the bottom of ninja.mesh.xml there is a line:

Code: [Select]
<skeletonlink name="ninja.skeleton" />
possibly that's missing in your merged file. try manually adding it to see if it helps

Offline kkl

  • float
  • ****
  • Posts: 291
    • View Profile
Re: "Number of vertices differ" for 2 meshes with one skeleton
« Reply #11 on: October 06, 2015, 05:14:22 pm »
yea the merge xml does not have the skeletonlink. If compared to ninja, ninja has 2 submeshes, but my merge xml has 1 submesh only. I also tried to copy and paste in all the xml to merge it to one, but it has "<boneassignments>" in each mesh xml and I have no idea what key is used to group them tgt (they are not in ninja xml though). I think it's still incorrect when exporting.

Or worst case, is it possible if we merge them using raft source code manually instead?

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1971
    • View Profile
    • http://www.aptalkarga.com
Re: "Number of vertices differ" for 2 meshes with one skeleton
« Reply #12 on: October 06, 2015, 06:01:48 pm »
mm then possibly that merge operation actually merges all objects into a single object.

please try this bones.jar. in the past I did some work to merge groups similar to what you need, then commented it out. this jar activates it again.

to use it you need to pass -mergeGroups switch to script file (by default if multiple input files are given it tries to merge animations not groups)

Code: [Select]
jmeOgre2Bones -mergeGroups -out out.file -in mesh1.xml mesh2.xml..

even if it works, there is a limitation at the moment, you cannot merge groups with pose animations.


Offline kkl

  • float
  • ****
  • Posts: 291
    • View Profile
Re: "Number of vertices differ" for 2 meshes with one skeleton
« Reply #13 on: October 07, 2015, 02:11:51 am »
hi raft, i tried with jar u gave me and it actually able to merge 2 objects into 1, but when animating it, only 1 object is working. The other remains still. Am i missing something?


Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1971
    • View Profile
    • http://www.aptalkarga.com
Re: "Number of vertices differ" for 2 meshes with one skeleton
« Reply #14 on: October 07, 2015, 10:32:35 am »
possibly not. that code wasnt tested properly. can you please try the files one by one and confirm that animations are working for each file individually