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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Bones - Skeletal and Pose animations for jPCT
« Reply #30 on: April 02, 2010, 05:04:34 pm »
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. 

Offline AW999

  • int
  • **
  • Posts: 57
    • View Profile
Re: Bones - Skeletal and Pose animations for jPCT
« Reply #31 on: April 04, 2010, 07:44:56 pm »
At 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. 

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: Bones - Skeletal and Pose animations for jPCT
« Reply #32 on: April 04, 2010, 09:26:03 pm »
Quote from: AW999
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 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

Offline zammbi

  • float
  • ****
  • Posts: 361
    • View Profile
Re: Bones - Skeletal and Pose animations for jPCT
« Reply #33 on: April 12, 2010, 04:44:58 pm »
Testing on "Bones-Android-Ninja2.apk" is this the latest?

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


Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: Bones - Skeletal and Pose animations for jPCT
« Reply #34 on: April 12, 2010, 05:02:31 pm »
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..




Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Bones - Skeletal and Pose animations for jPCT
« Reply #35 on: April 12, 2010, 05:15:11 pm »
Does Bones use jPCT's matrix and vector stuff for this or something else?

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: Bones - Skeletal and Pose animations for jPCT
« Reply #36 on: April 12, 2010, 05:21:50 pm »
it mostly uses jPCT's matrix and vector class. for rotations it uses quats

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Bones - Skeletal and Pose animations for jPCT
« Reply #37 on: April 12, 2010, 05:29:40 pm »
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?

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: Bones - Skeletal and Pose animations for jPCT
« Reply #38 on: April 12, 2010, 05:46:45 pm »
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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Bones - Skeletal and Pose animations for jPCT
« Reply #39 on: April 13, 2010, 11:26:17 pm »
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.... :'(

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: Bones - Skeletal and Pose animations for jPCT
« Reply #40 on: April 13, 2010, 11:57:20 pm »
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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Bones - Skeletal and Pose animations for jPCT
« Reply #41 on: April 14, 2010, 07:53:15 am »
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.

Offline zammbi

  • float
  • ****
  • Posts: 361
    • View Profile
Re: Bones - Skeletal and Pose animations for jPCT
« Reply #42 on: April 14, 2010, 04:11:43 pm »
Quote
apk is up to date

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

Offline fir3d

  • byte
  • *
  • Posts: 11
    • View Profile
Re: Bones - Skeletal and Pose animations for jPCT
« Reply #43 on: May 10, 2010, 07:05:08 pm »
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.

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: Bones - Skeletal and Pose animations for jPCT
« Reply #44 on: May 11, 2010, 12:19:13 am »
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 :-\