slow loading textured 3ds model

I’m using kev’s nice 3ds loader to load in a (non-simple) model and here are some approximate load times for different textured configurations of it:

  • untextured: 0.4 seconds
  • whole model 1 texture: 1.2 seconds
  • half model 1 texture, half another texture: 2.2 seconds
  • whole model with 9 different materials: 39 seconds

I’m doing all the texturing and uvw mapping in 3ds Max before I export the model. Is this possibly due to the way I’m mapping materials in 3ds Max? Is this because I’m mapping everything in 3ds Max? Is there any way I can speed this up? Are there any other (free, preferably) tools out there that could improve this? Is this just because the loader doesn’t load them that fast? Should I be loading them in separately? Should I map everything by hand? (If the answer is yes to the last question, I think I’d have to kill myself :))

I noticed a significantly better loading time (though still unacceptably slow) when using the ASE loader, but the ASE just consumes a lot more memory than the equivalent 3ds file when loaded in (in addition to huge file size for larger model). Oh yea, for both loaders, I’m simply using the one-call .load() (or .getModel() for the ASE) method to load in the model.

I know it may not be possible to deduce the exact answers to my questions above from the information provided (and I don’t expect answers to all of them), but perhaps someone has a general idea of something else I can try. Any suggestions?

regarding this comment about ASE files: “huge file size for larger model” - most of the time you will be loading from a .jar file and the entropy of ASE files is so low that you get a very good compression ratio making that point essentially moot.

Not that I am saying the format doesn’t have it’s faults in other areas but…

Will.

Yeah, I realize it compresses way down from its original file size… I failed to note that. I guess I meant relative to the 3ds, but since they are different storage formats, of course there are differences between the two – I have not looked at the details of either format too much. Unfortunately, if the model is pretty (arbitrarily) big, it still sucks up a nice chunk of memory when loaded in from its compressed format.

Well I finally figured out the problem: my textures were, for the most part, not powers of 2. It was just getting choked up on loading the textures because of this. Now it all loads fast.

I know you’re “supposed” to use power of 2 textures, but… :P. Anyhow, in case anyone has these issues, check your texture image dimensions.

glad you found the answer :slight_smile:

regarding formats - It’s just a case of picking the right one for the job I guess.

Will.

Yeah. The ase does seem to be much friendlier in loading stuff. Sometimes if i change the littlest thing then my model will fail to load with the 3ds loader. In fact, that’s what I’m workin on now. If I see another Exception in thread “main” com.xith3d.scenegraph.IllegalSceneGraphOperation: Attempt to set the parent of a Node which already has one. I think I’ll go nuts. >:(

a cool fix for models not working we found here with the 3ds loader… is to place a small cube in the object some place…

for one- if u make an object with alot of boolean cuts within it- the loader cant handle it. the model loads but the bounds get dumped… so a nice workaround is to add a small cube and combine it to the model… magic it all works :slight_smile:

not sure why… but if it works them me happy… kev is a dude… hope he can revisit the loader when hes not overloaded with loads of stuff :slight_smile: nice one KEV!

Regarding that - the exception is fairly new. Previously setParent would allow the operation and simply disregard the first parent (unlike Java3D which enforced it).

The fact of the matter is that if you are getting it - there is something wrong and it’s probably better to find out about it rather then have unexplained stuff going on in your app.

That said - if it’s causing you too much pain - just comment out that line of code and it will revert to the old operation (of ignoring the issue).

Perhaps we need to be able to set an option whether this check is performed or not due to it’s late inclusion in the API. I’m sorry it took so long to add this in, it was on my todo list for a long time, I just never got around to it (not surprisingly when I did it took all of a few minutes).

Cheers,

Will.

I had been getting that exception sometimes before when building my models but I hadn’t figured out why until last night. It was due to a stray vertex that I guess was left over when I had deleted something. It was tough to find in 3ds Max because, well, it’s nearly invisible, even when selected. I only encountered that exception with the 3ds loader, and not the ase loader.

With that said, my problems are usually self-inflicted :), due to my lack of work/experience with some stuffs. Gotta learn somehow I guess.

edit: I think that exception is fine, it was just nearly impossible for me to figure out wtf it was going wrong… though I knew it had to be in my model somewhere.

I’ve changed the exception message to assist in debugging a bit more - adding the name (and object hashcode) of both the node in question, and it’s existing parent.

if you always name your nodes then this should be a help.

Will.

Sounds good, thanks :slight_smile: