Complex UV Layout in Maya
Over the last couple of years UV layout in Maya has changed for the better. In this course we're going to be taking a look at some of those changes as we UV map an entire character
# 1 15-12-2011 , 03:02 AM
Registered User
Join Date: Dec 2011
Posts: 3

:help: Problem with varying refractive index using Expression Editor

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.

# 2 15-12-2011 , 03:28 AM
NextDesign's Avatar
Technical Director
Join Date: Feb 2004
Posts: 2,988
I doubt it's a bug. Why do you want to house it in it's own MEL script? It don't really give you any more control over it, and makes it more complicated when batching, as it needs to know where this script is.

The problem might be that you're defining your function as a proc, and not a global proc. You should also give it a more descriptive name incase there are naming conflicts.


Imagination is more important than knowledge.
# 3 15-12-2011 , 03:43 AM
Registered User
Join Date: Dec 2011
Posts: 3
I see. It's because I need to generate a bunch of caustics, with the index of refraction of each image is computed based on some complex maths formula.

yeah, also not working after I set it to global proc. About the name of the procedure, it's something else, not 'myProc' as written here.

Thanks user added image

# 4 15-12-2011 , 04:01 AM
Registered User
Join Date: Dec 2011
Posts: 3
you're right about the batch render unable to find the script. After I put my .mel file in the default maya's script folder, it worked. Thanks user added image

# 5 15-12-2011 , 04:12 AM
NextDesign's Avatar
Technical Director
Join Date: Feb 2004
Posts: 2,988
Awesome, you're welcome.


Imagination is more important than knowledge.
Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads