Author Topic: Any Way to Speed Up the OBJ Importer?  (Read 1554 times)

Offline AGP

  • quad
  • ******
  • Posts: 1518
    • View Profile
Any Way to Speed Up the OBJ Importer?
« on: August 28, 2010, 07:41:27 am »
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Any Way to Speed Up the OBJ Importer?
« Reply #1 on: August 28, 2010, 09:15:20 am »
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?

Offline AGP

  • quad
  • ******
  • Posts: 1518
    • View Profile
Re: Any Way to Speed Up the OBJ Importer?
« Reply #2 on: August 28, 2010, 06:32:54 pm »
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Any Way to Speed Up the OBJ Importer?
« Reply #3 on: August 28, 2010, 08:39:20 pm »
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Any Way to Speed Up the OBJ Importer?
« Reply #4 on: August 28, 2010, 09:05:16 pm »
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...

Offline AGP

  • quad
  • ******
  • Posts: 1518
    • View Profile
Re: Any Way to Speed Up the OBJ Importer?
« Reply #5 on: August 29, 2010, 01:12:23 am »
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? :- )?
« Last Edit: August 29, 2010, 01:31:18 am by AGP »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Any Way to Speed Up the OBJ Importer?
« Reply #6 on: August 29, 2010, 09:54:30 am »
No, it's here to stay. Reverting to the old and slow one makes no sense at all.