Setting Up Notpad Plus Plus for MEL Scripting

 If you're getting into serious MEL scripting then the Maya Script Editor can  prove to be insufficient. An external editor is a better bet (no, not Wordpad :P).  There some great free ones out there, like Notepad++!



Download Page

The Case of the Missing Clouds



The Mental Ray for Maya's physical sky is pretty handy. With the click of a button you can have a nice clear sky. But see that is one of the problems with this sky, there isn't a single cloud to be seen. One would think it would be pretty straight forward and relatively easy to add texture to it, maybe there's a channel somewhere that can be mapped with some sort of panoramic image of rain heavy clouds or perhaps a night sky bursting with stars. Nope!



Well there's the “Use Background” checkBox with an image slot below it. What's that for? Don’t get your hopes up, it’s a total tease, you can map a texture to it but, and this is a huge but, it will not be visible in the reflections or refractions of any of the objects in the scene, they will reflect/refract a clear sky! Boo.

MasterZap made a post on getting clouds into the sky and Ash made a Maya version, these helped and gave me much hope. But I was having problems, my sky was overblown by the time I started seeing the clouds and everything turned yellow/orange! It got really bad really quickly when using an HDR image, by the time I got up to multiplying the sky texture by 5 it was too much and I even got some artifacts, the low dynamic range needed to be multiplied even more while yielding a less detailed sky and lighting. Either way by the time I really started seeing clouds, the sky was so orange it looked like a Benson & Hedges ad.




LDR Map: multiplied x 10



The setup involves these nodes:

File texture node (for sky texture)

mib_lookup_spherical (for mapping the texture in a dome like manner)

multiplyDivide (for controlling the strength of the texture)

luminance (to extract the grayscale information from the texture to drive the sky haze)

------

fileNode.outColor -> mib_lookup_spherical.tex

mib_lookup_spherical.outValue -> multiplyDivide.input1

multiplyDivide.output -> luminance.value

luminance.outValue -> physicalSky.haze

Ensure the operation on the multiplyDivide node is set to multiply and adjust the input2 to influence the strength of the sky map.

HDR Map: multiplied x 2


However, relying solely on the sky’s haze attribute just wasn't enough.

As you can see the clouds are still barely visible yet the orange hue is already out of control, not even adjusting the exposure node's whitepoint helped me here. I started searching for a way to combine the sky texture with the physical sky node before it hits the camera. In steps my old friend, the mib_color_mix. I prepared for Maya to crash when I hit the render button, but instead success!




Essentially, the sky texture is layered on top of the physical sky using the color mix. The color mix is then plugged into the camera instead of the physical sky.

The setup is as follows:

physicalsky.outValue  -> mib_color_mix.color1

mib_lookup_spherical.outValue -> mib_color_mix.color2

mib_color_mix.message -> cameraShape.miEnvironmentShader

Color mix settings:

Num is set to 2 since I’m using only 2 layers.

Mode 0 can be left at blend or mix.

Weight 0 is 1.000 (100%  coverage, this is why blend mode doesn’t matter here)

