James Hill

Senior Technical/VFX Artist

Masked Ocean Plane

I wanted to try to make our water cheaper on squids from space, typically transparency is very expensive and the material I had originally made was push 700-800 instructions. The easiest way to do this normally would be to make the material opaque, but I feel that there is a major compromise when doing this, you lose any depth you would get with transparency. IE things that poke into the water would have a hard edge with an opaque material.

So I thought about using distance fields to help out. In this image I made the water a masked material and fed the opacity mask with the distance to nearest surface node along with some math to bias it. To get the water to fade when approaching a surface I used Epic's dithered opacity mask which creates a fuzzy look that is smoothed out with Temporal AA. Another benefit of using a masked material is that the lighting can be baked and also get proper screen space reflections without bloating the material instruction count. Most all of the glass in the game also uses a masked material instead of transparency. FD_Water

Here is what the distance fields look like
DF_View
Here is the shader complexity of the original transparent material. Red indicates a high instruction count and is generally something I like to avoid. This would be especially bad because gameplay can exist in this area so any particle fx that would play in this area would slow the game down considerably.
Transparent Water

And here is what the shader complexity looks like after. The fuzzy areas where geometry intersects the ocean plane is where the distances fields are dithering the opacity, revealing geometry that would otherwise be hidden.
DF_Complexity