Creating an Ocean with VRay Water

Creating a full ocean can be a daunting task, especially if you are not well versed in dynamics. Even then, creating the water is only half the problem as rendering also needs to be taken into consideration. Let’s try to keep things in what we can do in Maya; Houdini is out of the question. Maya does have decent ocean presets but unfortunately they do not render well or at all with VRay. Thus we look at VRay Water.

VRay Water is a procedural displacement texture used to simulate a water surface. As it displaces the water surface, your geometry should be a polygon plane.

To enable displacement in VRay, first go to the Shape tab of your polygon plane in the Attribute Editor and under Attributes > VRay enable Subdivision, Subdivision and Displacement Quality, and Displacement Control. For your basic displacement settings, make sure that Render as Subdivision Surface and Keep Continuity are both checked while Subdivide UVs is unchecked. The most important part is to set the Displacement Type to Vector Displacement as that is what the VRayWater node creates. Other types of displacement will not work with the VRayWater node.

After creating the VRayWater node, connect it to the Displacement mat. field of the material that is assigned to your ocean plane.

To create your ocean surface, in the VRayWater node is where you will find your settings. All the attributes can have keys set on them to create moving water in animated sequences.

  • Height Multiplier – scale multiplier for the whole texture
  • Wind Direction – specifies the wind direction / the direction of the waves
  • Wind Magnitude – specifies the strength of the wind creating the waves. Higher values creates larger waves.
  • Wind Direction Multiplier – multiplier for the importance of the wind direction. Smaller values will produce more variation in the direction of the waves
  • Choppy Multiplier – a multiplier for the choppiness of the waves. Higher values will produce sharper look waves.
  • Rate – Speeds up or slows down the movement of the waves (only has effect in animation).
  • Seed – used to set the starting point for the random generator
  • Resolution – amount of detail in the generated map
  • Patch Size – specifies the real world size of one patch of the VRayWater texture whereupon outside is perfectly periodic

The height of the waves can be changed in a few different places if you have noticed. There is the height multiplier in the VRayWater node but also the Displacement Amount in the displacement attributes. It is recommended that you first focus on the height multiplier in the VRayWater and thus all your water surface settings are all together. Only use the Displacement Amount attribute in addition if you feel the necessity to further decrease the wave height past the lowest amount (0.001).

If you find that there are holes in your water surface in the render that is because the displacement is extending past the bounding box. To resolve this issues, in the displacement settings, located Displacement Bounds and change the setting to Explicit. In the Min Value, manually type in a negative number in the Value field to further lower the bounding box to encompass the displacement amount of your water surface.

 If you are creating a large open body of water with the camera at a respectable distance away, with a good VRayMtl that contains specular and reflections that interacts properly with light, this may be as far as you need to go. You do not necessarily need to create a refractive water material as it would become necessary and only increase render time.

However, in the following case, the water is lapping up against a beach and we will need to go a step further. First, to create a refractive water material the Refraction Color is turned up to white, the IOR is set to 1.33, and the Fog Color is set to a very slight blue.

Next up is to create some sea foam. The first area where we want to create the foam is against the edge of the water; where the water and the beach meets. To isolate that specific area, occlusion through the VRayDirt material is used to generate a black and white mask. The occluded color should be white and the unoccluded color needs to be black. Make sure to check Invert Normal so that the beach geometry is able to influence the occlusion back onto the water plane. I have additionally connected a Noise node into the occluded color to break up the edge and not just a smooth border along the edge. In an animated sequence, you will want to bake the occlusion in an image sequence to save render time instead of having Maya recalculate the occlusion every single frame.

The other area where the foam would want to be created is along the crests of waves. Since VRayWater is actually displacing the geometry, the VRayDistance node can be used to create a mask to isolate the tops of waves. Upon creating the VRayDistance node, the geometry upon which the calculations will be done upon needs to be added into the distTex_set through the Set Editor. In the VRayDistance settings, set the Far Color to black and the Near Color to white. The Inside Color and Outside Color can be enabled and set to a dark gray to create fall off between the near and far colors. Adjust the Distance attribute to isolate as must or as little of the crest of the waves that you want. If you are testing the mask on a separate material temporarily, remember to connect your VRayWater displacement to your material so that the VRayDistance node has something to read

For the foam material, a slightly refractive white VRayMtl was used with a Noise node connected to the bump to simulate the effect of looking like little bubbles. However, the shadows were very dark as a result and foam has a very light and translucent look to it; thus, the normal refractive VRayMtl was blended together with a VRayFastSSS.

Connect everything together with a VRayBlend. The water would be the base material while the foam will be the coat material with the two masks that were created connected in the Blend Amount. If a VRayBlend was not used since the beginning, remember to reconnect the VRayWater into the Displacement mat. of your VRayBlend material.