PDA

View Full Version : procedural OCEAN shader for 3ds max


Michael Voeller
20-12-2003, 12:23 AM
In this tutorial youl be making an anamatable procedural ocean shader like this:

http://64.70.238.252/pics/oceantut/final.jpg

First off set up your scene. Make a 20x20 plane thats 20 units by 20 units. Convert your plane to an editable mesh. In the surface properties rollout turn on subdivision displacement and set the presets to medium. Make a light and put it wherever you want the sun to be shining. Make the ambient light in your scene 96, 107, 128 for rgb. Give your scene a good background I'm using this one, you can find a good sample background at http://www.marlinstudios.com/

http://64.70.238.252/pics/oceantut/background.jpg

Make a render, you should have something that looks like this:

http://64.70.238.252/pics/oceantut/01.jpg

Now for the material. Select a material and turn the specular level to 100 and the gloss to 70. Now add a waves material to the displacement chanel. In the coordinates rollout set the Source to "Explicit Map Chanel" and the water parameters as such.

http://64.70.238.252/pics/oceantut/waterpanel.gif

You can use object or world xyz for large scale projects but for better previews the "EMC" setting will do. Apply the material to your plane and render, you should end up with something like this:

http://64.70.238.252/pics/oceantut/02.jpg

Now we need to add some secondary waves. we do this with the smoke material. but first we need to set up an output material and two mix materials. Make the submaps for the water material 2 different mix materials. make one of the submaterials in the first mix material you created an output material. Set the output material settings as such.

http://64.70.238.252/pics/oceantut/outputpanel.gif

make the submaterial of the output material a smoke material. Set the smoke material settings as such.

http://64.70.238.252/pics/oceantut/smokepanel.gif

Again for larger projects it's better to use the object or world xyz. In the second mix material you created instance the output material as on of the submaps. Now, for the Color #1 material of your water material (the first mix material) mix the output material with white with a Mix Amount of 95 (5% output material and 95% white) and for the Color #2 material mix it with black with a Mix Amount of 95 (5% output material and 95% black) Your displacement material should look like this:

http://64.70.238.252/pics/oceantut/displacement.gif

Make a render, You should end up with something like this:

http://64.70.238.252/pics/oceantut/03.jpg

Next up is our water color. Water is a translucent substance and ocean water is somewhat cloudy, so not only does the water surface give off light but it's substance does as well. therefore thinner areas would be brighter then thicker areas. So for your diffuse color set up a new mix material. Set the first color to 0,45,48 rgb and the second color to 0,60,64 rgb. Make your Mix Amount material an instance of the output material you made for the displacement. The settings should look like this:

http://64.70.238.252/pics/oceantut/colorpanel.gif

Do a render, it should look like this:

http://64.70.238.252/pics/oceantut/04.jpg

Almost there. No ocean shader would be complete without some good reflection but too much reflection will kill the look of your ocean. Make a falloff material in your reflection map. Now make a raytrace material in the second material box in the falloff parameters. Set the background to map and instance your background map. Back in the falloff parameters, set the falloff type to perpendicular/parallel and change the mix curve to how it looks in the picture.

http://64.70.238.252/pics/oceantut/reflectpanel.gif

Your material should be bright arround the edges and a dark blue in the center with a little sharp highlight. Now make a render, you should have something like this:

http://64.70.238.252/pics/oceantut/05.jpg

thats about it for an ocean shader. Take a look at the material heirarchy if you need to.

http://64.70.238.252/pics/oceantut/heirarchy.gif

If you want it animated all you have to do is change the phase of the water material and the smoke material. click the autokey button in the bottom right hand corner of the screen and then drag the key slider to frame 100. Then go into your water displacement map and change the phase to .5. Go into the smoke map and change the phase to 1. These settings seem to work per hundren frames. right click on the phase value and click show in track view. Youl notice a curve in the line. Select both keyframes and right click and chose properties. click the curve types and chose the first one for both in and out curves. Do this for the weter material as well.

