Cloning models

I've a 3ds model and I've to replicate it many times.

Is it possible to clone it not to have an Out of Memory error?



:-o

truman said:

I've a 3ds model and I've to replicate it many times.
Is it possible to clone it not to have an Out of Memory error?

:-o


You can try to set the

-Xmx<size>        set maximum Java heap size

argument in your execution command.  I had to do this when I was testing out audio stuff a while back.  I used the setting

-Xmx1G (I think)

and it got me past the memory issue I was having at the time.

Thanks for your reply.

Is there another way to save memory?

How exactly do you clone? With CloneImportExport? How many instances do you create? Can you show your code?

ttrocha said:

How exactly do you clone? With CloneImportExport? How many instances do you create? Can you show your code?

this is the problem, I don't know how to clone
I import the same object everytime

Ok…I asume that loading one 3ds-model is working.


Node 3dsmodel = ...LOAD THE MODEL....
CloneImportExport clone = new CloneImportExport();
clone.save(3dsmodel)



From that point on you can use the clone-object's loadClone-method  to "clone" the model you put in with the save-method:

Node clone = (Node)clone.loadClone();



But if that is solving the memory problem is another question. How much verteces does you model have? Keep in mind that this shouldn't be too much.

Ok,..hope that will get you further....



ttrocha said:

Ok..I asume that loading one 3ds-model is working.

Node 3dsmodel = ...LOAD THE MODEL....
CloneImportExport clone = new CloneImportExport();
clone.save(3dsmodel)



From that point on you can use the clone-object's loadClone-method  to "clone" the model you put in with the save-method:

Node clone = (Node)clone.loadClone();



But if that is solving the memory problem is another question. How much verteces does you model have? Keep in mind that this shouldn't be too much.

Ok,..hope that will get you further....






thanks, I've cloned
Loading is now faster
But I still have memory problems
My heaviest objects have 107 vertices and 80 faces (20 units)
I can load 14 of them then I have an out of memory error

Sounds strange to me. Is there a texture? And if yes what's about its size? Did you

create the model on your own? If you use 3d studio,maybe there is another way to

export it (Didnt use Max sind 2.0)!? Maybe as wavefront or ogre?

Sorry - I thought you were already cloning and still running into the memory issue.  Even so, I think that my memory heap size suggestion still holds.

I've used 3dsmax

I have 20 car models of 800kb, 40-50 environment models from 50kb to 10 kb (4 textures x 2kb)

They're all converted in jme format

I also have skybox pictures (6 x 30kb)

I run my application under Eclipse


Hmm,…don’t have a clue! Never used that much models at the same time. Maybe sharedmesh can help there!?? Actually I never used it…



http://www.jmonkeyengine.com/wiki/doku.php?id=sharedmesh

I'll try thanks  :smiley:

I'd also strongly suggest to use shared meshes for your use case…  or ev. geometry instancing if you use it for static stuff…