Monday, August 10, 2009

Change Material per frame

First, must say that I like a most essential tutorials which help us to understand better how Max works. "How To" tips are more prefered by many folks, yes, I know that, but a little bit theory, even in seemingly simple tasks are more useful. So I can only hope that my tutorials also have been useful for someone.

But now the issue.

As far as I remember, I have already written about this case. But as I see, not everybody knows how to do that. I read a forum post where people seek for a test render method which will render to say for example 15 frames with 15 different material applyed on some object. Well, even in this case must be animated object materials. What's that I see so they try to assign new material on every frame by MaxScript, but probably you guess, the final render will get only last assigned material for all frame range. This is obtained because assigning material to scene object is a similar to creating new object. Lets to say, for example, we want to clone some object on every frame:

for t=1 to 15 do (at time t animate on (copy $obj01))

Well, we have 15 new copies created but no animation, right? If the aim is to appear them 1 by 1 then we need to animate their visibility. The materials case is similar. So the next code will NOT work:

for t=1 to 15 do (
at time t animate on
($obj01.material = meditMaterials[t])

In Max exist scripting method called "Change object properties at render time" , but this is the hard way and also will slow the rendering process. And why we to do this as there is a much easier way :) Just made MultiSubObj material, assign it to our object, apply Material Modifier to the object and just animate it ID's. That's all.

No comments:

Post a Comment

Thanks for your comment