Wednesday, November 4, 2020

 Regarding fracturing, I am now addressing an issue that I've been aware of for quite some time but have yet to confront--the random reordering of Material IDsThis issue is brought to bear by the need to reuse the door mesh, which uses different, unique materials for the jail, the saloon, & the hotel.

Evidence of the swapped material IDs is exhibited when attempting to manually reassign materials to the individual fragments. ID 1 should be the facade of the door and ID 2 should be a generic wood, yet it can be clearly seen that this is not the case. 

After some searching I found this thread on the Unity forums indicating that on import Unity correlates vert/face values with material ID values. For example, whatever material the very first face (however that is defined) is using would be material 01, whatever material the second face is using would be material 02, etc. In essence, the specific sequential ordering of the faces directly affects the order of the materials on those objects, so despite the objects displaying the correct material ordering in Blender, the import into Unity does not. 

I found a solution here, and (in Blender) select all of the verts of every fragmented object and then "sort mesh elements" by material (ensure the "faces" option is selected). This will effectively reorder the faces according to materials, which is what we need. 

As a side note, I also merged verts by distance and was surprised to see that it removed 6000+ verts without noticeably affecting the mesh. I should do this for all fractured pieces and reimport.

No comments:

Post a Comment