Notifications
Clear all

[Closed] Problems with Multi Material

Hello Everyone,

what i am trying to do here is to get the multi material in the material editor slot and then
change the refraction and reflection glossiness to 1 ( USING VRAY MATERIAL).

this is what I am doing:

x = ( for o in selection where classof(o.material) == MultiMaterial collect o)

for i = 1 to x.count do
meditMaterials[i] = x[i].material

if i > x.count then
i = i + 1


i somehow know that using the following command makes changes in the multi material mode:
for j = 1 to x[i].material.numsubs
meditMaterials[i].material = x[i].material[j]

so now i would like the reflection glossiness of all the materials to be 1

meditMaterials[i].material[j].reflection_glossiness = 1

me being a noob
and then after this max gives an error…

so how to compile the code that it works properly??

Please do help !!!

3 Replies

try this one


x = ( for o in selection where ((classof o.material) == MultiMaterial) collect o)
for obj in x do
	for submat in obj.mat do
	(
		--submat.reflection_glossiness = 1
		submat.glossiness = 1
	)

Hey Thank You…

Here is what I made after racking my head…

a = (for o in SceneMaterials where classof(o) == MultiMaterial collect o)

for i = 1 to a.count do
(
if i < a.count then
(
for b = 1 to a[i].numsubs do
(
a[i].material[b].diffuse = red
a[i].material[b].reflectionMap = undefined

)

)

This helps me circulate through all the subMaterials…

a = (for o in SceneMaterials where classof(o) == MultiMaterial collect o)
for i = 1 to a.count do

You can directly operate on the material instead of collecting it and again looping on the collection.

for i = 1 to a.count do
(
if i < a.count then

since you are going from i=1 to a.count, i is always less that a.count(except when i=a.count). You dont need a if statement.

for b = 1 to a[i].numsubs do

sometimes numsubs can be different from the actual materials in the multimaterial, check Multimaterial Help page in Maxscript Reference for details.
And try this code(not tested, hope it works for you):


for mat in SceneMaterials where classof(mat) == MultiMaterial do
(
	for i=1 to mat.materialIDList.count do
	(
		mat.materialList[i].reflection_glossiness=1
	)
)