Material fading?

How can I make a mesh renderer slowly fade from one material to another (as opposed to having it instantly change) through scripting? Thanks

Assuming they use the same shader, just different parameters, you could lerp the values same as if you were intepolating, say, distance on a transform. You could do that for r,g,b,a values on colors, etc. Fading between textures would be more interesting. A new shader would be best, but you could use the Texture2D API's to generate them on-the-fly, and/or maybe use an image effect???

If the materials use different shaders, I think you'd have to look at an 'image effect' type of thing (the kind that affects the rendered frame and post-processes it). But that sounds very sticky.

I know this is an old thread, but since it has not been flagged as solved I’d like to post a function that might help you out: http://www.timthomassen.com/?p=435