Different Methods for Foam around Objects in Water

Hi there!

Recently I have started learning how to make shaders in Unity, and I have made some research in how to make water shaders. The part that I was the most curious about was how to create a foam outline around objects.

Pretty quickly I stumbled upon tutorials on how to make intersection shaders in Unity. This is cool since it works automatically around any object you place in the water.
W5_FoamLine

I guess this works for big objects, but on small ones I saw some issues. The foam ends basically where the object ends.
Screenshot%20(13)_LI

I got suggested to look at a talk by Rime about their water, also going into the foam. He says in this talk that they manually created meshes for the foam.

I have tried this method and I quite enjoyed it because it leaves more control (I can define where the foam ends myself).
W5_FoamExperiment_5
Issue with this method:
Handplacing and creating meshes for a big game world would be tedious. Maybe it could be done with a script?
However, I dont think this can work with wavey water, as the mesh wouldnt adapt to the waves.

I would love to hear by more experienced VFX people what they think of these methods and if they know different ones. Maybe you have some insight on how this is done in games you worked on or you have a new idea on how to tackle this.

Greetings, Sheila

1 Like