3

I am working on importing an 3D CAD model into my iOS application, but im having a hard time figuring out where the restriction is, speaking of amounts of vertices and surfaces.

I have a model which has :

  • surfaces: 41525
  • vertices: 21504

Essentially theres no restriction, but it actually took 2hours to load it into my iOS App.

I have not been able to find a good way to reduce this model without damaging too much, so im quite desperate to hear how this is possible.

I have the model in AC3D and STEP format.

I tried to reduce polygons through AC3D but it looks catastrophic in the end.

JavaCake
  • 4,075
  • 14
  • 62
  • 125
  • 2
    Before you do anything else, run your application in Instruments under the Time Profiler and identify the hotspots when loading your model. My guess is that you have a very slow parser, because that size of geometry takes under a second for me to load from SQLite in my application. However, never make assumptions about performance, profile first. – Brad Larson Mar 08 '12 at 23:20
  • 1
    For another example, Davido was able to render nearly a million triangles at 10 FPS in his iPad application described in [this question](http://stackoverflow.com/questions/5718846/how-can-i-optimize-the-rendering-of-a-large-model-in-opengl-es-1-1), so this kind of geometry is trivial in comparison to that. – Brad Larson Mar 08 '12 at 23:24
  • Thanks for your reply. Its the first time im using Instruments and when i lunch it and choose Time Profiler it comes with the error `iOS Simulator failed to find the process ID of ....` – JavaCake Mar 08 '12 at 23:31
  • @JavaCake which version of Xcode are you using? Speaking completely subjectively, the integration with Instruments seems to be one of the things Apple manage to break almost every other version. I suspect they have engineers whose only job is alternately to break all external links into developer.apple.com and to break either the debugger or Instruments integration in Xcode. – Tommy Mar 08 '12 at 23:48
  • 1
    @JavaCake - As Tommy points out, running Instruments from within Xcode can be tricky. Instead, use the menu item Xcode | Open Developer Tool | Instruments to start it as a standalone application if you're using Xcode 4.3. For older versions, you'll need to find it within /Developer and run it. In there, choose your attached iOS device (profiling performance against the Simulator is effectively worthless) and select your application from the list of applications installed on the device. You should be able to start a trace on that application without a problem. – Brad Larson Mar 09 '12 at 03:29
  • Unfortunately im not using my own library for this task since my schedule is very tight. You might already be familiar with Jeff LaMarche's Wavefront Object Loader, which im using in this case. Theres no doubt that it gets quite stuck under the tokenizing of my model files, especially since the examples he has added to the library consist of very few surfaces and vertices. – JavaCake Mar 09 '12 at 06:56
  • @BradLarson, i suspect that im exporting my models as polygons and large quads, which essentially will kill the object loader. But im not quite sure of AC3D can convert to pure triangles or not. Are any of you familiar with a proper converter tool? – JavaCake Mar 10 '12 at 08:13
  • @BradLarson, after analyzing my model i realised theres no quads, so the reason behind the needy and longsome loading of the model is still quite abstract to me.. – JavaCake Mar 11 '12 at 11:38

1 Answers1

3

There's no formal restriction, and the throughput you actually get will depend on how intelligently you're able to pick what to draw, what sort of surface effects you want to apply, etc.

That all being said, peeking into a STEP file reveals it to be a pure-ASCII format for interchange. Two hours is so excessive as to suggest some fairly major underlying performance issue beyond the stuff of parsing but you should definitely consider at least tokenising the file before including it in the app.

OBJ is another ASCII format, and I found that simply tokenising the file on the Mac and then loading the tokenised version in app reduced a 20s model load down to less than 1s. Switching to a binary format with no pretensions of OBJ compatibility (so that I could pre-stripify, amongst other things) cut the load time even further.

Tommy
  • 99,986
  • 12
  • 185
  • 204
  • That makes pretty good sense and looking at the example @Brad Larson linked to its obvious that it should be able to handle this particular model i have. But i need to look through the code again, cause it took me 30mins to render the model. – JavaCake Mar 09 '12 at 15:40