How to delete scene materials? How can I see to which objects a material is assigned? & other basic questions

How to delete scene materials? How can I see to which objects a material is assigned? & other basic questions

BenediZ
Collaborator Collaborator
11,301 Views
12 Replies
Message 1 of 13

How to delete scene materials? How can I see to which objects a material is assigned? & other basic questions

BenediZ
Collaborator
Collaborator

Hello,

 

coming from Maya, I'm always confused about the Material editor, which for example never gives free access to deleting. Thanks for helping me to understand:

 

1.) How can I delete scene materials, which I don't want to keep?

I don't want them not to be used anywhere and instead replaced by a single new material.

 

2.) How can I select all objects which use an unknown scene material, in order to see where this material is assigned (e.g. with isolate select)?

 

3.) When I use "Select by material", it only opens a window to select myself objects. This makes no sense to me....

What is it good for?

 

4.) There are many free sample slots in the compact Material Editor. Again I ask, what is that good for?

It's confusing that there are just random unknown materials, without any meaning just wasting space 🙂

 

Many thanks in advance

 

Material_Map Browser.jpg

0 Likes
Accepted solutions (1)
11,302 Views
12 Replies
Replies (12)
Message 2 of 13

BenediZ
Collaborator
Collaborator

only for 2.) and 3.)

I think I was able now to select objects by material. I just hit "enter" in the selection window without touching anything.

(It seems some objects were invisible in this test scene, so I thought there is nothing selected)

0 Likes
Message 3 of 13

darawork
Advisor
Advisor

Hi,

To delete scene materials we, in Max, have to run Maxscipt.
I also find it frustrating that there isn't really a proper 'Purge' command with an array of handy options.

This is something that is sorely missing from the current Max Environment.

You have correctly deduced how to 'Select by Material'. And, yes those items upon which you have decided to select are in fact selected when that window pops up... along with all of the other elements listed that aren't, for some not very handy nor functional reason. The items with the material you enquired are highlighted, although they may be out of view in the list. Scrolling up/down will show which items have been selected. Do not click any other items or the selection will be lost. This is all part of the 'fun'.

If you ever want to delete all materials, say at the start of a project that has come from another user or through a conversion process , this is the Maxscript that will delete all the scenes materials and replace them with the default material. Only do this if you absolutely want to delete ALL materials;

Open Scripting/Maxscript Listener and type this

 

 

 

 

 

$ *.material = undefined

 

 

 

 



Hopefully, the more of these types of posts that appear here on the forum, the more chance that someday someone who programs this stuff will take note about how convoluted and ultimately useless the current process is.

As for the Compact Material Editor (CME), if you are coming from MAYA and are new to this type of material library display, I would 100% suggest that you learn the Slate Material Editor (SME) instead. It is initially a lot easier to see what is going on through visual nodes. And unlike the CME you can actually see the material as a whole process rather than a series of pages that hide the last thing you were looking at.

All that said; The only thing that the CME is good for over using the SME is the ability to right-click a material preview and copy it, then Paste[As Instance] to globally replace one material with another new one. That is the only reason I ever use the CME anymore. It's handy say for instance if you import SketchUp models and want to replace their materials with something nicer.

Darawork
AutoDesk User
Windows 10/11, 3DS Max 2022/24, Revit 2022, AutoCad 2024, Dell Precision 5810/20, ASUS DIY, nVidia Quadro P5000/RTX 5000/GTX760

Message 4 of 13

BenediZ
Collaborator
Collaborator

Many Thanks!

so it means I can't delete even one single selected scene material? Is that possible? 😬

 

In this case I have some materials I want to keep and default materials, I want to get rid of them.

 

The only workaround I once have found, to only keep materials of selected objects, is to export them as selection (Max file) and then import into new Max scene.

 

Indeed I only use the SME (I have just shown a screenshot of CME, because this looked so strange to me).

In the SME I'm always trying like in Maya to delete nodes, but it's only the instance.

It seems to be a limited node system.

0 Likes
Message 5 of 13

BenediZ
Collaborator
Collaborator

@darawork  I'm not sure if I understand right: Is that script useful for deleting one scene material? If so, how do I change it for a specific material?   thanks!

0 Likes
Message 6 of 13

darawork
Advisor
Advisor

Hi,

No that script is only for deleting all scene materials. Use it very carefully.
I do not know how to delete one single material from the scene.

I use Corona Rendering engine, so when I come across any materials incompatible with the renderer I use the Corona Scene converter that comes with the rendering engine to convert all scene materials into materials it can use.

Perhaps the rendering engine you have chosen to use can do that too?
The ART rendering engine comes with a similar converter routine.

Darawork
AutoDesk User
Windows 10/11, 3DS Max 2022/24, Revit 2022, AutoCad 2024, Dell Precision 5810/20, ASUS DIY, nVidia Quadro P5000/RTX 5000/GTX760

0 Likes
Message 7 of 13

darawork
Advisor
Advisor

Hi,

I just found this script that I didn't know existed until now;

$. mat = null

 

"Materials can be removed by typing '$. mat = null' in the command box while selecting the object you want to to remove the material for."


