Author Topic: Bones - Skeletal and Pose animations for jPCT  (Read 240407 times)

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: Bones - Skeletal and Pose animations for jPCT
« Reply #210 on: April 20, 2011, 07:23:02 pm »
no, not possible. jPCT's serializer only writes jPCT related data, texture info polygons etc. Bones need to write animation data that's why it has its own serializer/deserializer (i.e. BonesIO). i guess it's fast enough, isn't it?


Offline Babu

  • int
  • **
  • Posts: 71
    • View Profile
Re: Bones - Skeletal and Pose animations for jPCT
« Reply #211 on: April 20, 2011, 07:41:08 pm »
yeah, I kind of guessed it that .bones is the equivalent .ser... but now with your reply it is quite clear, thanks :)
Quote
i guess it's fast enough, isn't it?
In Android Emulator, it took more than 20 seconds to load my model.  I still need to check that in my samsung galaxy 3.  However, the total polygon count for my model is more than 8000  :o.  I think I need to work with my artist to bring it down. 
BTW, what do you think should be the ideal range of polygon count for JPCT-AE/Bones combination  ???



Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: Bones - Skeletal and Pose animations for jPCT
« Reply #212 on: April 20, 2011, 08:03:42 pm »
emulator is really slow. the real device should be faster.

optimal polygon count depends on your application (how many of that models will you render? background model? etc) and target device. its hard to say something. but i guess 8000 polygons is high for a phone app.

Offline Babu

  • int
  • **
  • Posts: 71
    • View Profile
Re: Bones - Skeletal and Pose animations for jPCT
« Reply #213 on: April 20, 2011, 08:27:18 pm »
Following are data that I just collected:

Simulator
Load (.bones to AnimatedGroup) - 12 seconds
Oncreate to OnDraw - 18 seconds

Samsung Galaxy 3
Load (.bones to AnimatedGroup) - 6 seconds
Oncreate to OnDrawFrame - 12 seconds

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: Bones - Skeletal and Pose animations for jPCT
« Reply #214 on: April 20, 2011, 08:53:59 pm »
well, lower your polygon count. how does that phone perform with jPCT bencmark app?

i can later try to make it faster but no promises. and expect no miracles.

i guess some siginificant part of loading time goes to building objects. jPCT's serializer saves build information to save building time in Android. i'm afraid there isn't much I can do about it.

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: Bones - Skeletal and Pose animations for jPCT
« Reply #215 on: April 21, 2011, 12:48:46 am »
BonesIO uses some kind of flat java serialization. it serializes some arrays and objects as objects. I was suspecting this was slow but I was avoiding replacing it mostly because it will be too error prone and hard to debug in case of failure.

now i tried replacing ObjectOutputStream.writeObject calls with a series of primitive writes like writeInt and writeFloat. surprisingly it didnt help. maybe even performed slightly worse. than I took my changes back.

so in short, seems as there isnt much room to improve here.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Bones - Skeletal and Pose animations for jPCT
« Reply #216 on: April 21, 2011, 07:03:18 am »
Just make sure that you wrap all InputStreams into BufferedInputStreams or otherwise, loading on Android will be much slower...i bet you already do that, it just came to my mind while reading this thread.

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: Bones - Skeletal and Pose animations for jPCT
« Reply #217 on: April 21, 2011, 11:47:21 am »
no i wasn't doing that. thanks for the reminder. wrapping into BufferedInputStream slightly increases flat serialization loading but still surprisingly primitive reads perform worse. dont know why ???

Offline Babu

  • int
  • **
  • Posts: 71
    • View Profile
Re: Bones - Skeletal and Pose animations for jPCT
« Reply #218 on: April 22, 2011, 08:32:07 am »
hi raft,
Today, i was trying to load a model that uses pose animations.  But i got the following exception, when i was exporting from xml to bones.
Any idea what's going wrong?
Code: [Select]
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1937)
at com.jmex.model.ogrexml.anim.MeshAnimationLoader.loadPose(MeshAnimationLoader.java:187)
at com.jmex.model.ogrexml.anim.MeshAnimationLoader.loadPoses(MeshAnimationLoader.java:144)
at com.jmex.model.ogrexml.OgreLoader.loadMesh(OgreLoader.java:699)
at com.jmex.model.ogrexml.OgreLoader.loadModel(OgreLoader.java:225)
at com.jmex.model.ogrexml.OgreLoader.loadModel(OgreLoader.java:177)
at raft.jpct.bones.util.JMEOgreImporter.loadGroup(JMEOgreImporter.java:110)
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)

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: Bones - Skeletal and Pose animations for jPCT
« Reply #219 on: April 22, 2011, 08:46:59 am »
I'm out.of city now. will look at it next week. meanwhile you can debug it yourself  ;)

Offline Babu

  • int
  • **
  • Posts: 71
    • View Profile
Re: Bones - Skeletal and Pose animations for jPCT
« Reply #220 on: April 22, 2011, 05:51:06 pm »
thanks, raft :)

I am seeing this problem with even "cylinder.mesh.xml" and "facial.mesh.xml".  Seems to be common problem for anything with pose animations  ???

Yeah, I will try my best to debug this  ;D  But it seems to happen in the jme loader for which i don't have the source code.  Any idea, from where I can get the source  ::)

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: Bones - Skeletal and Pose animations for jPCT
« Reply #221 on: April 22, 2011, 07:13:05 pm »
facial and cylinder.xml was working fine. maybe jme version update or me screwed something.

bones.zip contains src for jme and ardor

Offline Babu

  • int
  • **
  • Posts: 71
    • View Profile
Re: Bones - Skeletal and Pose animations for jPCT
« Reply #222 on: April 23, 2011, 08:27:32 am »
Yeah, got the source.  The ".jar" extension had done me in  :-[

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: Bones - Skeletal and Pose animations for jPCT
« Reply #223 on: April 24, 2011, 09:24:56 pm »
please re-download the zip, hopefully i've fixed that.

jME trunk now contains jME-3 alpha, so i cant see history of jME-2. SVN tags dir contain jME-2.0.1 not jME-2. IMHO they had screwed SVN.

Offline Babu

  • int
  • **
  • Posts: 71
    • View Profile
Re: Bones - Skeletal and Pose animations for jPCT
« Reply #224 on: April 25, 2011, 12:25:07 pm »
Thanks, raft.  I will download the zip and check it out.

Yesterday, I had done some changes locally and I was able convert from xml to bones.  And I am able to to load the cylinder model in my Android App.  Basically, the method, "loadPose" of "MeshAnimationLoader" assumes the existence of extension in the submesh names.  I just did the following changes to get around that.
Old Code
Code: [Select]
String cleanName = name.substring(0, name.lastIndexOf('-'));
rootnode.addPose(cleanName, pose);

My Changes
Code: [Select]
String cleanName = name;
int extIndex = name.lastIndexOf('-');
if(extIndex >0 ) cleanName = name.substring(0, extIndex);
rootnode.addPose(cleanName, pose);