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.
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.