# Looping rain on window effect

I want to create a rain on window effect for an animated wallpaper. For this reason it needs to loop.

I am going for something like this:

In the end, it doesn't need to be exactly the same but I would like to have static raindrops and ones running down.

As far as rain on window goes there are some tutorials that use shaders and some that use particles. My question is how I can make either of those loops?

• Your question is pretty general. Could you add some screenshots of references that look like what you are going for? there are unlimited ways to create "rain on a window" and multiple ways to make them loop. Aug 5 '21 at 10:11
• I am going for something like this In the end it doesn't need to be exactly the same but I would like to have static raindrops and ones running down. Aug 5 '21 at 10:17
• My question is less about how to do it and more about how to make it loop. Aug 5 '21 at 11:16

If your animation can stand being mixed over itself without losing realism, you can split it into identical A and B rolls, of loop length.

'B's jump is over the beginning and end of the loop. 'A' is time-shifted by half the loop length, so its jump is in the middle of the loop, and it's continuous over the beginning and end.

Then you cross-fade the rolls in such a way that 100% A covers the jump in B, and vice versa.

This can be done with a node group:

The yellowish nodes are the A roll, the Modulo means every time it reaches 'Period', it starts again from 0. The addition of 'Period/2' means it starts from halfway along.

The Ping-Pong does the cross-fade. It's arranged so the outputs can be connected to a mix, of some kind, between colors, or parameters. or shaders. and the cuts will be covered.

To use this with Amin Missaoui's lovely node-group, you have to tweak his group slightly, and bring the internal #frame driver out to the interface, so you can use the group twice, offset, for A and B:

It doesn't work too badly. But of course, you could use the same principle in any animated procedural shader of your own. You may not be mixing duplicate shaders.. it could just be colors, or UV's, normals, or whatever works.

A 50-frame loop: