iPhone : Runtime model loading speed

All,

I’ve developed an application for loading architectural building models from the web for viewing on the iPhone using Unity. Using the WWW class, I read text files from the web and construct the meshes, and apply materials at load time.

The problem is this. The models download really quickly, but the mesh building process take several minutes. I’ve been careful to keep my models under 16k faces approx. The models are monolithic meshes (to reduce draw calls) with approx. 6-10 textures per mesh (using sub meshes). The meshes are created by deleting and rebuilding the mesh attached to an existing pre-fab. There is always only one mesh in the scene and one light.

The computation of normals and uv coordinates also happens during the build process. The texture assets are all max 512x512 PVRTC compressed images that are loaded with the app, so nothing texture related is being loaded from the WWW.

It’s hard to get a handle on which process is taking the longest because, when testing in the Unity editor, the models load almost immediately.

Each of the processes, downloading, mesh building, parameterization and texturing is a coroutine that runs in sequence.

Once loaded, everything performs flawlessly. The mesh building duration is the one problem that is keeping this app from being fantastic.

Any suggestions would be greatly appreciated.

hmm - you could print() out timestamps after major steps and look in XCodes Console while running the code on the device.
The Debug-output is still shown there…

hmm - it just hit me…
your user name is “ikeo” and you are dealing with arch objects DL from the web… it might not be the case that you actually work for “Ikea” or on a tool for “Ikea” to show their products on the iPhone ? :lol:

nice try spacefrog.

my name is ian keough, thus ikeo. no assocation with IKEA. sorry to get your hopes up.

Your suggestion is sound, I should probably be checking the timestamps in XCode, just wanted to see if there were any other obvious no-nos that I was committing.

If you use the “insane” size in Realmaze3D, it generates a series of meshes that total about 130K verts and 85K tris, in a few seconds or so. Most of that time is spent on lighting calculations, so just constructing the meshes alone would be well under one second.

Unfortunately I don’t know what to suggest, other than that the process should be almost instant in your case.

–Eric

Thanks for the thought guys. But as it ends up, I’m just an idiot. There was an operation in my code for creating the submeshes that was searching linearly through my list of verts… for every vert. Big models were crushing the thing. Whacked that code and it’s a-ok.

I