Hello,
Everybody on other forums use the check every face to read the Used Material IDs from an object, but there is a basic ID list in Editable Poly. I attached an image about it.
The only problem is that there is no chance to read this list from the Editable Poly.
Do somebody knows how can i read this list by script?
By
Comments (13)
Comment policy
.
You can also make an unsafe version of it and it will work at least two times faster.
jahman, you rock! i tried it out on a 4.000.000 tri object and take 1 second! fantastic, thanks a lot!
furthermore it works on edit poly and edit mesh as well
.
Glad to hear that. It should work ok with anything convertible to mesh.
upd
Here're my numbers :)
Numfaces 4224000
Time: 0.293sec. Mem: 544L
Unsafe Time: 0.058sec. Mem: 544L
That only shows when MultiSubObject material is assigned (and only would display all the ids if the multimaterial had the right number of matching id materials).
Yes, you are right. When you have more very high detailed objects, it's the fastest way to drop a multi material to the objects with 100+ sub material, and read the ID-s, and restore the materials - instead of check every face with ID information.
For personal use where you're pretty sure you don't exceed that, I agree; for a production-ready tool, you'd need 65536 submaterials (some pipelines use fixed id per material). But unless you're working with extra dense meshes, getting the ids used by ~10k mesh shouldn't take more than tenth of a second anyway.
.
There's also <IGameMesh>.GetActiveMatIDs method available, but unfortunately I couldn't find a way to use it from maxscript.
Wow, i think this is the right way, thanks!
It should be work somehow... I will read about it, hope can solve.
.
.
Thanks a million Vojtěch.
I couldn't run it in 2014 (Global.IGameMesh is absent), but in 2016 works just fine. But it is surprisingly slow compared to what I've posted above. 4kk mesh processed in about 9-10sec
Yeah, IGameMesh is more about convenience than speed, though I wouldn't have expected it to be that slow either. That sounds like even snapshotAsMesh+getFaceMatID in maxscript would be faster.
This tool works for specific workflow, you are right it's not a production-ready tool for everybody. Just for personal workflow.
One object is 5-10.000.000 polygon unfortunately.