[Open Source] Screen Distortion Rain

I made a version of this when glass first came out, and it got nice responses. Someone recently brought it back up, so I figured now is as good a time as any to remake it!

For games with rainy environments, having droplets on screen can really add immersion to the game.
My original inspiration for this was Hard Reset: Redux. It was a small feature, but it felt so good. For showcase places, it’s even better.


What does it do?

This creates small “water droplets” on the screen, using Glass material balls to give it a distortion effect.


Features:

  • Customization
local Settings	= {
	
--	Rate: How many droplets spawn per second
	Rate	= 8;
	
--	Size: How large the droplets roughly are (in studs)
	Size	= 0.1;
	
--	Tint: What color the droplets are tinted (leave as nil for a default realistic light blue)
	Tint	= Color3.fromRGB(226, 244, 255);
	
--	Fade: How long it takes for a droplet to fade
	Fade	= 1.5;
	
};
  • Droplet Formation

Using a bit of math.random(), it gives natural feeling droplet formations (not just single spheres) and gives some nice variations to the droplets.

  • Droplet "Running"

Droplets are created via a SpecialMesh, allowing them to be streched down, imitating a “running” effect.

  • Coverage Detection

If the camera goes under a roof, or tree, or any sort of cover, the raindrops will stop spawning.

  • Camera Angle Conditions

If the player looks down, thus shielding his/her eyes from the rain, the droplets stop spawning.

  • Render Settings Compatibility

Because Glass doesn’t render properly on low graphic settings, if the player lowers his/her settings below 8, it stops rendering. This way, you don’t have to worry about lower settings failing to run the game properly. They just won’t have the extra bonus immersion. :man_shrugging:

Performance:

Steady 60FPS, ~0.5% CPU Usage, 30.0/s Rate
(Many thanks to @howmanysmaII for optimizations!)

Warning:

It relies on glass, and therefore brings with it all the limitations of Glass.


Files:

Example place:


Script File: (Contributions and forks are welcome!)

Roblox Library:




Enjoying my work? I love to create and share with the community, for free.

I make loads of free and open source scripts and modules for you all to use in your projects!
You can find a lot of them listed for you in my portfolio. Enjoy!

If you’d like to help fund my work, check out my Patreon or PayPal!

347 Likes

Thank you, thank you, THANK YOU! Was about to look for someone who could script this effect for me. You’re a life saver!

11 Likes

Aren’t you the same person who made that one dual rendering resource for gun scopes? You’re quite the magician at work and I have got to thank you for making such a thing public.

Take the like, I’ll take the model.

18 Likes

I been waiting for this thanks for this man you really did a good job know i can use it in games :laughing:

3 Likes

Looks great, I only wish it was possible to make it harder to distinguish the spheres connected in droplets though.

5 Likes

You could edit it so that the droplets are turned into a union. That should fix the effect but might make a bit of lag.

4 Likes

You’re welcome! Enjoy!

4 Likes

Yup, that was me! Thanks!

Enjoy!

2 Likes

I considered that, actually, but decided that live unioning is just not a great feature yet and held off on it.

Wow! This is amazing. You’re seriously incredible, you come here out of nowhere scripting some awesome things, and then you uncopylock them!

If anyone on this forum deserves to become a ”Roblox Champion”, it’s you.

9 Likes

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)

2 Likes

Amazing!!! I’ll definitely be using this some time in the future. Thank you!!

2 Likes

I used your first version over a year ago, really neat effect. Awesome to see how you have improved with your scripting practices in that time.

2 Likes

This is really cool. My only suggestions would be make it less opaque since rain drops aren’t that blue. Also, if you could implement a running method that would be rather neat. One where when the camera is facing up the droplets don’t move, but if the camera is vertical(level) the droplets will run down the screen a bit. I know it’ll be a little more difficult, but it’d really help make this more realistic. Still cool regardless.

4 Likes

I finally got what I needed! Thanks so much man. :hugs:

1 Like

I wanted to do something similar. In my opinion, it looks very good. Good job. I will use it in my future projects.

2 Likes

Exactly. The best way to incorporate unions would be having a bunch of prefabs, since the real time unioning system isn’t adequate for a lot of quick real time operations yet sadly :frowning:

2 Likes

I might consider using this with my upcoming swimming system

2 Likes

I’ve put lots of thought into that already.

When water runs down an object, it doesn’t just move down; it distorts and stretches. This makes it really hard to do without vertex deformation in Roblox.

I will attempt this using SpecialMesh sphere objects later. It won’t look great, but maybe it’ll be alright! One way to find out!

EDIT:

Woahhh this came out far better than anticipated. About to polish and then edit the OP!

EDIT 2:

Post has been updated!

2 Likes

Nothing like some good old raindrops in yer eyes. :wink:

3 Likes