Fast calculation-based droplet simulation

Pretty much just wanted to show off a fast calculation-based droplet simulation, uses only one raycast per instance, as opposed to rays on update, which I’ve seen being used in simulations like this.

It essentially works like this:
raycast from a random position to get the basepart and hit position → run the hit position through an algorithm to get the vector projection on the basepart → tween to projection vector → recurse until the angle of the raycast deg(acos(Raycast.Normal:Dot(UP))) == 0

6 Likes

now this is satisfying, but the droplet looks too small when it hits something to me. but it loks high performant and would not make my computer make beeping sounds.

1 Like

This droplet simulation looks interesting and great! Awesome job on it! How long did it take to make? Will you use it in anything? It’s unique for Roblox!

1 Like

Thanks for the critique, I’m glad people are asking questions and providing feedback!

Because I was going for a “rain” look, and not necessarily just water droplets in general, I squash the droplets when they hit surfaces, so this effect is intended.

I haven’t done any benchmarks, but I’m pretty sure my module is much more optimized over other droplet simulations I’ve seen.

Because I only raycast once per instance, while other simulations just continuously raycast to get surface normal, position, direction, etc. While I calculate those variables once per instance.

i.e: lets say there’s a sphere we want our droplet to “drip” down, other simulations will raycast from a defined start position, then raycast every frame and tween the droplet to the position derived from each raycast.

While my module will do the following:

  1. Raycast once from a designated start position.
  2. in this specific case it’s a sphere, so I’ll call my ProjectOnSphere(Raycast.Instance, Raycast.Position) which returns a cframe.
  3. tween to that cframe.

No benchmarks to compare simulation speeds, but I’m sure mine is more performant lol

1 Like

Thanks for the comment, glad I piqued your interest.

Right now it’s more for fun! It didn’t take me long to make, aside from creating a function for projecting on cylinders since they’re shape is so unique, and I’m also working on custom shapes. i.e semi circles, stars, torus (donut), etc

Will you use it in anything?

I might create a whole weather system, studying Markov chains for data prediction.

rain, and sunny weather are pretty much complete, adding a wind system, so rain blows in directions, and not just global down, as well as foliage, cloth (god willing), and objects being affected by the wind.

I’ll look into snow, snow buildup, and deformation will be tricky, but I’m up for a challenge. :+1: