Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey everyone!
I'm trying to work on an object where I need to apply multiple masks, render and save them individually. I've attached a screenshot of the material, and it's the bitmap Mask on Layer 2 that needs to be changed each time from a folder of png files.
I tried with the code below, but since I'm not really experienced with MaxScript, I'm having some trouble making it work.
Would really appreciate it if anyone could help me out with this.
source_dir = "C:\\Users\\Thierry\\ScriptTextures\\"
output_dir = "C:\\Users\\Thierry\\ScriptOutput\\"
mat_name = "Material #841"
mat_node = getNodeByName mat_name
layer2_mask = mat_node.materialList[2].materialMapList[1]
png_files = getFiles (source_dir + "*.png")
for i = 1 to png_files.count do
(
-- Change the mask to the next PNG file in the sequence
layer2_mask.filename = png_files[i]
-- Render the scene and save the output image
output_file = output_dir + "render_" + i as string + ".png"
rendSaveFile output_file
render rendOutputFilename:(output_dir + "render_") outputfile:(output_dir + "render_" + i as string + ".png")
)
Thanks a lot !
Solved! Go to Solution.