Author Topic: General advice on model/skeleton structure for Bones  (Read 2580 times)

Offline neo187

  • int
  • **
  • Posts: 73
    • View Profile
General advice on model/skeleton structure for Bones
« on: September 17, 2011, 10:36:48 am »
Hello there

Before I start skinning and rigging my model for this Android demo that I'm making with JPCT, I was wondering if there is any particular guidelines on how the model should be built.

Is there a rough number of polys that you guys would recommend for the average Android phone when using this engine? Is there any special instruction for the building of the skeleton? Number of bones, dependencies etc....

Thank you very much!

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: General advice on model/skeleton structure for Bones
« Reply #1 on: September 17, 2011, 02:53:43 pm »
Well, not really. It all depends on your application. Needless to say, low polys perform better, high polys looks better. Number of polygons also depends on how many of animated models you will use simultaneously. It also depends on background scene. A few hundreds polygons may be optimal, but again it depends on your application.

Number of bones in skeleton does not make much difference. It certainly increases memory usage and processing but not that much. No other requirements for bones in skeleton.

Offline neo187

  • int
  • **
  • Posts: 73
    • View Profile
Re: General advice on model/skeleton structure for Bones
« Reply #2 on: September 17, 2011, 10:05:01 pm »
Thanks for your help on that, some formats like the .psk for Unreal requires very funny pre requisites like that all bones generate indirectly from the master bone and are somehow linked to it....

I was thinking of something of roughly the same level of detail as the Ninja model in the demo, am curious as to how many polys are there... There would only be one animated model and a fairly small scene with low poly models....

Also, are bounding boxes created automatically for animated groups or is there a function to call? For regular Object3D objects I understand that obj.build() would do that?

Thanks for your help!

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: General advice on model/skeleton structure for Bones
« Reply #3 on: September 18, 2011, 04:52:06 pm »
Don't know th exact number but Ninja has 781+61 vertices. (body + sword). so it has roughly ~300 polygons

For bounding box, as Animated3D extends Object3D, it has all the properties Object3D has including bounding box

Offline neo187

  • int
  • **
  • Posts: 73
    • View Profile
Re: General advice on model/skeleton structure for Bones
« Reply #4 on: September 18, 2011, 05:16:20 pm »
Thanks for that! I am actually trying to move the Ninja around and test for collisions with another model but I get a NullPointReference if I call

Code: [Select]
directionVector = ninjas.get(0).getRoot().checkForCollisionEllipsoid(directionVector, ellipsoid, 1);
So basically I call the addNinja() method on startup which places the ninjas.get(0) ninja in the middle.  I added these line to the addNinja method to enable collision detection:

Code: [Select]
ninja.getRoot().setCollisionMode(Object3D.COLLISION_CHECK_SELF);

Right before the ninja.addToWorld method and then if a button is pressed I set apply the direction vector to it but with the checkForCollision call I only get a Null error....

Any idea why?

Thanks for your awesome help.


Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: General advice on model/skeleton structure for Bones
« Reply #5 on: September 18, 2011, 05:22:16 pm »
root is a dummy empty object that is not itself added to world. all Animated3D's in a group is added to root as a child, this is for translating/rotating all objects together and easily. so you need to call collision methods not on root but on Animated3D's.

for example to check collision on first Animated3D:
Code: [Select]
ninja.get(0).setCollisionMode(Object3D.COLLISION_CHECK_SELF);
directionVector = ninja.get(0).checkForCollisionEllipsoid(directionVector, ellipsoid, 1);

Offline neo187

  • int
  • **
  • Posts: 73
    • View Profile
Re: General advice on model/skeleton structure for Bones
« Reply #6 on: September 18, 2011, 06:10:51 pm »
Brilliant. That did it. Only that in the Ninja demo ninjas.get(0) returns an AnimatedGroup. For the Animated3D object I had to do:

Code: [Select]
ninjas.get(0).get(0).setCollisionMode(Object3D.COLLISION_CHECK_SELF);
directionVector = ninjas.get(0).get(0).checkForCollisionEllipsoid(directionVector, ellipsoid, 1);

Thanks for your prompt help!

Offline neo187

  • int
  • **
  • Posts: 73
    • View Profile
Re: General advice on model/skeleton structure for Bones
« Reply #7 on: September 24, 2011, 02:15:59 pm »
Hi Raft!

Back again... Wanted to ask your advice on the performance of my app so far... on my ZTE Racer (Android v2.1) I get about 20 fps with up to three animated ninjas on screen... With my own app I am stuck between 5 and 10 fps with only my model up. I used the Optimizer modifier in 3DS Max to get my mesh down to around 1100 polygons, so it's not much more than the Ninja....

I was wondering if there's anything else that can contribute to speed up to processing a bit, if it's in the number of bones in the skeleton or particular engine operations to try and cut down on....

Thank you for your support!
« Last Edit: September 24, 2011, 04:14:29 pm by neo187 »

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: General advice on model/skeleton structure for Bones
« Reply #8 on: September 25, 2011, 05:32:49 pm »
1100 polygons is much more higher than 3 ninjas. if I remember correctly a ninja is ~300 vertices not polygons.

i have no specific advice.

your app will perform better on 2.2 and higher because of JIT