Unfortunately, using a height lerp with a directional light doesn’t seem to work. You need a spotlight for height to work, but spotlights cast shadows on objects according to the center of the spotlight, not from a direction covering the whole world. The spotlight needs to literally be placed where the sun should be in order to get correct shadows. And the light function method would basically hack down your framerate by a third… and there’s no chromatic aberration because light functions don’t use color.
I wish there was a way to calculate shadows in the material editor. Regardless, this thing looks awesome in motion! And it’s only an extra 47-50 instructions for whatever materials are underwater… that’s WAY cheaper than a light function!
I’ll take a look at the Transform to Z function. Thanks for all your help!