Screen Distortion Rain

Mother of Telamon… this is amazing!

I’d like to point out how impressed I am by this part specifically and would like to ask how you did this?

2 Likes

First of all, I just updated the post to be more impressive. :stuck_out_tongue_winking_eye:

To answer your question, the functionality loop in the code checks if the settings are high enough before creating the droplet.

--Snippet
 if (GameSettings.SavedQualityLevel.Value >= 8) then
3 Likes

Amazing, thank you!

1 Like

Have you considered using a list of meshparts as alternative?

1 Like

Yes, but then it would look very patterned as they repeat. Also, I would not be able to do the “running” effect.

1 Like

Beautiful! Adds a very neat effect ( from the videos ). Might check this out, don’t really have anything to implement it on. Just going to look at the code, and how it works. :+1:

1 Like

I’ll definitely be using this, really cool idea to make the rain realistic

2 Likes

I like the screen effect a lot, but I’m curious about what method you used to get splashes to appear on the ground.

In my game I have 2 attachments with a beam between them fall straight down to a location that was raycasted to on the ground before the drop started falling. I did this because particles go through the roof and I didn’t want that. When it hits the ground I place a 1x1x1 part and a splash particle is emitted before the part is destroyed.

My issue is this caused some performance problems when it’s raining any harder than a light pour, and I wanna find a way to fix this. So how did you do the rain and splashes?

Those were just particle emitters placed before runtime.

I’m working on a project similar to yours that will accompany this one! I’ll hopefully get mine running fast enough for your usage!

Edit:
Made one, got 60FPS. Then I noticed the 50% usage, and just deleted the entire file in frustration after trying to make a better version for 3 hours.

3 Likes

Would be very interesting to see how this could be adapted for a snow particle effect. Not sure how you would be able to do it as snow appears quite opaque on a camera lens and therefore would stop players from seeing large amounts of the screen.

5 Likes

Would be good for a mountain climbing games when you get to the peak it’s harder to see as more snow is falling. If you want that realistic, just depends really.

2 Likes

I was just thinking the same thing! I am going to try and use this effect for my exploration game.

Boatbomber is back at it again with the open source greatness

2 Likes

That’s what I’m here for! :grin:

1 Like

This is amazing I can’t wait to try this in future games!

1 Like

I swear I was just thinking of an effect like this a couple days ago since I have rain effects, and there you are. Spooky. Very cool effect and use of the engine.

I ran in to an issue in my particular case which has a decent mix of items that utilize both screenpointtoray and mouse.hit.p to extract aim points in the world. Both were having an issue with the droplet parts being right up against the camera, basically thinking I’m aiming at the back of the blocking part.

For the screenpointtoray items, I was easily able to get around that by adding workspace.CurrentCamera to the ray ignore list on my guns. No such luck with the mouse.hit items of course. This effect is cool enough that I’ll be going through and re-writing those items to use screenrays, but FYI.

You’re a gentleman and a scholar.

2 Likes

That’s really interesting, I hadn’t thought about that!

I think TargetFilter can solve this for you. This property is essentially a single-object blacklist for mouse raycasting.
All the Raindrops are stored in a Part inside the CurrentCamera. If you alter the code to give the Part a specific name like “ScreenRainPart”, you can use

Mouse.TargetFilter = workspace.CurrentCamera.ScreenRainPart

to solve this issue. However, you can only have one target filter at a time, so if you use it for something else, this won’t work.

How to change the name of the Part

To alter the code for that, around line 90 we have this:

--Droplet holder
local ScreenBlock = instance("Part")
	ScreenBlock.Size 		= v3(2,2,2)
	ScreenBlock.Transparency	= 1
	ScreenBlock.Anchored		= true
	ScreenBlock.CanCollide		= false
ScreenBlock.Parent		= Camera

Just add ScreenBlock.Name = "ScreenRainPart" before it gets parented. Then you’ll be able to index it easily from other scripts!

2 Likes

Yep. Works like a champ. Haven’t had to use a mouse targetfilter yet so, another tool for the brain toolbox. Much appreciated. Although now I get to remain lazy and not re-code those tools to screen point raycasts :slight_smile:

1 Like

This is super dope, thank you! I most likely won’t be using it anytime soon but i love things that the community creates.

2 Likes

Awesome! Quick question since I don’t have time to peak at the source code

How do you detect if you’re under a roof? Do you simply cast a long ray upwards?

1 Like