By JTB
#269187
First, let me say that I have no experience of Maxscript.... My question is this:
How can someone automatically create materials in Max, from a list of images?
I mean, something like the actions in photoshop.....
I guess it is possible with maxscript, but I have no idea how...
Is there any tool that can create many materials, assigning textures? A batch material creator?
What I need is this....
I have a list of pictures of people. I want to create a crowd. Using forestpack, this is really easy... The boring part is to make many materials that will be assigned to each plane or group of planes to simulate a crowd. I just need something to make a list of materials automatically. Even if it only makes standard materials.
By Bogdan Coroi
#269210
Here is a small script that can be used as a reference for what are you trying to do.

With this script, you can assign textures from a specified directory to all objects from the current selected objects in the scene. The material used to store all textures is a default MaxwellMaterial. That means, you'll end up with all selected objects having a default maxwell material with reflectance 0 as the storage node for the textures specified.

As you can see, you can modify the textures directory. In my case is "C:\\textures\\" and textures are JPEGs.
Code: Select all
-- get all texture names and place them in variable 'files'
files = getFiles "c:\\textures\\*.jpg"
i = 1
-- get all selected objects from scene
sel = selection as array
for obj in sel do
(
	-- create a default material.
	m = MaxwellMaterial()

	-- create a bitmap node and assign the i-th texture from 'files' variable
	bmt = BitmapTexture()
	bmt.fileName = files[i]
	i = i+1
	
	-- assign it to Maxwell Reflectan 0 texmap
	m.'BSDF_Reflected_Color_Texture' = bmt
	
	-- assing Maxwell Material to a selected object from the list
	obj.material = m
	
	-- show it in viewport
	showTextureMap m bmt on
)
Grab this script - copy/paste - and after you modify the textures path, select some objects from the scene and run the script.
By JTB
#269217
Thanks a lot! Although I don't need the last part, this will be great help for me!!!
My need is just to make a list of materials.
Actually I will need to add the alpha channel too, so I will have to find a way to automatically assign the relative alpha image....
I had some programming experience with Turbo Pascal and AutoLISP but nothing similar to Maxscript...
Never No More Studio Lighting

Hello Mark! Very good tips about the camera setti[…]

Will there be a Maxwell Render 6 ?

https://community.sketchucation.com/category/49/wi[…]

Sadly, this lack of a response demonstrates a mori[…]