ScriptSpot

Forum topic · Scripts Wanted

batch material creation from image+alpha

By pproestos · 2012-06-04

Description

Is any script where I can reate as many
materials I want just by selecting a series
of images and and a series of their alpha masks?

I mean I creat a standard material and assign
as diffuse map a jpg image and as opacity
map another jpg image.

How can I do this automatically with a script?
Means selecting 10 jpgs as diffuse maps, then
selecting other 10 jpg as opacity maps and then
3ds max automatically creates 10 standard materials...

thank you.

Comments (12)

ok I figured that out

pproestos · 2012-06-09

ok the script is perfect...
It fills 24 slots with their original names and that's ok

then to save them all together in one library I changed
this parameter:

.../Autodesk/3dsMax/[maxversion]/enu/plugcfg/sme.ini
Change UseOldMtlBrowser=0 to =1

and now I can save all material slots in one library!

again another big thank you.

great

jos · 2012-06-09

Okey great! I havnt much time now, so fortunately you've solved it.

thanks

pproestos · 2012-06-08

Jos filename works!
But I think they are not inserted automatically into
a material library.

If it's not possible, is there a script
that puts all together 24 slot materials into a library and
not one by one?

Your help is unique for me.
thank you again.

Petros.

it's perfect

pproestos · 2012-06-05

Jos you are a GOD.
thanks again very much.
:)

thank you

pproestos · 2012-06-04

guys you are GENIOUS!
I am out of speech...

thank you VERY much from my heart.
I will try it and tell you.

you save my life...

:)

jos · 2012-06-05

you're welcome skifx

jos · 2012-06-04

just run the script. it will create the materials in the material editor.
If I have to add something, feel free to ask. (like naming etc.)

Attachments

barigazy · 2012-06-04

well done, jos.
Works great.
I was try to wrote just a function but this is more practical.

barigazy · 2012-06-04

It's better solution to create temp mat. liblary because the material editor have only 24 mats. If you use this method then in line 26 you need to put this:

for i=1 to MaskArr.count where i < 25 do ...

indeed

jos · 2012-06-04

I was aware of the limitation. Just quickly wrote this one. Was just for the case of skifx (he needed 10). So If someone wants more functionality just ask!

more funcionality please... :)

pproestos · 2012-06-07

I am completely satisfied with the script.
But because I have more than 1000 jpg+masks (trees, people ecc)
that needs to be converted into materials:

a.
is possible to have the material the same name of the main image I load?
I mean if I load "house.jpg" and "house_alpha.jpg" then the material
will be named "house"

b.
because it takes much time to save them into a material library,
is possible that I put all of them together on a library and not
one by one?

thanks again.
Wich I could script....
You have the power in your hands knowing 3ds max scripting!
:)

Petros.

update

jos · 2012-06-07

Sorry for the delay. Busy for the moment. Material name created from diffuse texture and possibility to save to material library. Actually dont know of this works because I have never used this.

Attachments