Mode 1 is set to add (since I want the clouds to accentuate the sky and not be a weird semi-transparent residue that's trying to compete with it)

Weight 1 is set to 2.000(this is just personal preference, see images below)


Texture layer weight 1 ---- Texture layer weight 2



Another thing I noticed is that the sky now contributed to the alpha channel. Well that was because the sky texture had no alpha. If I wanted it to behave like the default non-alpha generating sky then I could just take the texture into Photoshop and add an empty alpha to it. It turned out pretty nicely. And just incase you're wondering, no it's not physically accurate (was it to begin with?) but it's working.  Now, I'm trying to see if I can get a rig going to link up the rotation of the directional light and the image and see if I can find a non headache inducing way of getting some shadows from these clouds. Wish me luck!

Notes:

The physical sky was also plugged into the camera's volume shader slot to get the "visibility distance" attribute to work.

The color mix approach yields very visible clouds on its own, the mapped sky haze in addition to that produces a more diffused and in my opinion, a more blended sky.




Back on the Logitech G700 Train



Oh the joy that's washing over me! My new mouse is here! Last Christmas I received a Logitech G700 wireless mouse as a gift and fell totally in love with it but unfortunately it was defective. Over some months its tracking ability started having problems, from stuttering to just being plain unresponsive. I changed USB ports, cables, batteries, even tried different machines and found out that it tracked on my Wacom tablet surface. Well, at least for a while, then I was forced to use a glossy magazine, at that point trying to use it on a cloth or plastic mouse pad was impossible as it seemed like the laser was dying. I figured I'd have the manufacturer do something about it.

The support was fast and I didn't get any bullshit, like none whatsoever (I know right!). I was still under warranty since it hadn't even been six months and they started the replacement process right away, sweet! :3 In the meantime I went back a non-ergonomic mouse I had sitting around and even though I got accustomed to it pretty quickly, it started causing discomfort so I had to stop. So now that it's May 17th 2013 I figured I'd write up a post as a marker of when I started using this new mouse in hopes of not needing to replace it for years to come.

Backburner Tribulations - Update

 More changes to the performExportToBackburner.mel file! Thanks to Francois Maree for the suggestions :). A couple parameters were added.

Auto Threads – Automatically use available threads

By Frame – Render frames in increments of this value. Render settings must be set to render out a sequence of images


Francois let me know that there was a change in the Maya 2013 mel that caused an error with versions 2012 and 2011 and probably versions earlier than those. It was trying to find a procedure that wasn't included, but all is well now. There are now two different versions in the download.
To be honest, I'm really considering making a custom tab in the render settings for this, I don't know why it's not there in the first place.

Edited on 12/22/2012
There was an error saying the byFrame control could not be found. Now fixed.

Backburner Tribulations



Have you ever contemplated stepping in front of a bus after dealing with Backburner all day? Have you ever left something to render only to come back some hours later and find a lame, cryptic error? Well I have, repeatedly! And I have to say, the “Create Backburner Job” window in Maya leaves a lot to be desired.

Something that many have dealt with is the "timeout" issue, that is, you leave a job running and an hour later the job aborts and restarts because evidently, sixty minutes is the default amount of time set for Backburner to take such action. Yes, it's possible to change the value with the "-timeout" flag in the code generated by the the custom command, but that would quickly become annoying every time you send a job. Wouldn't it be nice if this had a control in the UI? And how about controls for verbosity, and render threads and memory limits, right there on hand? The Backburner window seems kind of tacked on, so I decided to spruce it up! :3

I've modified the performExportToBackburner.mel file and added five parameters to the job window:

Render Thread – Specify the number of CPU threads right there when you send the job and not in another window!!

Verbosity – Level of detail in render progress messages

Auto Memory Limit – Dynamically calculate memory before each render

Memory Limit - Soft cap for memory used by MR

Time Out – Amount of time before job aborts and restarts



If the custom command is used, the flags will be added automatically as well. Even if you choose “from the scene file” instead of “mental ray” from the renderer dropdown, the appropriate flags will be sent because the script runs a check for the current renderer.

If the defaults for the custom parameters need changing, just change the value for the optionVars. Look for this code:



///////////////////////////////////////////////////
////////////////GENNY T 11/30/2012
/////////////////// optionVar for Timeout,Verbosity,
///////////////////////////////////Thread Number, Memory Limit
/////////////////////////////////////////////////////////

if (!`optionVar -exists "bb_Timeout"`)
optionVar -iv "bb_Timeout" 600;

if (!`optionVar -exists "bb_Verbosity"`)
optionVar -iv "bb_Verbosity" 3;

if (!`optionVar -exists "bb_Threads"`)
optionVar -iv "bb_Threads" 4;

if (!`optionVar -exists "bb_autoMemory"`)
optionVar -iv "bb_autoMemory" 1;

if (!`optionVar -exists "bb_memoryLimit"`)
optionVar -iv "bb_memoryLimit" 1024;

////////////////////////////////////////////////////////
////////////////////////////////////////////////////////
////////////////////////////////////////////////////////



TO DOWNLOAD PAGE