- Mon Mar 21, 2011 5:13 pm
#340044
I have a large library of textures... arch mats, clipmaps for vegetation etc... I use forestpack pro from itoosoft and I like to have many materials for my plants, bushes, trees etc...
The script that follows is supposed to make maxwell materials with same characteristics easily... but it doesn't....
I can assign any float, boolean, RGB param but I can't assign texturemaps... I mean, I think I know how but
they don't appear... and they are not assigned correctly...
If someone can correct the following I would be very much obliged...
How it works...
I make 3 directories... maps1= diffuse maps... maps2= bump maps ..... maps3 = alpha maps...
Then two simple params alpha channel inverted or not, bumpmap= normalmap or not...
For example I have 5 diffuse maps and, 5 bumpmaps, 5 alphamaps... the names have to be almost the same so that they
are in the same order for all three folders.
So, d1,d2,...d5 b1..b5 a1....a5
I make a box and then 4 other copies... I select the boxes and then I run the script... then I have
box1->mat1 with d1,b1,a1 ...... box5->mat5 with d5,b5,a5....
Then I can export all mats or even export mxs, pack'n go, then export mxm...
Anyway, I know it is silly but I no nothing about maxscript and I think it is an easy solution for someone like me...
Like I said, my problem is that I can't assign the textures... Please help me , any tip would be really useful...
-- APPLICATION PARAMETERS
--file lists : dir1 diffuse, dir2 bump, dir3 alpha
dir1="c:/maps1/*.jpg"
dir2="c:/maps2/*.jpg"
dir3="c:/maps3/*.jpg"
-- general param if I have to invert alpha maps (dir 3)
invertmap=false
--check to see if the bump map is a normal map
normalbump=false
i=1
files1=getfiles(dir1)
files2=getfiles(dir2)
files3=getfiles(dir3)
--number of files
count=files1.count
-- make one box and then make copies as many as the files
sel=selection as array
for i=1 to count do
(
m=Maxwell_Material()
bmt1=bitmaptexture()
bmt1.filename=files1
bmt2=bitmaptexture()
bmt2.filename=files2
bmt3=bitmaptexture()
bmt3.filename=files3
m.name= i as string
m.layers[1].mask=bmt3
bmt3.output.invert=invertmap
m.layers[1].bsdfs[1].ReflectedColorTexture = bmt1
m.layers[1].bsdfs[1].ReflectedColor =color 165 100 200
print bmt1.bitmap
print bmt1.filename
print m.layers[1].bsdfs[1].ReflectedColorTexture
print m.layers[1].bsdfs[1].ReflectedColor
m.layers[1].bsdfs[1].BumpStrengthTexture = bmt2
m.layers[1].bsdfs[1].BumpStrength=30
m.layers[1].bsdfs[1].BumpAsNormalmap=normalbump
m.layers[1].bsdfs[1].Nd=1
m.layers[1].bsdfs[1].BumpStrengthTexture = bmt2
showtexturemap m bmt1 on
sel.material=m
i=i+1
)
The script that follows is supposed to make maxwell materials with same characteristics easily... but it doesn't....
I can assign any float, boolean, RGB param but I can't assign texturemaps... I mean, I think I know how but
they don't appear... and they are not assigned correctly...
If someone can correct the following I would be very much obliged...
How it works...
I make 3 directories... maps1= diffuse maps... maps2= bump maps ..... maps3 = alpha maps...
Then two simple params alpha channel inverted or not, bumpmap= normalmap or not...
For example I have 5 diffuse maps and, 5 bumpmaps, 5 alphamaps... the names have to be almost the same so that they
are in the same order for all three folders.
So, d1,d2,...d5 b1..b5 a1....a5
I make a box and then 4 other copies... I select the boxes and then I run the script... then I have
box1->mat1 with d1,b1,a1 ...... box5->mat5 with d5,b5,a5....
Then I can export all mats or even export mxs, pack'n go, then export mxm...
Anyway, I know it is silly but I no nothing about maxscript and I think it is an easy solution for someone like me...
Like I said, my problem is that I can't assign the textures... Please help me , any tip would be really useful...
-- APPLICATION PARAMETERS
--file lists : dir1 diffuse, dir2 bump, dir3 alpha
dir1="c:/maps1/*.jpg"
dir2="c:/maps2/*.jpg"
dir3="c:/maps3/*.jpg"
-- general param if I have to invert alpha maps (dir 3)
invertmap=false
--check to see if the bump map is a normal map
normalbump=false
i=1
files1=getfiles(dir1)
files2=getfiles(dir2)
files3=getfiles(dir3)
--number of files
count=files1.count
-- make one box and then make copies as many as the files
sel=selection as array
for i=1 to count do
(
m=Maxwell_Material()
bmt1=bitmaptexture()
bmt1.filename=files1
bmt2=bitmaptexture()
bmt2.filename=files2
bmt3=bitmaptexture()
bmt3.filename=files3
m.name= i as string
m.layers[1].mask=bmt3
bmt3.output.invert=invertmap
m.layers[1].bsdfs[1].ReflectedColorTexture = bmt1
m.layers[1].bsdfs[1].ReflectedColor =color 165 100 200
print bmt1.bitmap
print bmt1.filename
print m.layers[1].bsdfs[1].ReflectedColorTexture
print m.layers[1].bsdfs[1].ReflectedColor
m.layers[1].bsdfs[1].BumpStrengthTexture = bmt2
m.layers[1].bsdfs[1].BumpStrength=30
m.layers[1].bsdfs[1].BumpAsNormalmap=normalbump
m.layers[1].bsdfs[1].Nd=1
m.layers[1].bsdfs[1].BumpStrengthTexture = bmt2
showtexturemap m bmt1 on
sel.material=m
i=i+1
)
I won't sign it, if it is not a piece of art.. So far, I haven't done any...
Revit Architecture 2012, Max Design 2012, AutoCAD 2012, Moi3d, Maxwell, Octane ... and many working hours
Revit Architecture 2012, Max Design 2012, AutoCAD 2012, Moi3d, Maxwell, Octane ... and many working hours