2007-06-27

Nice Water with mia_material (Arch&Design)

I was asked how to do more "realistic" water using the Arch&Design (mia_material) shader, since the available presets we ship is only for a surface, i.e. it does the reflections, but you can't actually see into the water, like thus:



The intent for the preset is for nice quick ocean surfaces and similar. What it really shows you, is that water really doesn't have much color, it simply reflects the physical mental ray sky...

Anyway, what to do about seeing "into" the water?

The simple fix is to simply turn "transparency" up. If we turn it up to 1.0
and set a transparency color of "watery blue" we get the following result:



While this is nice, it isn't very realistic. Note how there is a very sharp transition from air to "underwater" which looks strange.

The reason for this is that we used a transparency color, and as the manual says, intensity changes "at the surface of a solid" isn't really what reality does.

If we change our transparency color back to white, and instead turn on the refraction "Color at Max Distance" (refr_falloff_on) and set the distance (refr_falloff_distance) to the depth of the pool, then enable the "Color at Max Distance" (refr_falloff_color_on) and set that color (refr_falloff_color) to the same "watery blue", we will get this result:



Now, the color at the bottom of the pool (at the designated depth) is pretty much the same, but it fades towards that color, rather than immediately hitting it at the surface.

This is nice, but now we have the opposite problem; the surface is nigh invisible.

So we can dial in a compromise. First of all, crank up your "Diffuse" to 1.0. Why? Because the energy conservation will only give as much "diffuse" as there is NOT transparency.

We used to have a diffuse of 0.1 in the original water preset. Now we have "replaced" this with transparency (since transparency is 1.0). But the water preset really uses the "diffuse" to simulate a bit of scattering in the water (see how the very top image is a bit greenish, and you can actually see the shadow "on" the water). So to get the same "look" you can set the diffuse to 1.0, and the transparency down to about 0.9 ... that leaves (1.0-0.9)*Diffuse amount of diffuse.... = 0.1 -ish.

This gives a wee bit of surface back (there is a bit of transition, that then goes darker by depth, which is both better than the hard transition in image 2, and the non-existent one in image 3), plus we actually see slightly (but just slightly) how the pool edge casts a shadow on the water.



Now, of course, a pool needs caustics.

Make sure your water surface is set to "generate caustics" both in the instance properties, and that the material is set to "use refractive caustics" (do_refractive_caustics=1) and that caustics is on in the render options.

One "trick" to quickly get nice and "sharp" caustics is to lower the number of interpolated photons. Interpolating more yields a more "smeared" caustics look - picking a lesser number of photons is a quick-and-dirty way to "sharp" caustics, but at a fairly low quality. (The non-dirty solution is to send in mo' photons).

I used only 5 (!) photons in the lookup for this render:



Of course, we are just using a bump map for surface detail, if we add an actually ripple to the surface, it looks a wee bit more realistic:



...and finally, the "round corners" shader is an ideal way to give that little "surface tension fillet" that water does around submerged objects:



I hope this is useful for your next pool render. ;)

/Z

27 comments:

Glacierise (a.k.a. Hristo Velev) said...

Great article as usual, MasterZ! Just one question: in the final image, the round corners effect pushes the water line down, instead of upwards. Is there a way to fix this? Thanks!

dome said...

Thanks for the great tip M. Zap!

Pool renders will now look as they should, this is really useful.

roy said...

"The intent for the preset is for nice quick ocean surfaces and similar"

with wich perset did you start before you started tweaking transparency?

is it possible to animate the caustic effect?

Pia Arriagada, Carolina Lopez, Bárbara Mora, Magdalena Muñoz, Tamara Sanhueza, Dafne Vergara said...

Hi! can somabaody explain to me how to do that step by step?? please I have to make a pool but is not so easy
Thanks

wabash said...
This comment has been removed by the author.
boxes4move said...

this looks great, one really dumb question. where is the mia_material?

im using max 8

Jonathan Moore said...

