Wing Blender (WCP/SO Blender plugin)

Kevin Caccamo

Rear Admiral
It's been a long time..
Anyway, if you've tried to use the importer, you'll know that it is sluggish as hell. I've been trying to work on that. I made a few optimizations to the importer recently, which mostly involve using flat typed arrays instead of lists of lists, and it turned out to be MUCH faster than what I had.
Here are my test results on models from the MUP:
master: 45.777912414999946 seconds to import SHRIKE.IFF
optimized importer: 4.5732363529998565 seconds to import SHRIKE.IFF

master: 1.6189115940001102 seconds to import AST_S_01.IFF
optimized importer: 1.447341495999808 seconds to import AST_S_01.IFF

optimized importer: DEVASTAT.IFF took 7.95558235999988 seconds to import
optimized importer: cruiser.iff took 6.280457260000276 seconds to import
 

Kevin Caccamo

Rear Admiral
With my most recent optimizations, I was able to cut the import time in half! Well, at least for the more detailed meshes. AST_S_01.IFF hasn't shown much improvement in terms of import time, but that's because the other bottleneck is the MAT reader, and I have no idea how I could optimize the MAT reader any further.
And now for the numbers:
SHRIKE.IFF: 2.7380151280012797 seconds
AST_S_01.IFF: 1.4047294970005169 seconds
cruiser.iff: 3.3131252189996303 seconds
DEVASTAT.IFF: 3.978092076999019 seconds
 

Darkmage

Vice Admiral
Arrays are how opengl handles geometry now. Graphics cards will generally only accept arrays which is why the speed up is so dramatic. Display lists are basically a dead design.
 
Hey @Kevin Caccamo , How does Wing Blender currently handle "DOCK" chunks? I think it sort of ignores them? Is that support that could be added assuming it doesn't exist? I think it would be useful in our current remodel project as well as any future mods to be able to define docking points on meshes.

Thanks!
 

Kevin Caccamo

Rear Admiral
After taking a quick look through the game files, it looks like DOCK chunks are a feature of the ship files, not the mesh files. I have no idea what DOCK chunks do or how they work, and Wing Blender was designed to export mesh files.

As for the performance boost, I don't think it has anything to do with OpenGL. After I get the mesh data from the mesh file, I have to construct a mesh for Blender, and it's the construction phase which was taking the most time. The loop on lines 297-305 of import_iff.py became much faster once I started using a dict, with the edges converted to frozensets as keys, and the edges' indices as values. I received another significant speedup once I moved the "bl_mesh.loops.add" line above the second loop that iterates over the face data. ("loops" are corners of a face, consisting of an edge and a vertex)
 
@Kevin Caccamo I have a question on exporting meshes w/LODs. I can't seem to find any documentation on it so maybe you can assist. I've tried two different methods and neither seem to work. The first is I leave the two meshes unparented and try and export the entire scene. I get the following error:
LODerror1.JPG


If I parent LOD 1 to LOD 0 I get a giant mega-error:

LODerror2.JPG


I have my objects named MARLIN-lod0 and MARLIN-lod1 per (I believe the instructions)

LOD.JPG


I'm sure it's probably an ID10T error, but I can't find any full documentation on the process so I thought I'd ping you and see if you had any insight.

Thanks!
 

Kevin Caccamo

Rear Admiral
Try writing 'lod' after the dash using lowercase letters instead of uppercase letters, and having one of the 2 LODs selected.
 

Kevin Caccamo

Rear Admiral
All the LOD meshes should be at the same place in the hierarchy, so leave them unparented, unless the mesh is supposed to be a child of another mesh.

Also, I tried writing LOD in capital letters, but I couldn't reproduce the errors you're getting with Blender 2.79b.
 
I got it figured out - thanks! I rebuilt the file and found two issues, followed the advice above and it works as expected. Thanks for the help!
 
Top