FORUMS: list search recent posts

Problem with varying refractive index using Expression Editor

COW Forums : Autodesk Maya

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Budianto Tandianus
Problem with varying refractive index using Expression Editor
on Dec 15, 2011 at 3:03:55 am

Dear all,
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).:

pasted__phong1.miRefractiveIndex = 1.5 + (frame-1) * 0.1

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 :

pasted__phong1.refractiveIndex = myProc(frame)

and

pasted__phong1.miRefractiveIndex = myProc(frame)


with the MEL script :

proc float myProc(int $frame)
{
return 1.5 + ($frame-1.0) * 0.2;
};



When I clicked around the frame sliders, I noticed the Refractive Index in the Attribute Editor of pasted__photon1 did change by 0.2.


And then..I rendered the frames again, but the caustics were stationary, and the caustics were as if the index of refraction was 0.0, they didn't change at all !
Any solution for this possible bug ?

Many Thanks.


Return to posts index

Steve Sayer
Re: Problem with varying refractive index using Expression Editor
on Dec 15, 2011 at 3:51:41 pm

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.

-Steve


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]