Announcement

Collapse
No announcement yet.

tidying up a scene with 1000's of nearly identical materials.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • tidying up a scene with 1000's of nearly identical materials.

    ive got an fbx of a satellite that has been converted from who knows what. not only is it 18000 objects (in some parts each poly is an object) but it also appears to have 18000 (non vray, sometimes cryptically named) materials to go along with it.

    i initially assumed that the names were consistent (i.e. 1000 materials all named "brushed steel" ) in which case a script like "instance materials by name" from the kstudios pack would have resolved it fairly easily.

    however on seeing the full list of materials i see i have, for example:


    brushed steel -32 copies
    brushed steel#1 -43 copies
    brushed steel_base -97 copies
    brushed steel_base #54 -12 copies


    etc etc.

    so in the end even if i condense all the identical ones, ill *still* have several hundred+ materials, and the kstudios one only works for IDENTICAL names.

    what i want is a script that allows me to choose a chunk of materials from a list (even with varying names) and instanciate them all to a single material.


    any suggestions? client is (of course) expecting that ill just be able to grab this model and use it. if i have to spend a week cleaning it up itll be an issue.


    Last edited by robin_lawrie; 31-10-2024, 03:23 AM.

  • #2
    As a quick fix maybe do this:

    Identify how many materials there are, disregarding copies.
    E.g. if there are 5 materials then create 5 objects and assign each one of the 5 mats. Save selected objects and delete/remerge them, which will give the opportunity to overwrite those existing 5 mats, which
    should then be the only materials in the scene.
    https://www.behance.net/bartgelin

    Comment


    • #3
      Originally posted by fixeighted View Post
      As a quick fix maybe do this:

      Identify how many materials there are, disregarding copies.
      E.g. if there are 5 materials then create 5 objects and assign each one of the 5 mats. Save selected objects and delete/remerge them, which will give the opportunity to overwrite those existing 5 mats, which
      should then be the only materials in the scene.
      that works for identically named materials.. as noted ive already got a script to instanciate those. my problem is the hundreds (possibly more than a thousand) *similarly* named materials i.e. brushedmetal #1, brushedmetal #2, brushedmetal_panels, brushed_metal etc etc.

      Comment


      • #4
        Ah ok, I see. Nothing's ever simple with dumb imports

        Hopefully there's a scriptable method to sort it out.
        https://www.behance.net/bartgelin

        Comment


        • #5
          no the scene is a real mess, 4600 max objects, a heirarchy based on linked helpers at least 20 branches deep, with everything named semi-randomly, half an object (random faces) in one max object, 3 faces in another, and the rest in a third. god knows where it was exported from, almost looks deliberate. all i can say is the source is a multibillion dollar space technology company so youd think they would have some good workflows.

          Comment


          • #6
            I don't use built in Max importer due to reasons described above.

            Click image for larger version

Name:	Screenshot 2024-11-02 062710.jpg
Views:	48
Size:	46.0 KB
ID:	1219463

            I use Polytrans importer instead. The resulting scene is better organized but still contains proper hierarchy.

            Click image for larger version

Name:	Screenshot 2024-11-02 Polytrans.jpg
Views:	43
Size:	46.6 KB
ID:	1219464

            Comment


            • #7
              Originally posted by robin_lawrie View Post
              ive got an fbx of a satellite that has been converted from who knows what. not only is it 18000 objects (in some parts each poly is an object) but it also appears to have 18000 (non vray, sometimes cryptically named) materials to go along with it.

              i initially assumed that the names were consistent (i.e. 1000 materials all named "brushed steel" ) in which case a script like "instance materials by name" from the kstudios pack would have resolved it fairly easily.

              however on seeing the full list of materials i see i have, for example:


              brushed steel -32 copies
              brushed steel#1 -43 copies
              brushed steel_base -97 copies
              brushed steel_base #54 -12 copies


              etc etc.

              so in the end even if i condense all the identical ones, ill *still* have several hundred+ materials, and the kstudios one only works for IDENTICAL names.

              what i want is a script that allows me to choose a chunk of materials from a list (even with varying names) and instanciate them all to a single material.


              any suggestions? client is (of course) expecting that ill just be able to grab this model and use it. if i have to spend a week cleaning it up itll be an issue.

              This sounds easily scriptable actually, you can try ChatGPT for that. I wrote a bunch of scripts together with ChatGPT or Claude.ai to clean up things like this. I'd say give it a try.
              A.

              ---------------------
              www.digitaltwins.be

              Comment


              • #8
                Originally posted by Vizioen View Post

                This sounds easily scriptable actually, you can try ChatGPT for that. I wrote a bunch of scripts together with ChatGPT or Claude.ai to clean up things like this. I'd say give it a try.
                yeah i tried chatgtp, copilot and claude.ai (all free versions) not one of them could produce a working script, and all had a habit of going round in circles with their modifications when shown the error messages.. not impressed.

                Comment


                • #9
                  Originally posted by robin_lawrie View Post

                  yeah i tried chatgtp, copilot and claude.ai (all free versions) not one of them could produce a working script, and all had a habit of going round in circles with their modifications when shown the error messages.. not impressed.
                  Yeah the free versions aren't good enough for that most of the time, also it helps if you have a bit of coding experience prior ofcourse.
                  A.

                  ---------------------
                  www.digitaltwins.be

                  Comment


                  • #10
                    Is it possible to do this based on geometry itself. I normally use search word based on *object name* and this way make selection sets. Another option would be to select objects based on face amount. If there are unwanted objects selected as well just unselect those.

                    This is my way for organizing scenes containing hundreds of thousands of objects.

                    Comment


                    • #11
                      in the end this script sorted the scene enough to start going through the geometry and tidying up:

                      https://miauu-maxscript.com/portfoli...rials-reducer/

                      it reduced the scene from 4000+ materials to 12.. took a while to process but does not appear to have broken anything. client also finally sent through some (bad) reference photos, so i have something to work from. thanks all.

                      Comment


                      • #12
                        That's a lucky find! Glad you got a solution as the thought of manually doing this was anxiety-inducing lol
                        https://www.behance.net/bartgelin

                        Comment

                        Working...
                        X