tyFlow Forum
Remove duplicate materials - Printable Version

+- tyFlow Forum (https://forum.tyflow.com)
+-- Forum: tyFlow Discussion (https://forum.tyflow.com/forum-1.html)
+--- Forum: Feature Requests (https://forum.tyflow.com/forum-4.html)
+--- Thread: Remove duplicate materials (/thread-4046.html)



Remove duplicate materials - SteveDeeGreen - 01-21-2024

Hi,

since Meshrepair was introduced to work with imported geometry, I recently had a few FBX files which also have the mesh broken up per material, but also a separate material per object so, there were 1500 of them when in reality it's only 3

I found a script on the chaos group forum which goes through and condenses it - it works, but it takes 6 hours

https://forums.chaos.com/forum/chaos-common/chaos-common-off-topic/1024162-maxscript-condense-materials-with-same-name

I wonder if that's something that tyflow could do more quickly?

Thanks


RE: Remove duplicate materials - tyFlow - 01-30-2024

Oh wow...6 hours. That's....not ideal Smile

I'm not sure I even understand the problem, but if you send me the file I can take a look.


RE: Remove duplicate materials - SteveDeeGreen - 01-30-2024

Might be a bit tricky - it's from a commercial client


Hi,

thanks

Basically it's a 3D card model, which really just has 3 distinct materials - front, back and side.

However, whatever they export it from creates a new material for each material ID, so one piece would have 3 materials

It then does the same for each piece of the model, so a 500 piece puzzle ends up with 3 materials x 500 - 1500 materials but it's really only 3?


I might be able to send it over, but I'd need to clear it with the client, and they're gearing up for an expo at the moment.
Not sure if I could recreate a dummy example in Max since Max won't allow you to create duplicate materials with the same name, but will let you import them!

I was sent a script by a friend that they wrote internally which does it quicker, but it still takes a while...


RE: Remove duplicate materials - tyFlow - 01-30-2024

I see, so you have 500 objects, and each object has 3 material IDs, and each object also has its own multi-sub material applied containing 3 materials...and what you know (but what Max doesn't know) is that those 3 independent materials applied to each object, could actually be the same 3 materials applied to every object?

I guess the tricky part, is what happens if piece number 499 has 3 materials applied, but those 3 materials are not meant to be the same 3 materials applied to every other piece? What would differentiate them? You mentioned them having the same name as the other materials...is that the only thing? It would be easy enough to group/instance materials by name, but if the names of the "same" materials don't match, then that's a much bigger issue because there's no easy way to tell that the materials are identical, besides individually comparing every single one of their properties (which would indeed be slow).


RE: Remove duplicate materials - SteveDeeGreen - 01-30-2024

(01-30-2024, 04:05 PM)SteveDeeGreen Wrote: Might be a bit tricky - it's from a commercial client

Yeah, I asked and they said no I'm afraid

I'll keep pushing to see if I can get a basic shape out of them, but it's going through several layers not directly with the people who are building them

(01-30-2024, 04:13 PM)tyFlow Wrote: I see, so you have 500 objects, and each object has 3 material IDs, and each object also has its own multi-sub material applied containing 3 materials...and what you know (but what Max doesn't know) is that those 3 independent materials applied to each object, could actually be the same 3 materials applied to every object?

I guess the tricky part, is what happens if piece number 499 has 3 materials applied, but those 3 materials are not meant to be the same 3 materials applied to every other piece? What would differentiate them? You mentioned them having the same name as the other materials...is that the only thing? It would be easy enough to group/instance materials by name, but if the names of the "same" materials don't match, then that's a much bigger issue because there's no easy way to tell that the materials are identical, besides individually comparing every single one of their properties (which would indeed be slow).

Not quite,

there are no sub-materials

They're all called 1, 2, or 3 and the objects are split up by material.

So if you had 2 cubes, you would have 2 copies of 6 materials

Comes in like this

For some reason the first of the materials lists the diffuse map, but they're all the same

Also all the material IDs for the meshes are 1

Like I said, I run it through these scripts and it does remove the duplicates, and takes them down to 3 unique ones from thousand+, it just takes a while


If that's any help?