Author Topic: Does the Animated3D obj retain more memory than Object3D with the same model?  (Read 2632 times)

Offline kiffa

  • long
  • ***
  • Posts: 199
    • View Profile
I have the models of a dog and an island, and the dog is animated, the island is not.

I combined the island to the dog in maya, so the island will be the sub-meshes of the dog.  And i exported the combined model into only one .mesh.xml, then converted to .bones which named dog.bones(included the dog and the island in fact).

Then, i use BonesIO.loadGroup to load  the dog.bones, and there will create some Animated3D objects, one(the dog) have animation-data, the others have not.

My question is: With the same model, does the Animated3D obj retain more memory than the Object3D?

For examble, with the same island model:
A: The island model(.bones) is loaded into an Animated3D object as a sub-mesh of the animated-dog-model.
B: The island model(.obj or .ser)  is loaded into an Object3D object.
Will "A" retain more memory than "B"?  And if so, about how many than?

Offline kiffa

  • long
  • ***
  • Posts: 199
    • View Profile
And how to estimate the memory usage of bones model and animation?

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1972
    • View Profile
    • http://www.aptalkarga.com
yes it does use more memory of course. I'm not sure about the exact amount, because that also depends on how jPCTS's IVertexController behave: give mesh arrays by copy or by reference? if all those arrays are copies, then memory usage may be close to twice of Object3D.

I don't see the point of making island and Animated3D.. anyway

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
jPCTS's IVertexController behave: give mesh arrays by copy or by reference? if all those arrays are copies, then memory usage may be close to twice of Object3D.
Yes, these arrays are copies of the actual data.

Offline kiffa

  • long
  • ***
  • Posts: 199
    • View Profile
Most of my objects are Animated3D :-\. So, they use double memory. Could this be possible: use the Animated3D, but consume almost the same memory of Object3D.

And why there is a copy? Could you implement Animated3D without such a copy(in order to save memory) and without any loss of features、performances and so on.
« Last Edit: August 08, 2012, 07:14:05 am by kiffa »

Offline kiffa

  • long
  • ***
  • Posts: 199
    • View Profile
I don't see the point of making island and Animated3D.. anyway

1,  There are 2 models in maya : an (bone)animated-dog and a island.  And the dog animates on the island.

2a,  I can exported the dog as .bones and the island as .obj(.ser), but in this way, i need coding their relative position:  dog.translate(x,y,z); island.translate(x1,y1,z1).

2b, I don't want to coding their relative position, i want to do this in maya only. So, i combined the dog and the island to one mesh, exported this mesh to one .bones.  Then i just need translate the combined-one in the world without caring  the relative position of the dog and the island:  combinedMesh.transtale(0, 0, 0);

3, So, is that right?
    a, In "2a", the memory usage is double-dog(Animated3D)  + island(Object3D);
    b, In "2b", the memory usage is double-dog + double-island, because both of them are loaded as Animated3D.
« Last Edit: August 08, 2012, 07:18:55 am by kiffa »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
Most of my objects are Animated3D :-\. So, they use double memory. Could this be possible: use the Animated3D, but consume almost the same memory of Object3D.

And why there is a copy? Could you implement Animated3D without such a copy(in order to save memory) and without any loss of features、performances and so on.
It's a copy because you wouldn't be able to deal with internal representation of the mesh data. In that way, it's not a real copy but another representation. It doesn't use twice the memory. Only vertices and normals are duplicated in another format.
« Last Edit: August 08, 2012, 03:08:53 pm by EgonOlsen »

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1972
    • View Profile
    • http://www.aptalkarga.com
well, everything has a cost ;)

1. live with more memory consumption (it's not twice as Egon said)
2. move your Animated3D's and Object3D's together someway (why not add both of them as children to a common root, or even adding Object3D's as children to AnimatedGroup's root may also work)

I won't change Bones's code to reduce memory consumption. this can be possible by nulling such arrays of non-animated objects, but again, Bones is an animation library, non-animated objects is not its concern.

Offline kiffa

  • long
  • ***
  • Posts: 199
    • View Profile
Thanks all!

I have used ".ser + .bones" instead of "all as .bones", the memory usage has a 3M-decrease, it's good enough for me. And as raft say, i added the Object3D as the children of Animated3D, they worked well!

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1972
    • View Profile
    • http://www.aptalkarga.com
cool, I'm glad it helped ;)

Offline AGP

  • quad
  • ******
  • Posts: 1526
    • View Profile
I think I mentioned this before, but an important feature for Bones would be to load separate animations in separate .xml files (like the format allows for). But it would require Bones to accept an initial skeleton with no animations (or at the very least to follow the skeletonLink tags on the original xml, but the former is more flexible, and thus, cooler).