Skip to content

Add rain overlay effect#1989

Merged
manuq merged 5 commits intomainfrom
rain-overlay-fx
Mar 3, 2026
Merged

Add rain overlay effect#1989
manuq merged 5 commits intomainfrom
rain-overlay-fx

Conversation

@manuq
Copy link
Collaborator

@manuq manuq commented Feb 26, 2026

A rain effect that can be used in levels. Like the clouds shadow or fog visual effects, it has a randomize method.

@manuq manuq requested a review from a team as a code owner February 26, 2026 12:45
@manuq
Copy link
Collaborator Author

manuq commented Feb 26, 2026

Extracted as-is from the time & weather exploration #1913

@github-actions
Copy link

github-actions bot commented Feb 26, 2026

Test build no longer available.



func randomize() -> void:
var rain_type := randf()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need to change this, but you could instead represent this as a Curve, domain and codomain both in the range [0, 1]; then you pick a random number between 0 and 1, index the curve with it, and the amount_ratio is the y-axis value; and the curve could be edited visually.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh that is a great idea!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I implemented this at f12befe. I'm actually not entirely convinced it is better!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I implemented this at f12befe. I'm actually not entirely convinced it is better!

Oh cool let me check. I was also resuming work on this branch:

  • Added fade_in() fade_out() methods which may be called (duck-typing) from TimeAndWeather. I verified it works if I make it rain instead of be foggy in the night.
  • Added same Randomize tool button with seed value persisted as the other overlays.

And was about to jump into the curve idea. Good timing! I'll check yours first.

@manuq
Copy link
Collaborator Author

manuq commented Feb 26, 2026

I'll make it draft for now, so I can play with the "visual curve as setting for random values" idea.

@manuq manuq marked this pull request as draft February 26, 2026 14:18
Copy link
Member

@wjt wjt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is great as-is. If you find the Curve approach is worth it (I guess it would make it easier to customise the heaviness curve) then perhaps that could be a follow-up?

manuq added 2 commits March 3, 2026 11:49
A rain effect that can be used in levels. Like the clouds shadow
or fog visual effects, it has a randomize method.
@onready var gpu_particles_2d: GPUParticles2D = %GPUParticles2D


func randomize() -> void:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If one wanted to have a static amount of rain in a level, rather than a random amount, what would one do?

You could imagine refactoring this to have a rain_amount exported property that gets propagated through to the particles, and then the randomize function would set that property rather than directly setting gpu_particles_2d.amount_ratio.

But I'm not sure it's necessary for now.

manuq added 2 commits March 3, 2026 13:10
So it has the same duck-typing as fog and clouds shadow.

And also set it to emit in the scene, for drop-in usage.
Like the other overlay effects.
@manuq manuq force-pushed the rain-overlay-fx branch from e827439 to af1637c Compare March 3, 2026 16:13
@manuq
Copy link
Collaborator Author

manuq commented Mar 3, 2026

I think this is great as-is. If you find the Curve approach is worth it (I guess it would make it easier to customise the heaviness curve) then perhaps that could be a follow-up?

I really like it! Pushing and merging.

Grabacion.de.pantalla.desde.2026-03-03.13-45-30.mp4

@manuq manuq marked this pull request as ready for review March 3, 2026 16:49
@manuq manuq merged commit d271c39 into main Mar 3, 2026
5 checks passed
@manuq manuq deleted the rain-overlay-fx branch March 3, 2026 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants