Materials with Multi Sub Objects

Hi i am using Element 3d and it uses the Materials slot of a .obj or a .c4d model only. However some very good free models i have have only one material slot and when i opened them in 3ds max i found out that the single default material had multiple sub objects. Since Element 3d cannot read multi sub objects or even objects for that matter i was wondering how to convert/assign each sub object its own separate material via script or otherwise.

P.S. i am a complete Newb. 4chan warned you about me :P

Thank You!! ^^

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Code Lyoko's picture

Thank you very much once again, for your replies

I am sorry i think i did not make myself clear, what i want is that as you can see only one materiel (the 'Default' one) and inside it are a lot of objects, i want them (the objects) to become individual materials like the Default. Here is a screenie of what i mean. Thank you very much for taking out your time for this, means a lot :)

AttachmentSize
hmmm.png 271.9 KB
Anubis's picture

try this then...

select your scene objects and run that script:
for o in selection do o.mat = copy o.mat
that should unlink their mats from the parent material.

my recent MAXScripts RSS (archive here)

Code Lyoko's picture

Thank you very much once again, for your replies

Maybe i didnt make myself clear, as you can see there is only ONE default material and it has sub objects, what i want is to make every sub object Cap_11 for eg an individual material (like the default one)..... Here is an example of what i mean by different materials ....... Seriously i really appreciate you guys taking the time out for this. thank you :)

AttachmentSize
hmmm.png 271.9 KB
barigazy's picture

After adding selection

After adding selection material to the MaterialEditor you can change a name or any other parameters of mtl and create new materilal library for later use.

barigazy

barigazy's picture

this will extract all

this will extract all sub-mtls and place it in the material editor. Don't forget to select object with multi sub material.

obj = selection[1]
if obj != udefined do
(
	objMat = obj.material
	if objMat != udefined do
	(
		objMatSubs = objMat.materialList
		macros.run "Medit Tools" "clear_medit_slots"
		for m = 1 to objMatSubs.count do
		(
			meditMaterials[m] = objMatSubs[m]
		)
	)
)

barigazy

Code Lyoko's picture

Thanks but the script doesnt appear to be working, my fault?

I clicked a random part of the model (an object) and ran the script however it is giving the following error , i apologize if it is my fault since i am completely new to 3ds max.

AttachmentSize
hmmm.png 312.72 KB
Anubis's picture

where is the problem then?

From atteched picture I see that your objects already has separate standard material :)

my recent MAXScripts RSS (archive here)

barigazy's picture

I ask myself this question

I ask myself this question yesterday :)
Every part is detached and have Standard mtl

barigazy

barigazy's picture

You recive the error because

You recive the error because your selected part have assigned Standard material.
I edit the snippet

obj = selection[1]
if obj != udefined do
(
	objMat = obj.material
	if objMat != undefined do
	(
		macros.run "Medit Tools" "clear_medit_slots"
		case classof objMat of (
			(standard): meditMaterials[1] = objMat
			(Multimaterial): (
				local objMatSubs = objMat.materialList
				for m = 1 to objMatSubs.count do (meditMaterials[m] = objMatSubs[m])
			)
		)
	)
)

barigazy

Code Lyoko's picture

Sorry for double posting ....

I am sorry i think i did not make myself clear, what i want is that as you can see only one materiel (the 'Default' one) and inside it are a lot of objects, i want them (the objects) to become individual materials like the Default. Here is a screenie of what i mean. Thank you very much for taking out your time for this, means a lot :)

AttachmentSize
hmmm.png 271.9 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.