Any Way to Speed Up the OBJ Importer?

Started by AGP, August 28, 2010, 07:41:27 AM

Previous topic - Next topic

AGP

Egon, I know OBJ is ASCII rather than binary, but are you sure it's being read as quickly as possible? For static objects, OBJ is by far the most useful format that jpct reads (unlike 3DS, it's not improperly rotated and it doesn't have the 8.3 texture name limitation). Plus Max has an absolutely kick-ass exporter that converts and rescales all of its textures to your desired format. The problem is that it takes SO VERY LONG to import a 70,000-poly city with it.

EgonOlsen

Are you sure that the loading itself takes the time and not building it or something? Can you provide me with that model to test it?

AGP

I'm not really sure whether it's during importing or not, but I only get this enormous load times with OBJ models, so I think it's during the load time. I just sent it to your e-mail. Thanks for your help.

EgonOlsen

Got the model. Loading is pretty fast IMHO (around 500ms on my machine) and so is building (around 100ms). What's really really slow is merging all objects into one. Are you doing that too? It takes around 30 secs on my machine. If that's your problem too, i'll try to optimize that (if possible) rather than the importer itself.

EgonOlsen

I've uploaded a version with an optimized mergeAll()-method here: http://www.jpct.net/download/beta/jpct.jar

If merging is the problem and you are using mergeAll() (if not, then you should...), give it a try. It reduces complexity of that operation from O(n²) to O(n). With your file, the merge times went down from 30 secs to 60 ms...

AGP

#5
Thanks a whole lot, Egon, that's very likely it. Are you going to keep this faster mergeAll in the future (should I be afraid of upgrading? :- )?

EgonOlsen

No, it's here to stay. Reverting to the old and slow one makes no sense at all.