I’ve tried the model and see the problem. It’s a combination of things that causes the loss or other order of materials:
As you know Away3D is very flexible with materials, where you can set a material on mesh or on submeshes. You also can have null material on mesh and have just one submesh material…
In your case, the models are having both submeshes and meshes materials set. And here comes the flaw: In awd parser there is a rule that says, if a material is set in block and if the mesh has only one subgeometry, set the mesh material equal to the first entry in stored materials. This leads to unexpected result in your case, because in Away and Prefab, submeshes material have priority. so Prefab/away render the submesh. However, when Prefab exports, it parses the objects, save them all. Where a typical mesh in your model would lead to the sequence: write mesn material, write mesh submesh 0 material. At reconstruct time, because of the awd rule, the materials collected (2) only first one is used because your meshes hold only 1 submesh. So the first material entry is set on mesh. as a result the reconstruct is not what the original source was and aspect on screen is different. Unfortunatly for the 2.0 specs, changing parser behavior would break the format.
So how can you go around this flaw for now? You have 2 options:
- 1 change your export option in your editor or use another format such as obj where multiple materials per mesh are ignored.
- 2 in Prefab, open each mesh info, and set for every submesh a null material. Assign the material that you want to the mesh.
To illustrate I’ve made a project where I deleted all materials and assigned new ones (not done all as there are 67 meshes in this model). http://www.closier.nl/downloads/forum_files/peugeot.zip
I haven’t merged where necessary, so some parts like doors need to be either merged or collapsed, then get unique mesh material. Then you can see that once assigned this way awd is exported and reloaded with the intended material. Again, in this project, I haven’t done it on all meshes, so reloading the awd will fail as before on some meshes.
I’ll try to add another rule for awd2 exports, that should simplify this process. Unfortunatly a fullproof fix is not in the game. I’ve talked with Richard about this and we’ll take that in account for awd 2.1 specs.