I'm trying to generate a bunch of images with caustic effect, with the glass object has different index of refractions between the images. I'm using Maya 2010, render using mental ray,
So, I tried with the Expression editor, at first I tried modifying the miRefractiveIndex with the expression (yes, I already used Window -> General Editor -> Channel Control to make miRefractiveIndex keyable and unlocked. Evaluation is Always).:
When I clicked around the frame sliders (on the bottom of the screen), I notice the Refracted Index in the Attribute Editor (of pasted__phonge1) did get updated (the box became violet color). However, when I used batch render to render frames 1-3 the caustics didn't change.
Afterward, I found attribute pasted__phong1.refractiveIndex, and did the same thing (that means, I used same expression for both .refractiveIndex and .miRefractiveIndex, also made it keyable and unlocked). Then, after I rendered the frames, the caustics were different, so it worked.
But now, I tried to write my own MEL procedure in the external .mel file, containing a function that returns index of refraction given the current frame number, and I called the procedure from Expression Editor, so now becomes :
First thing I would try is using a 'setAttr' command instead of just setting the attribute with the '=' operator. There are differences between the way these two techniques operate, but unfortunately I'm fuzzy on the details.
If that doesn't work, maybe try using a pre-render MEL script instead of an expression?
I know you set it to 'Evaluate: Always' but it feels like it's not executing properly.
In your Render Settings window, in the last section of the 'Common' tab, you should have a collection of slots for pre-render, post-render, pre-render layer, post-render layer, pre-render frame and post-render frame MEL scripts. Call your procedure from there.