View Full Version : Functionality of MultiplyDivide Node through MEL?

10 October 2010, 03:56 AM
I was wondering if it's possible to write some MEL that would mimic the functionality of the multiply/divide node? What I would like to do is write some MEL that would grab the R,G, and B data from an image file node and let me multiply each channel by a user defined amount. I've been trying to figure out how to approach this but haven't been able to come up with anything.

Reason I'm even trying to do this crazy thing is I'm creating a mental ray phenomenon shader and the phenomenon node only recognizes mental ray shaders...not maya shaders. So it totally ignores my maya mult/divide node when I create my phenomenon. I looked for a mental ray node that would do the same thing but could not find one. So I figured if I could write some MEL to mimic the functionality of the mult/divide node I could expose a 'multiply' attribute in the UI and use that value to drive the MEL that would multiply the RGB image data.

If anyone has some advice on how to approach this it would be awesome! Or if you've got a better way to approach the problem I'm all ears. :)

Thank so much!


10 October 2010, 07:20 AM

If you just want to have a single multiplier for all channels, you can use the mip_gamma_gain node. You might need to tweak the mentalrayCustomNodeClass.mel file for them to become visible, or just try "createNode mip_gamma_gain" - might work.

Otherwise if you only want a control for the UI, I suggest that you look into the floatField command - it creates an UI slider which lets you execute you own code when the value changes.

/ Daniel

10 October 2010, 12:57 PM
Man...I can't believe I forgot about the 'gain' part of the mip_gamma_gain!! That's a perfect idea. That's exactly what I needed. Thanks a lot for the help. :)


CGTalk Moderation
10 October 2010, 12:57 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.