4
$\begingroup$

I'd like to know how to do two things with materials related to the Ocean Modifier:

1) Change the color depending on the depth of the water, and

2) Create some believable foam.

Both of these features should change as the ocean modifier plays back.

The attached image shows what I mean pretty well, methinks—you can see how the water changes to a darker blue where the water is a bit deeper, a lighter blue where it's shallower, and blends to a white where the foam should be. I also believe that this image was made with Blender's ocean modifier [EDIT apparently it's not, but the point still remains]. I'd like this to be possible regardless of lighting conditions.

Does anybody know how to create these effects with materials that use the ocean modifier?

enter image description here

$\endgroup$
  • $\begingroup$ You could go to this tutorial and follow the material setup, adding the desired colors for the "foam" youtube.com/watch?v=6G1W3iRitjA, or you could use a texture $\endgroup$ – cgperfect May 4 '18 at 22:02
  • 1
    $\begingroup$ The image is not from Blender, it is a Houdini simulation by the looks of it. A bit more searching led me to the Houdini Ocean Toolkit for Cinema 4D v0.3. The image is an Ocean Test 01 by Helge Kiehl $\endgroup$ – Jaroslav Jerryno Novotny May 16 '18 at 19:24
  • 1
    $\begingroup$ The part with " how the water changes to a darker blue where the water is a bit deeper, a lighter blue where it's shallower" depends on material and lighting, Ocean modifier has nothing to do with that. Volumetric material and proper lighting should give that effect. $\endgroup$ – Mr Zak May 16 '18 at 19:45
  • $\begingroup$ I meant all this to be done with a material anyway—the article is clarified to make that clearer. $\endgroup$ – Legoman May 17 '18 at 18:56
4
+50
$\begingroup$

Final.

final

I've exaggerated a bit difference between deep and shallow water to present it better.

Node setup and overview.

Water.

Most important thing here is to separate generated texture coordinates on Z axis and assigned to it Color Ramp with our colors of choice representing deep and shallow water. You can add here more colors, not only two of them and/or change interpolation between color stops - I've used default (Linear).

Foam.

First of all you will need to choose Foam Data Layer Name. I used... 'foam' and use it in Attribute node. I've also added a Math node with Power to fine tune mix between water and foam shader.

Mix.

You can now mix shaders by 'foam' factor and use any other shader for materials. I've used simple Glossy for water and Diffuse for foam.

Nodes and Ocean setup.

nodes

| improve this answer | |
$\endgroup$
  • 1
    $\begingroup$ thanks for this, was wondering how to do this the last little while to get nice ocean/waves without having to do a fluid sim $\endgroup$ – Derek Eden Apr 18 at 6:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.