The round corners is a great trick! But my question is how do you get the effect to work where to objects intersect? Wouldnt you have to model a hole/extrusion where the two objects meet in order to get a bevel there? Help or info would be greatly appreciated.

Thanks.

Anonymous said...

Round corners is a bump effect, so it doesn't have to be modelled into the geometry. If it is in the shader it will automatically create the effect where objects intersect. Nice use of this tool :) Thanks Zap

Kata_Ylang said...

Can you share this file for me to research,please! Thank you!

fdman said...

Nice Tutorial -Thank you!

The only problem I'm having is getting the rounded corner effect to work on the water. One of the other posters said it was supposed to work where any of the geometry intersects but no luck here. Thanks again.

giannisM said...

well all that's nice till you get to the point of caustics!
Could you please post the exact caustic preferences for mentalray maya 2008 (include polygon and light, preferences and render globals preferences) Pleeease! Whatever I do I get no caustics!!! ( I have of course turned on caustis in render globals ;) )

Craig said...

@ giannism,

I'm pretty sure that what Zap meant when he said:

"I only used 5(!) photons in the lookup for this render"

was that he turned the caustics accuracy in the render settings down to 5. If you have a high accuracy value, even if its only 100 the renderer tries to smooth the caustics out. If you set your caustics accuracy really low and keep your photon count on your light relatively low as well (anywhere from 1000-10000) then you should get results similar to what zap posted.

It might also help if you turn the photon intensity up really high as well(try 50000). If you turn it up that high and your entire water area brightens(minus shadowed areas), but you still can't see sharp caustics, it means that your caustics are working, they're just too smooth to see and you need to turn your accuracy down.

After you figure all that out you can lower the intensity back down to something more reasonable like 5000-10000.

Hope this helps!

Anonymous said...

This was a good education in several Mental Ray techniques I had never tried. I got the exact result shown (but my surface tension seemed to go down too.) My suggestion to anyone who finds the directions unclear is to look in "Help" and find out the basics on a+d materials, caustics and anything else that doesn't make sense -- I think Master Zap is assuming you already have this basic info. And use the glossary for any terms you don't know. By doing this I learned a lot more from this than "how to do water"!

pablo said...

This is the second time you save my day! THANKS for these great tips!!! (the first time was when I couldn't make my mia_mat looks like gold).
Sometimes it's a little bit difficult to follow up the tips (I'm quite a newbie) but all in all, this is one of the best MR related sites I found.
Thanks again Zap!

roy said...

Must the AO of the walls be turned on? does the water darken the areas where it intersects the walls?

Nobbynob Littlun said...
This comment has been removed by the author.
H.Rosenberg said...

The Round Corners idea is awesome Thank you so much

marco josue said...
This comment has been removed by the author.
Rohan Sharma said...
This comment has been removed by the author.
Rohan Sharma said...

Round corners effect

hypershade>mentalray>textures>mia_roundCorners

"Intersecting objects

An added effect of this node is that if two parts that have the same material with the round corners node plugged intersect, the intersection will also be beveled, giving the illusion that those two objects, are one single mesh. To achieve this with different materials, that have the mia_roundcorners plugged, you will need to check the Allow Different Materials attribute."

Marcos Ribeiro said...
This comment has been removed by the author.
Unknown said...

Hi! great tutorial, it's exactely what I'm looking for but somehow I don't get (by far) the same result..

Can you upload a video or send me the file to study it? I'll be really, really thankful

mail: macarenacampos.m@gmail.com

Thanks!!

thanida said...

Thanks a lot for sharing all useful information with everyone honestly.
แทงบอลออนไลน์

Tidings Now said...

I would like to know about
Best fitness tracker
Best DSLR Camera for Beginners
DSLR Camera
Best DSLR camera under 35000

Unknown said...

Suaritma-cihazlari su arıtma sistemleri

Namat said...
This comment has been removed by the author.
Namat said...

Şarkı Sözleri

Şarkı Sözü