Darawork
AutoDesk User
Windows 10/11, 3DS Max 2022/24, Revit 2022, AutoCad 2024, Dell Precision 5810/20, ASUS DIY, nVidia Quadro P5000/RTX 5000/GTX760

Message 8 of 13

jon.bell
Alumni
Alumni

Hi @BenediZ,

 

Thanks for your question. I'm not sure why it's so important to "remove" materials you don't like from a given scene -- if you want, you could simply hide the objects that you've already applied your preferred materials to, then press Control-A to select the rest and apply a generic gray material to all of them.

 

As for "Select by Material," I use this command in probably every single 3ds Max session I work in. It's incredible useful to see what objects have been assigned which materials. (And as others have pointed out, the Compact Material Editor is just one way of working -- if you want a node-based system, you could switch to the Slate Material Editor.)

 

If you do want to remove assigned materials completely from objects in your scene, or perform quite a few other useful functions, I recommend getting Neil Blevins' free Soulburn scripts, which are excellent. You can download them from here (please see his instructions on how to install them and then drag them into a new Toolbar). Hope this helps!



Jon A. Bell
Senior Technical Support Specialist, 3ds Max
Message 9 of 13

BenediZ
Collaborator
Collaborator

Thanks,  the reason is, when cleaning and sortings scenes  - especially CAD data, where you have 80 or 100 "wrong" default materials, which have to be replaced - this ends with a lot of unused unneeded scene materials.

In Maya, I can delete all UNUSED scene materials, which will keep everything needed for the scene and slims the scene size, too, and keeps the scene tidy without garbage.

It's not about only un-assigning a material which still remains in the library, I want to delete those wrong default materials not to disturb anymore and not to crowd the node editor in old tabs.

 

And it gets even worse, when you merge two scenes, which both carry all this ballast.

 

p.s. If there are other known workflows, I'm happy about learning links.

0 Likes
Message 10 of 13

domo.spaji
Advisor
Advisor

@BenediZ 

There are no nor can be unused scene materials!

Scene material is material used and applied to scene objects (including flatten meshes in UV Editor).

 

@jon.belland others

There's no need for any "foreign"  scripts, there's UVW Remove Utility with option to remove (only) material from obj.

Although it wasn't intended for asked purpose because that is totally unnecessary, as you already said little nicer.

 

There are build in tools for clearing unused materials and maps in/from  material editor.

 

@darawork 

Remove asterisk from first script line and it will work same as second.

 

PS.

Searching script solution for every "problem" and situation is major vast of time.

0 Likes
Message 11 of 13

jon.bell
Alumni
Alumni

Hi @domo.spaji,

 

There are multiple ways to remove materials from a 3ds Max scene, which folks here have addressed. I suggested various options (including scripted ones) in case the built-in Material Editor tools (Clean Multi-material, Instance Duplicate Maps, etc.) didn't do what the customer wanted.

 

As you noted, there are no "unused" materials in a 3ds Max scene. However, you can have unique but identical default materials applied to each imported object in a scene, which can be annoying. There are scripts that can consolidate materials with identical parameters, but a brute force method (if you don't want to use the UVW Remove Utility) would be to simply select all the objects in a scene with identical (but differently-named) "default" materials, then apply a single material to those to reduce the overall number of materials used in the scene.

 

I do agree that 3ds Max could use some more advanced built-in tools to help users combine and consolidate materials using these types of CAD workflow. But for now, there's no single "right" answer on how to address this -- it's up to exactly what the customer wants to optimize and accomplish in the scene. 🙂



Jon A. Bell
Senior Technical Support Specialist, 3ds Max
Message 12 of 13

jon.bell
Alumni
Alumni

Hi @BenediZ,

 

Just wanted to check back with you to see if the suggestions offered here helped, and if you had any further questions.

 

If the information provided here fixed your issues, could you please mark them as Solutions? Thanks!



Jon A. Bell
Senior Technical Support Specialist, 3ds Max
0 Likes
Message 13 of 13

jon.bell
Alumni
Alumni
Accepted solution

Hi @BenediZ,

 

I wanted to follow up with you on this issue.

 

Materials shown in the Material Editor (either Compact or Slate) aren't necessarily used in the scene itself; they're simply being displayed in the Editor and available to be applied, modified, saved or removed. You can clear out any materials not used in the actual scene and applied to specific objects by removing them from either version of the Material Editor.

 

Now, having said that, there is an issue where you can import large numbers of objects (from a CAD program, as you mention) and get 100 copies of "Chrome #348," which (technically) 3ds Max shouldn't allow. Although you can have multiple versions of the same-named material in the Material Editor itself, only one instance of a "Chrome #348" material (or any other material name) should be present in the scene at any one time.

 

I'm lobbying the developers for a fix to this, but in the meantime, here's a workable solution: download this free KStudios script pack and use the Instance Materials script. This allows you to place the first instance of a duplicated material (name) into the Compact Material Editor, say, then replace all other same-named instances in the scene with that material. It's a great way to optimize your workflow and I'm hoping we can get this function incorporated into 3ds Max shortly.

 

Please let me know if this helps, and we hope to hear from you soon!



Jon A. Bell
Senior Technical Support Specialist, 3ds Max