SimplyMaya Forums

Welcome to the forum, feel free to ask questions here.


SM Forums / Maya Questions / Lighting & Rendering / :help: Problem with varying refractive index using Expression Editor

Lighting & Rendering General Lighting, Camera & Rendering Related Topics

Join the conversation. Reply to post
 
Thread Tools
15-12-2011, 03:02 AM   #1
EonStrife
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.
  Reply with quote
15-12-2011, 03:28 AM   #2
NextDesign
Technical Director
 
NextDesign's Avatar
 
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.
  Reply with quote
15-12-2011, 03:43 AM   #3
EonStrife
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
  Reply with quote
15-12-2011, 04:01 AM   #4
EonStrife
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
  Reply with quote
15-12-2011, 04:12 AM   #5
NextDesign
Technical Director
 
NextDesign's Avatar
 
Join Date: Feb 2004
Posts: 2,988
Awesome, you're welcome.
__________________
Imagination is more important than knowledge.
  Reply with quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with manipulator in UV Texture Editor window maya4todd Maya Basics & Newbie Lounge 0 22-06-2004 01:30 PM
Attribute Editor Problem LeoGeo Maya Basics & Newbie Lounge 3 04-12-2003 07:35 AM
expression editor LaCelestina Maya Basics & Newbie Lounge 2 25-07-2003 01:19 AM
expression problem Darkware Animation 6 04-07-2003 10:23 PM
Trax Editor Problem! Playing clips... oscar Animation 4 08-09-2002 11:14 AM