MentalRay 3.9 - native UI integration

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
Old 11 November 2011   #1
Smile MentalRay 3.9 - native UI integration

Last Update : v1.2.2
MentalRay 3.9 UI native integration v 1.2.2

Hi all !

We recently upgraded to 2012 at work (working on 2009 since then)
and with all the new features coming with mentalRay 3.9 that where not exposed in the UI, I choose to blow my brain out and add all new (and old) non exposed string options into the Render Settings window !

I know there are already script that enable string options (like Dorian's one), but my goal was to do it exactly the same way as if autodesk had done it itself. Nothing to source, nothing to do, it's here, just like if autodesk had done his job !
And I tried to respect syntax, naming convention and every thing else.

All new string options are added the same way they were before (declared in 3 global string array in mentalRayUi.mel) so they are created with the node miDefaultOption.
New tabs, new layout, new controls, and everything I changed is done the way it was before.

I really felt like an archaeologist while trying to understand all mel file, looking in the folder /script/others for every procedure call and global variable usage to find where everything was natively created.

Here is some UI behavior that was kept (even if everything should have been kept, I may have forgotten a few things):
- Modifying the UI updates the string (of course ...) and modifying the string by hand also updates the UI.
- When a function disable (or enable) another (as referred in mentalRay documentation), controls are greyed as well to match what the render setting is already doing for other controls.
- As every added thing is disabled by default, their UI is also folded by default to ensure it's not an invasive modification.
- All string options are now saved with the render setting preset. (All previously used string option (e.g. for IP) were not saved with preset !).
- All controls are annoted (using uiRes) with information taken from mentalRay documentation.

Here is the list of all modification I made :
- adding Key differentials under Features Tab (even if I don't now what it is ...).
- adding Unified Sampling under Quality Tab.
- adding Progressive rendering under Quality Tab.
- adding Native IBL under Indirect Lighting Tab.
- adding FinalGather Legacy under Indirect Lighting Tab.
- adding FinalGather passes Legacy under Indirect Lighting Tab.
- modifying FinalGather mode under Indirect Lighting Tab (the control now match the one in miDefaultOptions).
- adding Iray Tab.

AND the last but not the least !

- All tab are now resizable ! When you stretch the render setting horizontally, the scroll layout stretch as well (I really wonder why is was not created like that by default ... It was driving me crazy).

And here are screenshots from the modified render setting window ! (carefully hilighted in green):

Note that everything was checked multiple time. I didn't found any error or non working control.
It even work if opening a old scene from 2009.
But I would be really surprised if no one encounter any error ><.

As everything is working now, I choose to share it. And I need advices on a few things :
- I tried to place all new control on the place that seems the best for me, but I may be mistaking. So if you think something should be somewhere else, just tell me !
- In the same way, I tried to "auto Grey" controls that are not compatible or mandatory, but I may have forgotten some or maybe some control shouldn't be greyed.
- I didn't do anything for importons, irradiance particle, photon and all those strange indirect option that I never ever used in vfx production. But if you have any request I would be glad to add it if possible.

Current known limitation :
(Note that this limitations was already here with how autodesk handles string options.)
- you cannot override any string options because it's a multi-attribute. And I don't know how you can override a standar control (currently, all options you can override are actually attributeControl, which is a direct connection to an existing real attribute.)

Thanks to all people who participate in Dorian's topic for all the information I found here while I was trying to find how each option is working. I spent also a lot of time on the mentalImage forum.
(note that I didn't took any line of any script I found anywhere. I didn't even tested (nor downloaded) any script to manage string options.)

If found yesterday that Bitter was already working on a native integration, It don't want to steal anything to anyone. The modifications I made was firstly for me and if anyone can benefit from it I would be glad. Moreover, if someone can avoid strong headache thanks to the headache I got working on it, it's a pleasure !

I also want to add a few things about things I read :
- Final gather passes do work ! But only in batch render mode ... and it's enabled by default (even without any modification to anything). I noticed it because our render manager is using imf_disp to display rendering image on the render farm, and here you can see the 3 defaults passes of finalgather. Even without looking at the image with imf_disp, you can see it in the render log.
- There is a way to enable Iray when you don't have administration privilege. What I did : I copied the folder Maya2012 located in C:/programe files/Autodesk and placed it in my local folder (in where I can do whatever I want). Then I added the necessary .dll to enable Iray, and from now I'm starting maya from the local folder. Works perfectly !
- I remember someone talking about export options that had to be checked/unchecked to be able to render with Iray, but after some tests, it appears that it didn't change anything. For me Iray works without any change to the default export options. I would like to know if it works for every one.

To use those modified mel file, the simpler way is to put all of them in your folder maya/2012-x64/prefs/scripts. They will override standard mel and you don't change anything to your maya installation. Just delete the files and maya is back to normal (note that a scene saved will keep all string options (e.i., if you enable Iray, save the scene, delete all modified mel and reopen the scene, iray will still be enable. All string options are saved within the file. So you will have to disable it by hand).
I'm used to place all "override" mel in this script and all custom script in maya/2012-x64/scripts, so I don't mix them as they are not the same thing at all. But you could do whatever you prefer.

There it is ! Hope you like it !

The link to the creativecrash page :
MentalRay 3.9 UI native integration v 1.1.1

For now I can't upload the file on cgtalk, as this is my first post ><


PS : I'm using maya 2012, but since it's only a mel modificaiton, it should work for any version. The script do not remove any mandatory string option so it can't make your render setting disapear. And like it is explained in mentalRay documentation : "Values of a wrong type are ignored. Also, misspelled or unknown options are silently ignored by mental ray."
BUT ! Be aware thare from now if you use the mel file provided, ALL string options added are now MANDATORY ! If another script delete any string option, you will not be able to open the render setting anymore ! So if you need to use another script to do something that my modificaiton is not doing, do it carefully !

Last edited by Mini-Zun : 04 April 2012 at 10:09 AM. Reason: update Link
Old 11 November 2011   #2
Little Update : v1.0.1
- added Iray rendering mode under Iray Tab.
- added Firefly filter under Iray Tab.
- added Hair caps option under Options Tab.
- added Hair acceleration under Options Tab.
- added Rasterize hair disposable under Option Tab.

Basically I searched in the release note every thing that was talking about string options. And I added the firefly filter after Lumis asked for on creative crash.

But I found something strange in the release note, they are talking about "finalgather precomputation legacy" and not "finalgather legacy" (which was the one I added thanks to Bitter's explanations). So I tried both and only "finalgather legacy" has an effect (as expected). "finalgather precomputaiton legacy" don't change anything. Is that a mistake in the release note or does the string option had an update ?

I have another question : for final gather mode, the mental Ray documentation is talking about 4 mode :
"strict 3.4"

But the attribute in miDefaultOptions is calling them :

and I found that the order is not the same.
mayatomr translate Original to "strict 3.4" and if Compatible is selected, the string option "finalgather mode" is not exported. And I suppose that it's the "3.4" mode. But should'nt it being called "orignal" as it's the one without modification ?
The simplest way to correct that would be to change the names of the menuGrp items in the render setting to match the ones in the mentalRay documentation.
Does it make sense to you ?
Old 11 November 2011   #3
awesome !!!

This will be really usefull.

Old 11 November 2011   #4
So much of your time must have been invested in this. You've done an amazing job of integrating this stuff.
Part of me (the cynical part I guess) smiled when I read:
Originally Posted by Mini-Zun goal was to do it exactly the same way as if autodesk had done it itself.
And I thought... would they have done it as well as you? Maybe. Someday. Who knows?

So thanks for sharing the fruits of your labor. I'd been using Dorian's script, but having this stuff in renderSettings will make a big difference.

Old 11 November 2011   #5
Looks very nice! Gonna give it a shot tonight.
Commodore 64 @ 1MHz
1541 Floppy Drive

"Like stone we battle the wind... Beat down and strangle the rains..."
Old 11 November 2011   #6
Thanks for your hard work ! This looks greats !

Quote: goal was to do it exactly the same way as if autodesk had done it itself

I'am also a big fan of this one !
Old 11 November 2011   #7
This is briiliant!

Thanks so much for sharing.


beDistinct RecomFarmhouse IMDB LinkedIN
Old 11 November 2011   #8
Thank you so much for your work
Old 11 November 2011   #9
Man, that looks great. Awesome job! Thanks for posting it up!

If animation is the illusion of life, then life is the illusion of reality.

"On ne sort pas DU REVE."

Old 11 November 2011   #10
great, thanks a ton
Old 11 November 2011   #11
// Error: Cannot find procedure "mentalRayOptionsCheckIray". //

And I don't have an iray tab.

help?! maya 2012 sap, windows 7
Old 11 November 2011   #12
Thanks everyone !
In fact it was quite fun to do

here are the new features in 1.0.1 :
- added Iray rendering mode under Iray Tab.
- added Firefly filter under Iray Tab.
- added Hair caps option under Options Tab.
- added Hair acceleration under Options Tab.
- added Rasterize hair disposable under Option Tab.

I don't understand why you have this error. I just checked with brand new maya prefs with the mel files in /2012-x64/prefs/scripts/ and everything work well.

Before copying the files, did you have any modification to the render settings ? Are you sure you have all files ? (19 in total).

edit : I found a mistake in one of the mel files. There are unescessary call to mentalRayOptionsCheckIray procedure inside createMentalRayOptionsTab.mel. But this shouldn't prevent the creation of the iray tab.
It's modified and updated. Tell me if it's working now

Last edited by Mini-Zun : 11 November 2011 at 08:46 AM.
Old 11 November 2011   #13
Is there something I'm doing wrong with Progressive Rendering?

Here's the scene, simple MIA_X_Passes (Default) on a sphere with a IBL for reflections and lighting.

I'll render the scene with Progressive turned on (Using IPR in the Render View) and it'll render successfully. But, as soon as I make a change (in this instance, color) It crashes.

Am I just using it incorrectly?
Old 11 November 2011   #14
Yeah unfortunately Autodesk changed something and progressive no longer works with IBL.

It was working back in 2010 but they changed something and always crashes.

Very very annoying.

Would like to know if anyone has it working with IPR though. I tried changing some render option settigns, similar to how people set up their scene to render with Iray but it seems that yes you can get progressive to render with IPR but for me it was not actually progressing. It would do the first substep and then just not refine.

beDistinct RecomFarmhouse IMDB LinkedIN
Old 11 November 2011   #15
Many thanks for posting this, although I'm primarily VR now this still looks incredibly useful when I do want to make use of MR, and yep I laughed as well with the AD jib
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 03:51 PM.

Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.