How to Create a Bidirectional Wiper Effect in Unreal Engine Using Only Math in Materials?

Hey everyone,
I’m working on a wiper effect in Unreal Engine for a rain-covered lens or windshield. I already have a rain function that works perfectly inside the material, and now I’m trying to simulate a wiper that clears the rain as it moves across the screen.

The twist is:
I’m doing this entirely using math functions in the material — no texture masks or blueprints.

Here’s the issue I’m facing:

  • On the first pass (e.g., left to right), the wiper clears the rain nicely.
  • But on the return pass (right to left), the rain reappears immediately behind the wiper, as if the wipe never happened.
  • It’s like the material re-renders the rain every frame without remembering that the area was cleared.

What I’m trying to achieve is a bidirectional wipe, just like a real car wiper — where the rain is cleared in both directions and stays cleared until new rain appears.

How I’m doing it now:

  • I’m using math operations (like abs, step, sine, etc.) to define a “wiper zone” that moves over time.
  • I’m blending this zone with the rain output to simulate wiping.
  • But since everything is recomputed each frame, the wipe isn’t persistent.

My question:
What is the best way to implement this purely using materials? I’ve tried everything I know.

Any advice, logical suggestions, or examples would be really helpful!

Thanks in advance!