Issue with shadows and masked materials

I was tempted to post this as a bug but I haven’t done enough testing to safely report it as such.

I’m having issues with a masked material applied to a Static Mesh (set to movable) which has an animated Opacity Mask. The effect I’m trying to achieve is of an object that gradually appears from the bottom going up. Here’s the graph of a test material that I setup to show this issue:

The effect itself was pretty easy to achieve but I’m having a weird issue with the shadows. Here’s a screenshot of the problem:

The shadow isn’t rendering, unless the masked part isn’t visible (if A == 1 or if the camera is zoomed in enough to hide the masked part. I thought this was somehow a UV issue, because feeding a regular gradient texture to B correctly displays shadows but I’m getting inconsistent results in trying to fix this problem.

I’ve tried replacing B with a gradient texture that had BoundingBoxBased_0-1_UVW’s R and B channel as the UV but still no shadow. What am I doing wrong? Why the mesh renders correctly but the shadow doesn’t?

Does smell like a bug. For me the shadow pops up only when the entire mesh is visible and the camera is very very close. Interestingly using a texture or just a UV as the source of the gradient makes it behave as expected.
I think for now the cheapest workaround is a secondary UV set projected from the one side so V can be used as “distance from ground”.