Rain Module + Plugin

Hi everyone!

I’m releasing an open-source module (and plugin) that produces the rain effect that you may have seen in the Egg Hunt 2018’s Hardboiled City world. Since then, I have improved the effect quite significantly in terms of API and you can modify it a lot more, and I’m now ready to share it.

This rain effect is designed to be drag-and-drop. It will work in most games out of the box, and there are a lot of options to toggle either through scripts or through the plugin. It also only makes the rain effects appear outdoors and you will see the rain effect when you are indoors and look outside.

A user-friendly plugin is made available so that non-scripters can easily put the rain effect in their games, showcases, and other experiences and adapt it to their liking!


Get it now:

Download the plugin here:
https://www.roblox.com/library/2166774609/Rain-Plugin

You can enable, disable, preview, and modify the rain effect through the plugin in any of your games!


Examples of the effect/plugin in action: (click if gifs don’t play)

https://gyazo.com/5d28872b140da5a3e1b5f24dd4bf669c


Get the module stand-alone: (for programmers)

Download the module:
Rain.rbxm (14.4 KB)

Or grab it from the toolbox:
https://www.roblox.com/library/2166863728/Rain-Module

Or view the source code of the module/plugin here: (pull requests, comments, bug reports welcome!)

API documentation is available in the module / on the Github page.


Design notes:

I use particle emitters and a lot of moving attachments to pull off this effect in a relatively cheap way. It is not intended to simulate a realistic rain effect because this is pretty much impossible without either raytracing individual raindrops and splashes (too performance intensive) or using a custom shader / post-processing effect / more complicated particle system (all of which are not possible to do on Roblox).

This is pretty much the cheapest alternative you are going to get, and it looks pretty good in my opinion.

Summary of trade-offs:

Pros:

  • Works (out of the box) with any kind of geometry.
  • Full occlusion support (no rain in places that should be blocked from rain, i.e. under roofs, inside buildings).
  • Works with moving objects (splashes even land on characters).
  • Dense rain effect opposed to trail-based approaches or effects that simulate only a few individual rain drops.
  • Fully customizable properties (color, direction, sound volume, textures, sound asset, intensity, …).
  • Performant enough to use in real games and on mobile (see Egg Hunt 2018, runs fine on iPhone 5S and higher).
  • Rendering performance is not an issue since it uses ParticleEmitters which Roblox tones down automatically depending on quality level / graphics load.

Cons:

  • Visibility of effect is dependent on quality level (this is both a pro and a con).
  • Visibility can be impacted if there are a lot of other particles in the scene already, or can suppress other particle emitters in the scene.
  • Not intended to simulate fully realistic dense rain, it’s a stylized effect that may or may not work for your game environment.
  • The rapidly moving attachments and particle emitters can lead to minor performance issues in certain edge cases due to Roblox not optimizing for rapidly re-positioning particle systems.

Show me your creations!

If you find a good use for this effect, please reply with screenshots or gifs/videos below or put them on Twitter and tag me at @buildthomasRBX, I’d love to see what everyone can do with it.

Also, if you improve the source code for the effect / plugin in any way, I really recommend submitting a pull request to my repository or letting me know what you changed, so that everyone can benefit from the changes, just like you have benefited from me releasing this module.

Thanks for reading, and excited to see what people will do with it!

636 Likes

This is very nice of you man. Thank you so much.

30 Likes

Quality content as always, Thomas! A beautiful plugin. :smile:

26 Likes

Once again amazing content, thanks so much Thomas!

23 Likes

Is there any size limitations to the emitting part(s)? I tried to design realistic rain on one of my games, and my game’s map is so large to you could barely see the rain from anywhere, which was obviously a problem.

14 Likes

You can zoom out as far and as fast as you want, you won’t escape this rain effect. The rain is rendered relative to the camera both in indoors and outdoors mode.

It takes like 10 seconds to add it to your game with the plugin, so give it a shot.

24 Likes

Did you make the plugin UI yourself or is there a way we can also do it. If you did it yourself then you really did a good job. (Even though I use light theme and its default dark theme)

11 Likes

Great plugin, I would definitely recommend this.
Keep up the good work!

8 Likes

I used these as a base (by @Tiffnix) and modified them + added extra classes to make it look like dark mode Studio, since by default they don’t look quite the same as the elements in my plugin.

I might submit a pull request to that repo for all of these elements I created/modified once I clean up the code for them a bit, so that everyone can make use of it. Right now the plugin code is still a bit messy so I’m not ready to do that just yet.

(The plugin also uses a special library for the UI called Roact (developed by @LPGhatguy and some other people), which you might remember from being featured in one of the RDC 2018 presentations.)

27 Likes

This is awesome!

9 Likes

Awesome!
Thanks a lot man! :smiley:

6 Likes

This is such a nice peice of work!

Keep it up the excelent quality :ok_hand:

9 Likes

:heart:

7 Likes

Woah, appreciate it dude! Can’t wait to see this in lots of games :slight_smile:

8 Likes

Just tried this, and it will work amazingly for my game. Thanks so much for releasing it. :smiley:

6 Likes

Update: Is there any way to disable and re-enable correctly using scripts? I tried to do so and it isn’t working out for me that well (nothing happens when I disable all). I’ve tried looping through Terrain and disabling all ParticleEmitters but that doesn’t seem to work.

6 Likes

API for scripters is given on the Github page and at the top of the Rain module.

	Rain:Enable(<TweenInfo> tweenInfo)
		Enable the rain effects instantly, or over a given easing function if tweenInfo is given.
		
	Rain:Disable(<TweenInfo> tweenInfo)
		Disable the rain effects instantly, or over a given easing function if tweenInfo is given.

	(...)

The tweenInfo parameter is optional.

Refer to the Github/module for more API documentation.

16 Likes

Is it possible to modify this to make volumetric fog pop up in certain areas, @buildthomas?

It’s a fantastic plugin, by the way!

7 Likes

I don’t think that will work too well because this module is based on drawing the effect closely around your camera, not in certain spots in the distance.

7 Likes

Alright.

It seems to work just fine with fog that covers the entire map, which is what I’ve been looking for. :slight_smile:

Perhaps you should make a plugin for volumetric fog zones? Could be based on the magnitude between your character’s primary part and so it doesn’t interfere with raycasts, a floating attachment? :thinking:

4 Likes