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.
Subscribe to:
Posts (Atom)