Bones - Skeletal and Pose animations for jPCT

Started by raft, January 06, 2010, 11:45:01 PM

Previous topic - Next topic

raft

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?


Babu

yeah, I kind of guessed it that .bones is the equivalent .ser... but now with your reply it is quite clear, thanks :)
Quotei 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  ???



raft

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.

Babu

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

raft

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.

raft

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.

EgonOlsen

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.

raft

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 ???

Babu

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?
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)

raft

I'm out.of city now. will look at it next week. meanwhile you can debug it yourself  ;)

Babu

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  ::)

raft

facial and cylinder.xml was working fine. maybe jme version update or me screwed something.

bones.zip contains src for jme and ardor

Babu

Yeah, got the source.  The ".jar" extension had done me in  :-[

raft

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.

Babu

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

String cleanName = name.substring(0, name.lastIndexOf('-'));
rootnode.addPose(cleanName, pose);


My Changes

String cleanName = name;
int extIndex = name.lastIndexOf('-');
if(extIndex >0 ) cleanName = name.substring(0, extIndex);
rootnode.addPose(cleanName, pose);