Notifications
Clear all

[Closed] auto-material apply/object render

I have 10 objects models to render in 10 differents materials each (100 renders).
I would like to have a script which pick object01 in the scene, hide others, apply materials01 on it and render, apply material02 and render…and so on to material10. And then show object02, hide others and apply material01 and render, apply material02…and so on.

Render frame must be named and save of course.

anyone can help me? (I m not scripter :/)

2 Replies

hi loran! try this out if it works.

  • just make sure you hav an output filename specified at the rendering dialog window.
    e.g. d: est\my_image.tga

  • run the script, pick your object (single objects only, sorry…), add materials to the list and hit “OK” button to render.

  • the output files will have the name of the material attached to it… so, if you choosed for example a material named “Max Mat 1”, your ending filename would be (using the above example) at d: est\my_image Max Mat 1.tga

here’s the code:


rollout test "test"
(
global rend_count = 0
local mat_arr = #()
local mat_arr_names = #()
local my_obj
pickbutton pick_bot "pick obj"
button add_bot "add material"
listbox mat_lst "materials"
button ren_bot "render" enabled:false
fn rend_this num =
(
the_count = mat_arr_names.count
the_mat = mat_arr_names[num]
def_path = rendOutputFilename
if def_path != "" do
(
the_path = getfilenamepath def_path
the_file = getfilenamefile def_path
the_type = getfilenametype def_path
the_filepath = (the_path + the_file + " " + the_mat + the_type)
 
my_obj.material = mat_arr[num]
format "Rendered % : % material : %
" my_obj.name my_obj.material.name the_filepath
render outputfile:the_filepath
)
)
on add_bot pressed do
( 
the_mat = materialBrowseDlg #mats #instanceOnly
if the_mat != undefined do
(
append mat_arr the_mat
the_mat_name = the_mat.name
append mat_arr_names the_mat_name
mat_lst.items = mat_arr_names
)
)
on pick_bot picked obj do
(
my_obj = obj
pick_bot.caption = obj.name
ren_bot.enabled = true
)
on ren_bot pressed do
(
the_count = mat_arr.count
for i in 1 to the_count do
(
rend_this i
)
)
)
createdialog test

i hope this helps!

***i havent tested this on animated scenes… sori. I could extend it to render multiple objects but this is all the time i could spare…

thx for help galagast! .
A coder do this for me and it works fine:
download maxscript