Tyler Smith shared some thoughts about his ocean experiments in UE4. His workflow includes a nice combo of World Machine, Zbrush and Geoglyph.
Water in Unreal
Water, particularly ocean water is a subject you could spend your entire career mastering and exploring. There are so many factors that play into the many different stages of what water does when it interacts with itself and other surfaces. So with this it’s more about figuring out what factor in the ocean you want to portray in an environment whether it’s the foam, the transparency and the terrain underneath or the waves etc. Looking at plein air paintings and animated movie background paintings it’s easy to see what the artist wanted to take from all the complex aspects of the ocean and capture to expand on aesthetically. Taking account into this it’s important to apply the same principles when going into game art. Game art is still now mostly about working with limitations, much like it was back in the early days of animation. So the two types of art can look to each other to understand better how to get the most aesthetically pleasing result.
In order to get a basic water flow set up for an ocean/lake/pond etc, there is a simple formula that works as a good foundation in the UE4 material editor. Take a simple normal map noise texture and duplicate it 3 times then create 3 panner nodes to plug into the 3 textures. For the first two panners set the panner direction at a diagonal angle like .1 and -.1 then have the third panner move across at -.3 to achieve a sense of randomness over the two first panning textures. This technique can also be applied to a height map for having moving tessellation on the water plane. Once this is in place you can start adding additional features to bring out the aspects of the water shader you want.
One factor for getting the effect of waves in game art without having to rely on expensive tessellation is to simply sculpt the wave shapes. Simple shapes can be sculpted in ZBrush or World Machine to get humps where the water would surge over the shore and rocks. Then using world position offset features in the material using the same panner technique listed above, you can pan the vertices to grow and flow with the wave mesh for that extra bit of movement in the scene. In order to have this ocean plane be big enough to cover the horizon there are two ways to do it either make the plane big enough with the sculpted detail in the place you need, or create this material on a landscape plane with landscape coordinates in the material, and then simply sculpt the ocean terrain in real time.
Foam Tilling Textures
For the foam tilling textures I discovered an interesting way to get an appealing foam texture without having to pay for or go shoot pics of the ocean. Using the amazing Geoglyph plugin for World Machine allows you to get very interesting random foam and web patterns by taking the river and wave generation nodes for the terrain and applying a geoshape and height frag value isolation from the sculpted terrain, then use a color mask to isolate elements and create foam patterns. Then all that is needed is to make it tile in photoshop and use NDO to create a normal texture so the tick foam sits on top of the water.
For creating the movement of the water there is one step to take in mind before which is where to apply the heavy foam. There are two ways, one being painting a custom mask onto the water terrain, or using a depth fade node to detect where the water mesh interacts with other meshes like shore and rocks. Once this is decided it’s a matter of panning tillable foam textures over each other the same way as before and knowing where to apply great amounts of foam detail and where to leave it mild in order to have good composition. For foam one other factor to add for this panning technique is to have different texture coordinate sizes for the 3 different panning foam textures to get more variety with the foam shapes. One final factor is applying a flow map texture to have the texture space ebb and flow when it’s panning. To do this the coordinates going into the foam texture node need to be modified. Use a lerp node with one being a regular texture coordinate and one being the textures of a generated flow map where the X and Y coordinate values are shaped in a flowy interesting way. Then for the alpha simply use another 3 texture pan technique using a simple grayscale noise texture.