Page 1 of 1
Batch change material options
Posted: Wed Jul 18, 2012 11:44 pm
by jimminy
Is there any way to batch change a particular setting in an MXM for all the materials in, say, a folder or directory?
At the moment I want to change the Shadow setting in the Materials Properties for all the materials in a particular folder (from disabled to enabled) and presently I have to open each of about 200 MXMs and change it manually if I want to do this.
Seems like it would be a pretty straightforward script for someone who knows how to do that kind of thing.
Re: Batch change material options
Posted: Thu Jul 19, 2012 12:30 am
by Mihai
Right now the only way would be to write a Python script, and we should probably release a few useful scripts like this. But in your case, not sure why you want to do this for so many materials? Usually you just need it for one, for example the floor so it catches shadows. Or, you could temporarily apply one material to all the objects you want to catch shadows and turn on the shadow from it, then render a shadow pass.
Re: Batch change material options
Posted: Thu Jul 19, 2012 2:42 am
by jimminy
Hmmm, good question. maybe I'm doing it wrong, but if I want to render and have a shadow pass channel going at the same time, don't I need all the materials to have the shadow option enabled?
Without it, I think I just get white. Maybe you are saying the better way to go is to do it as a separate render, which I can see would work. What would be the benefit?
Usually I'm doing this for an exterior building rendering and it's nice to have some control of the shadows. So I will have many materials and all of them would be receiving shadows.
Re: Batch change material options
Posted: Thu Jul 19, 2012 4:16 am
by Mihai
Well, just in this case so you don't have to switch on/off shadows in 200 materials. But even if you had this possibility, having a shadow pass doesn't mean the main render won't get any shadows 'built-in' to the render. So you can only add more to certain shadows if you want, but not take away. But in my opinion it's a great way to have a weird unrealistic render if you're just controlling the shadows. Instead it would be better to add some well placed lights to make it more interesting.
Re: Batch change material options
Posted: Thu Jul 19, 2012 8:41 pm
by jimminy
So if I understand you, I would render my scene as usual without a shadow pass, then do a separate rendering using an override material, shadows enabled on the override MXM, rendering just the shadow channel.
Makes sense, I'll have to try it out on my next renders. Does it also make more sense to do material IDs the same way then? I noticed my last renders that had shadow pass and material ID pass enabled took a very long time to get to a decent SL.
Re: Batch change material options
Posted: Thu Jul 19, 2012 8:46 pm
by Mihai
The shadow pass will add the most time, material ID should render pretty fast and not slow down the main render too much. I don't think it's necessary to do this for the MatID channel, each material gets its own color by default.
Re: Batch change material options
Posted: Thu Jul 19, 2012 11:29 pm
by jimminy
Now that you mention it, it seems that a lot of my materials have a material ID that's exactly the same grey color, which causes me to have to change each material's ID one by one, much as I was saying I had to do with the shadow option.
Of course, this is more than just being able to batch enable/disable an option, this would be batch randomizing the material ID color, which seems more complicated.
I guess no matter what stuck making some change to multiple MXMs, one by one, each time I set up a new render, unless I go and change them in the library, and that means doing it hundreds of times before it's finally fixed.
Thanks Mihai for the help with the shadow pass though.
Re: Batch change material options
Posted: Fri Jul 20, 2012 12:48 am
by Mihai
Probably these are older materials? In that case their matID will be grey yes.....new ones automatically get a random color when created.