convert multimaterial to vray material with some more conplexity

Hello everybody

I' tring to devellop a small utility which could automatise a very boring and repetitive task.
and since it's my first attemps to make a script in max I'm looking for some help.

The reason of the script is that i work for a small game project and want to make rendering
whith the the different scene exported from our engine (which contain props and bsp). the engine export the material as multimaterial with for each texture a submaterial and that is where the problem is.

I would like that the script convert all the multimaterial of the scene (or better of the
selected object) to vray material.
But I want that it take the diffuse texture from the submaterial 1 and place it on the diffuse map
slot of the Vray shader,
take the diffuse texture from the submaterial 2 and place it on the spec map slot of the Vray shader,
take the diffuse texture from the submaterial 3, create a normal bump in the bump map slot of the Vray shader and place it the texture.
and finaly show the diff map texture of the vray material viewable in the viewport

I hoppe somebody can understand what I mean.

After a week of trying and trying I can convert every standart material from a multimaterial as a vray material but thats all.

I hoppe that somewhere a person with a better knowledge than me could and a big heart could show me the way to do it

I would really appreciate any help

\\\ THANK YOU \\\

Comments

Comment viewing options

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

i now its late to answer it but i saw it now :(

i find this from maxscript listener.
when you change
an option from material slot, the listener returns me this values.
hope that it helps...

"
meditMaterials[1].materialList[3].Diffuse = color 0 246 173
meditMaterials[1].materialList[3] = VRayMtl ()
meditMaterials[1].materialList[3].texmap_diffuse = Bricks ()
"

francoiscoiscois's picture

Hello again I have make some

Hello again

I have make some progress but still have a lot of probleme, and could really appreciate any help
right now hier is my script

for o in selection where o.material != undefined do
(
if classof o.material == Standardmaterial do
(

tt = VRayMtl ()
tt.texmap_diffuse = o.material.diffusemap

tt.diffuse = o.material.diffuse
o.material = tt
showTextureMap o.material o.material.diffuseMap false
)
if classof o.material == Multimaterial then
for m = 1 to o.material.numsubs do
(
if classof o.material [m] == Standardmaterial do
(

tt = VRayMtl ()
tt.texmap_diffuse = o.material[m].diffusemap

tt.diffuse = o.material[m].diffuse
tt.texmap_bump = Normal_Bump ()
tt.texmap_bump.normal_map = o.material[m].diffusemap
tt.texmap_reflectionGlossiness = o.material[m].diffusemap

o.material [m] = tt

)
)

)
actionMan.executeAction 0 "40807"

For some obscure reason sometimes Max stop working when I execute my script (maybe the reason come with the preview of the texture of a vray material which give often a crash )
Other problem I cannot find how to convert a multimaterial (and not every submaterial) to a Vray material
And last but not least how to have acces to the submaterial of a multimaterial (copy diffuse texture from mat ID1, mat ID3 ...)

I Hoppe someone could give me some help

Comment viewing options

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