Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® Maya® / MEL / Problem with varying refractive index using Expression Editor
  RSS 2.0 ATOM  

Problem with varying refractive index using Expression Editor
Rate this thread
 
62840
 
Permlink of this thread  
avatar
  • EonStrife
  • Posted: 14 December 2011 02:22 PM
  • Total Posts: 1
  • Joined: 14 December 2011 02:21 PM

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.



Replies: 0