Home Technical Talk

3ds Max - Remove Duplicate materials from Multi-sub object

mawilbolou
polycounter lvl 11
Offline / Send Message
mawilbolou polycounter lvl 11
Hi guys...

I am working on Max 2012 and am working on quite a big scene.

I have combined a number of models together and sampled the multi-sub material in the Material Editor.

Unfortunately, it seems that Max has generated about 300 different materials, even though I am only using about 20 textures. After looking at some of the materials, I have found that there are alot of duplicate materials that are using one texture.

Is there a script that detects by texture, then deletes the duplicates?

Any help would be massively appreciated..

PS I have tried using the "Clean MultiMaterial Utility"

Cheers

Replies

  • monster
    Offline / Send Message
    monster polycounter
    Hey bro, I had this script laying around. If you are only using diffuse maps it might help you.
    (
    	prevMatCount = scenematerials.count
    	diffuseMapList = #()
    	materialList = #()
    
    	scenemats = scenematerials
    
    
    	for m = 1 to scenemats.count do
    	(
    		dmapFile = scenemats[m].diffuseMap.filename
    		getMat = findItem diffuseMapList dmapFile
    		
    		if getMat == 0 then
    		(
    			--MATERIAL NOT FOUND, ADD IT TO THE MATERIAL LIST
    			append diffuseMapList dmapFile
    			append materialList m
    		)
    		else
    		(
    			--MATERIAL FOUND, APPLY TO ALL IT'S OBJECTS
    			for obj in refs.dependents scenemats[m] do
    			(
    				try
    				(
    					obj.material = scenemats[getMat]
    				)
    				catch()
    			)
    			
    		)
    	)
    	
    	gc lite:true
    	
    	messageBox ("Materials condensed from " + prevMatCount as string + " material(s) to " + materialList.count as string + " material(s).") title:"Materials"
    )
    
  • monster
    Offline / Send Message
    monster polycounter
    duplicate post
Sign In or Register to comment.