Does the Animated3D obj retain more memory than Object3D with the same model?

Started by kiffa, August 07, 2012, 05:11:50 AM

Previous topic - Next topic

kiffa

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?

kiffa

And how to estimate the memory usage of bones model and animation?

raft

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

EgonOlsen

Quote from: raft on August 07, 2012, 04:54:21 PM
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.

kiffa

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.

kiffa

Quote from: raft on August 07, 2012, 04:54:21 PM
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.

EgonOlsen

Quote from: kiffa on August 08, 2012, 06:54:50 AM
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.

raft

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.

kiffa

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!

raft


AGP

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