-
-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2D Effect Snow Fall #147
2D Effect Snow Fall #147
Conversation
Don't call color_blend if not needed.
Fixes snow disappearing due to auto brightness limiter (?) by redrawing stuck snow.
Hi @Brandon502, nice effect, thank you 😃 I'm a bit busy right now - just tested your effect quickly on 64x64 and it looks very good. cheers |
wled00/FX.cpp
Outdated
// Despawn snow | ||
bool overflow = SEGENV.aux0 && SEGMENT.check3; | ||
int despawnChance = SEGMENT.custom1 == 255 ? 256 : map(SEGMENT.custom1, 0, 255, 0, 100); // 255 goes to 256, allows always despawn | ||
int y = rows - 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"y" causes a warning later (line 5423) about shadowing a local variable.
I'd suggest you name this one "lowY"
wled00/FX.cpp
Outdated
if (SEGENV.aux0) --SEGENV.aux0; // Decrease overflow | ||
|
||
// Precompute shuffled indices, helps randomize snow movement | ||
int shuffledIndices[cols]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this variable-sized array is allocated from the heap. You could change the type to uint16_t
to reduce heap pressure a bit.
wled00/FX.h
Outdated
@@ -349,8 +349,9 @@ bool strip_uses_global_leds(void); // WLEDMM implemented in FX_fcn. | |||
// #define FX_MODE_PALETTE_AR 193 // WLED-SR audioreactive palette | |||
#define FX_MODE_FIREWORKS_AR 194 // WLED-SR audioreactive fireworks | |||
#define FX_MODE_GEQLASER 195 // WLED-MM GEQ Laser | |||
#define FX_MODE_2DSNOWFALL 196 // WLED-MM Snowfall |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@troyhacks already claimed 196 for his new effect - next available one is 197
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just some minor comments from my side (see above).
Just see if you want to fix them, then increase the FX number.
Thanks 👍
Thank you for reviewing. Made all the recommended changes. |
Effect that simulates snow/sand falling and melting.
Uses getBitValue and setBitValue from Game of Life to reduce memory usage to 1 bit per led.
Sliders:
Check boxes:
I've optimized this as much as I can, easily hits 60fps on 32x32. Likely can still be improved.
Examples on a 32x32 split into 2 segments using different slider/option configs.
Screen.Recording.2024-07-13.192733.mp4
Screen.Recording.2024-07-13.192931.mp4
Screen.Recording.2024-07-13.194249.mp4
Naming and default values can be changed however you'd like. Started out as snow, but palette colors look really nice. Could likely be modified to have an audio reactive version as well.