animated water (http://64.70.238.252/pics/oceantut/water.mov)

If you want to make a really big ocean scene youl need a bigger plane. It's a good idea to create a multiresolution plane so not to take forever to render. To do this make a plane as large as you like and with the LOWEST mesh resolution you want to use. Go into polygon sub object mode and select the half that is closest to your camera. Add a mesh smooth modifier with "Iterations" set to 1 and "apply to whole mesh" unchecked. Do this again getting closer to the camera as many times as you need. You can also go back in an delete polygons you wont see to decrese render time. My scene looks like this:

http://64.70.238.252/pics/oceantut/topdown.gif

A good way to make your ocean seem really big is to put the water material in a gradiant. Use the water material in the first 2 maps and a mix material of your water material and black for the third so your displacement map gets darker the further away the water goes. (dont just use black or you'l get a bright line across the horizon because of your reflection) This shortens the waves further back and leaves you with an almost perfectly flat horizon.

and here is what I rendered:

http://64.70.238.252/pics/oceantut/final2.jpg

I rendered all the different maps seperately and composited them in photoshop to get the best look. the lens flare was also done in photoshop. I hope this tutorial helps you along in you ocean making endevours.

Chris-3DT
20-12-2003, 12:41 PM
Hi Michael,

I assume you have posted this tutorial in response to our Total Textures CD-Offer, as described in the sticky in this forum, is that correct? :)

Let me thank you for writing this tutorial and posting it here!
Your tutorial qualifies for one free CD of your choice, but before you can recieve it, we have two tiny requests, if you please.

Is it possible for you to describe the process of animating the shader (the last sentence) in larger detail, say 5-10 sentences?
And could you render a larger final image of the water, perhaps with a horizon and a sun? It'd be great if you can do so.

Many thanks, Michael.


Everyone, let Michael's step forward encourage you to write something yourself, we are all ears (and eyes of course ;)) for your ideas!

FxMaster
21-12-2003, 12:06 PM
wow, this was hella nice !

btw, do you know any way of making this animation looping seamlessly?

thx !

geoMan
21-12-2003, 01:26 PM
congrats man.......i got late in postinmg my tut on this.....i am doing a big tut, about shaders....in which, i wud include ocean shaders too!

anyway, congrats!

Supervlieg
30-12-2003, 09:26 PM
Hi Michael,

Thanks for the great tut. I was looking for a good water tutorial and this one is very good!

But I stumbled upon problem while doing it. Everything went right upto the creating the secondary waves. The final displacement map looks exactly like the one in your tut, but somehow when I render it only the large waves show.

When I use the instanced output material on the falloff map, the details kinda shows, but the little waves still don't render. Any thoughs on what I might be doing wrong?

Ive attached the final image for you to see.

Drizzt
30-12-2003, 11:53 PM
My displacement map doesn't work. After i apply it to plane nothing is changed in render. Plane is flat. Why???

Michael Voeller
31-12-2003, 07:29 AM
Supervlieg: from here it looks like you need to increase your subdivision detail. In the surface properties of your ocean mesh up the detail to medium or high as the secondary waves are geometry as well.

Drizzt: You probably need to turn on subdivision in the surface properties of your ocean mesh. again turn it to medium or high.

Drizzt
01-01-2004, 03:42 AM
THX i'll try.

Supervlieg
03-01-2004, 05:24 PM
Thanks Michael, That did the trick. I read over that part in the tutorial. My bad.

DivineRadiance
03-02-2007, 09:20 PM
wow, this was hella nice !

btw, do you know any way of making this animation looping seamlessly?

thx !


I'm pretty sure that the Mental Ray Ocean Shader has a loop setting.. But I'll have to double check on that..

gordon13
04-02-2007, 02:19 AM
Man this tutorial is awsome! Excelent work! Works like a dream. Now I know how they make realistic oceans in all those movies with CGI water!

Is there are way to animate the water so that it is affected by a passing ship or something? E.g. Is it possible, to edit the smoke material in photoshop, to change the water's aniumation, like a ship passing through it?

Shawkie
02-03-2007, 08:50 AM
I am stuck on the first part the displacement part..

I am using max 9 and it has no water material that i can choose for the displacement map, Is wave the same?.

Pectabyte
31-03-2007, 01:15 AM
Hey great tutorial but its a bit unclear. I followed it as best I could and got this:

http://i23.photobucket.com/albums/b395/Pectabyte/water.jpg

What did I do wrong? Here is my material list:

http://i23.photobucket.com/albums/b395/Pectabyte/materialist.jpg

BTW im using max 9 if it helps.

vet
17-05-2007, 02:40 AM
Michael,
im getting good results thanks to you TUT. There is one question.
when i place an object in the water it tents to be lower when i render.
I put a sphere in half way, but on the render only 1/4 is stikking out.

oeps just found an other question. Is there an easy tweak to get the same results with mental ray.

f02150
18-05-2007, 07:55 PM
I was trying to get that horizon to work with the gradiant, but i couldn't figure out where to do the gradiant and what not. So I guess that part is unclear for me right now. If anyone knows please let me know.

GG-Xtreme
01-06-2007, 08:49 AM
I followed many ocean tutorials, and this was by far the most advanced, but I am having problems. I followed the tutorial and ended up with this:
http://img171.imageshack.us/img171/9161/horizonrenderbador5.png

I was able to remove the unsightly wave artifacts by modifying the curves of the 2 displacement mix materials, but I could not get anywhere near the detail that it shows in your example. The smoke map does not seem to affect the displacement at all, the main reason for the low detail, and my render seems to lack the illusion of translucency, giving the water the appearance of thick paint. I have my subdivision detail set on high and my material list and curves look exactly like the ones in the tutorial. This was rendered with mental ray on 4-16 sample mitchel. Do you think you could possibly find the fault in my scene? If you would like my max file to look at, you can email me at ggxtreme AT gmail DOT com .

Honki
01-06-2007, 01:59 PM
Hi everybody who posted here.

As you can probably see by reading the first post in this thread, the tutorial was made almost FOUR YEARS AGO.

The methods, although in principle are the same, may have changed.

In fact, I doubt Michael even visits these forums anymore.

Perhaps direct your questions to other (more recent) forum members, or look up tutorials more relative to your software.

DJ5150
04-06-2007, 04:13 PM
Well tried this Tut and having some problems with it too. Its very unclear as to what you are doing. Someone should really rewrite this.

"Now, for the Color #1 material of your water material (the first mix material) mix the output material with white with a Mix Amount of 95 (5% output material and 95% white) and for the Color #2 material mix it with black with a Mix Amount of 95 (5% output material and 95% black) Your displacement material should look like this"

i didnt get at all

Anyways after a bit of playing around I ended up with these. Anyone got any idea on how to improve them.