# Looping rain drips on windows

## Recommended Posts

Hi there,

I've been following this excellent tutorial on creating streaks of rain across windows: https://www.youtube.com/watch?v=AwsYhKy1K5g

It's working well and i've made a few adjustments to fit with the rest of my scene, but there are a few things I was hoping someone might be kind enough to help me with:

1. The tutorial author uses an expression to offset a resample node to create the animation of the drops falling - how would I adapt this expression so that I can create a seamless loop?

2. More simple: the drops created by this method are fully sphereical, I need them to be flat on the edge that touches the window - how do I use a vdb volume to cut the whole thing so the window facing side is flat?

3. Just trying to get the static drops to be a bit more random in size and guessing at the expression, currently @pscale = (rand(@ptnum)*(0.15)+2.2) -1.20;   - i'm just trying to pick a random float between 0.1 and 1.2

I've attached my scene file, any help is very appreciated.

window4.mp4

raindrops_001.hip

• 1

##### Share on other sites

3. Yes, random ranges are my jam!

You'll want to use the following template for maximum artistic range: (feel free to minimimze as you like)

```float min = .1;
float max = 1.2;
pow = 3;
//exponent applied to range before final fit for more smaller values, high pow
//or more large values with a low pow
@pscale = fit01(pow(rand(@id),pow),min,max);```

2. You want "VDB Combine" and the Operation of "SDF Difference" with the VDB rain and the window box VDB as inputs.

1. That is complex. But you need to use a similar technique as making a texture seamless in Photoshop. Google that. And do that, but in space and 3 dimensions.

##### Share on other sites

Hi Clear,

Thanks so much for this template! I actually just managed to get the thing looping. I just cached out 240frames and did the standard technique for looping smoke simulations with 2 timeshift with one offset by half and a blendshapes node to fade between them, then just fed that vdb into a vdb from polygons. Seems to work pretty well.

Yes I figured something like that, I'd done it before trimming a smoke sim but couldn't remember but will have a go now. Attached a gif of the looping effect.

Thanks again,

H

• 1

##### Share on other sites

Hi there,

Just an update for anyone who comes across this later. Clear's function worked great for randomising the size of the static drops as did the SDF difference for trimming the window facing side of the drops. I just need to make a small adjustment to define pow as a float and change @id to @ptnum to work with 독학NET's setup.

float min = 0.5;
float max = 1.5;
float pow = 1.2;
//exponent applied to range before final fit for more smaller values, high pow
//or more large values with a low pow
@pscale = fit01(pow(rand(@ptnum),pow),min,max);

Thanks again,

H

## Create an account

Register a new account