Bones - Skeletal and Pose animations for jPCT

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

Previous topic - Next topic

EgonOlsen

I'm not sure what exactly is so slow when transferring data from VM to native memory. This isn't a problem in normal Java, so it should be possible to get it up to speed in Dalvik too and maybe a JIT will help there too.
Right now, optimizing this is all a big trial and error game. I used to do transfers put by put, which was pretty slow. So i changed that to put large float[]-arrays instead in one call, which was faster. When optimizing the blitting, i did this too, i.e. i changed the single puts to normal float[]-access and one final put at the end...and the result was slower!? I then started to use indexed geometry instead and suddenly, the float[]-method was faster again!?
And that's just on my hardware. I've no idea what might be faster on other hardware. 

AW999

Quote from: raft on January 06, 2010, 11:45:01 PMAt the moment, the project is at "Proof of Concept" state. Skinning and mesh deformation works, but skeleton poses can only be created programmatically. Hence it's not really useful for games at the moment.

  It's strange that you claim it's not useful -  I've been looking for a way to generate this type of thing programmatically so that it's based on context rather than being locked into a small set of stock poses (and so that I don't have to tediously make the poses manually).
I'm hoping you'll retain this feature - this is exactly what I've been looking for, and even the early demos look impressive. 

raft

Quote from: AW999It's strange that you claim it's not useful -  I've been looking for a way to generate this type of thing programmatically so that it's based on context rather than being locked into a small set of stock poses (and so that I don't have to tediously make the poses manually).
i meant very few people will benefit it. most prefer precanned animations. and to tell the truth making programatic poses look as expected is kind of tedious job.

Quote from: AW999
I'm hoping you'll retain this feature - this is exactly what I've been looking for, and even the early demos look impressive. 
sure, there is no need to remove it. indeed i exposed many more package private constructors and methods to allow programatically create skeletons aniamations etc..

i'm glad you liked it and hope it will be useful ;D at least according to my tests, Bones seems quite stable at the moment

zammbi

Testing on "Bones-Android-Ninja2.apk" is this the latest?

8 walking characters:
Skin animation: 8fps
Mesh animation: 16fps
No animation: 31fps


raft

Quote from: zammbi
Testing on "Bones-Android-Ninja2.apk" is this the latest?
yes, i guess so.

thanks for the tests :D similar results with nexus one. bones need a JIT to perform well..

this is kind of expected since it makes moderately heavy matrix calculations. a couple for each skeleton joint to pose them, then up to 4 vector-matrix multiplication for each vertex..




EgonOlsen

Does Bones use jPCT's matrix and vector stuff for this or something else?

raft

it mostly uses jPCT's matrix and vector class. for rotations it uses quats

EgonOlsen

So it might help to do some micro optimizing of these methods? Could you provide some data on method usage to know where to look first?

raft

sure, i will be glad indeed :D

* SkeletonPose.updateTransforms() updates joint matrices. matrix-matrix multiplication
* JointChannel.applyTo(..) and variants applies precanned animation to skeleton pose. interpolates quats and vectors and sets them on matrix
* Animated.applySkeletonPose() is the method where skeleton pose is applied to mesh. vector-matrix multiplciation and vector addition
* and a few Matrix.setTo(), Matrix.setIdentity(), SimpleVector.set(..) calls to avoid creation of new ones

EgonOlsen

Updated the jar with a version that includes some micro opts. However, matrix multiplication, as the most complex operation of the ones you mentioned, already has been optimized pretty much to the death and the other methods didn't offer much room for improvement, so you might not notice it at all (except when i broke something by accident...).
I played around with the idea to offload the matrix multiplications to the GL driver, but it was much slower.... :'(

raft

there seems to be a slight increase but hard to measure. it'a a combined effect i suppose. i also made some minor optimizations like assigning static temp fields to method variables. apk is up to date

EgonOlsen

Yep, seems to be a tad faster. After all, even those tiny increases will stack up in the end. My demo scene went up from 20 to 31fps during the last few weeks and at least 50% of this increase can be tributed to micro optimizations....Dalvik is very rewarding in this aspect.

zammbi

Quoteapk is up to date

8fps for walking 8 people. Same as the last demo I ran. But that's probably because of my fpu.

fir3d

Is it usable in games now? I dont know what most of you all are talking about here  ;D, but I do know how to use a biped in 3ds max and was hoping it would work for games eventually.

raft

Quote from: fir3d on May 10, 2010, 07:05:08 PM
Is it usable in games now?
yes, on desktop definetely it is :D try ogre3d exporter (ogremax) for max. on Android, Bones suffers performance which is kind of expectable because of dalvik vm and -moderately- heavy matrix calculations :-\