2007-02-17

Clouds with mental ray sky

I keep getting requests from people saying things like "I saw you at SigGraph showing of the mental ray sky and it had clouds in it. How did you do that?".



To which I twirl my moustache and say, 'tis a deep secret....

....just kidding.

Here's the thing. The mia_physicalsky shader uses a 'haze' value to derive a sky color based on the sun position/angle. So a 'hazier' sky is more white/yellowish and a less 'hazy' sky is deeper blue. Okay fine, weather control, you say, but that's not clouds, is it?

Well... actually... it is... if you modulate the haze value across the sky!

Observe this video that I made... it's basically a collection of all test animations done during the development of the sun&sky. Some are bad, some are worse, some are nice, some has bugs in them, some use very low anti aliasing, and none is a peice of art. However they do demonstrate the cloud feature...

What I did was use this texture map (which is a slightly modified version of one I found from some old CD-ROM with public domain sky textures) as a spherical environment map plugged into the haze parameter of mia_physicalsky. That's basically it!

In Maya or XSI you can do this directly, in Max you need to drag&drop your "mr Physical Sky" from your environment dialog into the material editor, uncheck the "Inherit from Sky" and apply the map there.

What is important - though - is this; This is a normal run-of-the-mill LDRI .jpg image, which means it causes a "variation" in the range 0.0-1.0 ... this is way too little for being visible as "clouds" in the sky (the haze has a range of 0 to 15)

So to see results, you need to multiply the level of the texture. How you do this differs between the applications (in Maya you can use the Gain, in Max you use the Output rollout and turn up the RGB Level, etc etc) but setting it somewhere between 5 and 10 tends to look nifty.

Note that this is not a "physically correct" effect in any way, notably because it doesn't actually scatter light, or block light, or create any shadows, or anything like that. But it does simulate "light" cloud coverage very nicely (like high altitude cirrus clouds), and the cool thing is that the clouds coloring automagically follows the sun angle, making very nice sunsets possible....



/Z

26 comments:

Chris said...

Great info zap!

But I can't get the skydemo to download. It says its a 109mb .mov, but stops at 30mb and won't open. Any thoughts?

Master Zap said...

Dunno.... I tried to download it myself and it worked...

How long did this download take? (I'm wondering if it could be a timeout on the server somehow?)

/Z

Master Zap said...

Mkay, I changed the link to an FTP link. Try again.

/Z

LehaS said...

hei Zap

The Video Link is still dead i suppose :(

Thanx

Master Zap said...

No, works fine from here...!?

/Z

Yukito said...

Thanks for the tip. It totally worked! There were some ugly artifacts that appeared around the geometry though. My scene consisted of a cylinder and a ground plane. The artifacts still appeared even after I upped the samples. They disappeared when I removed your clouds from the haze channel.

Unknown said...

I cant get the video to work either. it finishes downloading and then it says its not a movie file.

Mongo said...

How did you get the sun to appear in the rendering. I cannot figure it out.

Luzck said...

I cant dlw the video what you you..is extremly slow.
There is other way to get it ?

thank you

Unknown said...

I am experiancing flickering problem in my walkthrough rendered in mentalray. How can i solve it? Please help me

Unknown said...

Is there a way to get rid of "yellowish cast" of haze? Tint control doesn't do a job :/

cyfer said...

i'm shocked by the ocean stuff
if you have time , please hint on that a little , i read the manual but no shimmering stuff like you did nor that movement of the water

NanoPunk said...

Thank you Master Zap!

Unknown said...

Strange, place2dtexture -> file# -> mib_lookup_spherical produced great results, but mentalrayTexture -> mib_lookup_spherical or env_sphere (maya) would create artifacts as here http://www.djx.com.au/blog/wp-content/images/envSphereForMR/envSphereMR_FG.jpg and the image seemed to be stretched out and unmovable (in rotate UV)

Unknown said...

oh yeah and even with low gain (1,1,1) -> rgbLuminance the linkages that produced the artifacts would cover the sun as well

Muldible said...

zap or anyone! can you talk about why the sky shader doesn't allow access to control the shadows (render passes) specifically? work arounds? thanks!!!

Wilbert van den Broek said...

Hey Zap great tips yet again! I have got a few questions however. What node are you using (and how) to connect the sky image to the haze.
Env. ball and Sphere (maya) both work for me but result in the strange noise artifacts mentioned above. The mental ray options (like mib_lookup_spherical) doesn't seem to work. How do I connect them? I tried rgb > haze but I could only connect one of them.
Thanx in advance.

Unknown said...

(2)! Thanks for the tip. It totally worked! There were some ugly artifacts that appeared around the geometry though. My scene consisted of a cylinder and a ground plane. The artifacts still appeared even after I upped the samples. They disappeared when I removed your clouds from the haze channel.

Mike said...

YOU'RE THE MAN! I was looking all over the net for this for a loooong time. That's exactly what I was looking for!

Thanks a lot for posting!

Unknown said...

Did anyone ever find a solution to the artefacts when rendering?

XYZ-3D said...
This comment has been removed by the author.
Unknown said...

Thanks Zap!

I ran across this today and gave it a try in Maya...

Very helpful.

As a Maya noob it was not clear at first from reading how to implement this in Maya.

So maybe this is helpful to someone else.

In theAttribute Editor for mia_physicalsky1 node.

I clicked the checkered file-in option on the haze parameter.

Chose file in the Create Render Node window and using the image name file-in option imported your .jpg.

Once there I found I needed to check the Alpha is luminance button in the attribute editor of the file1 (image) in the Color Balance section. Then I was able to get good results using the color gain and alpha offset.

For my scene with your jpg, I found I got the best results by changing the Repeat UV to 3-3 in the attribute editor for the associated place2dTexture1 node.

And the clouds were a little high in my scene so I entered a negative number the horizon height setting.

With these settings I was able to get a nice cloudy sky. Panning around I could see some seaming in spots but I had plenty of view choices to make it work.

ethan said...

i know i'm late to the game, but is there a way to get these wondrous / amazing clouds to reflect in the scene? or should they already be doing that and i'm just doing something wrong?

pb said...

Using this method my clouds are always tinted YELLOW. Is there any way to fix this? I've put my sunlight straight up in the sky... I've tried a color corrector in the material editor. :(

AruN .K.R said...

Change old ftp://ftp.lysator.liu.se/~zap/skydemo.mov Link to
http://www.lysator.liu.se/~zap/ad/skydemo.mov
and download.
But it does not give a tip. 8(

AruN .K.R said...
This comment has been removed by the author.