-
Notifications
You must be signed in to change notification settings - Fork 25
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
Dealing with flicker artifacts? #6
Comments
I should clarify that I'm actually noticing these values towards the bottom row of the matrix, not the corners, so depending on what "corners" means in the code comment, this might be a red herring, so feel free to close if there's not enough info. |
I watched the simulation for a couple of minutes and did not see any
flicker. "Corner" in that comment refers to simplex corners, i.e. grid points for
the noise function, and it should not cause any visible flaws in the pattern.
Your problem might be due to "a" being an "int" rather than "uint16_t". You
are adding "a" to the coordinate "j", and "a" should also be an unsigned
16-bit integer to make sure nothing weird happens with auto-promotion,
wrapping, truncation or clipping in the addition.
Make "a" an unsigned 16-bit integer and wrap it explicitly at 32768 with "a
= millis() & 0x7FFF", and the problem might go away. If not, let me know
and we'll keep looking!
|
I think that might have been a link to the incorrect simulation, I'm so sorry about that. I've updated the example here, and you can see what I mean: https://wokwi.com/projects/356699012994216961. Keep your eye on the lower left third, and it happens pretty quickly after the simulation starts. |
If it still doesn't appear (this platform seems notorious for not updating correctly, here is the full code:
|
In particular, the difference is I actually am using a |
And, just for completeness’ sake, here are a couple examples in situ. The first occurs in the lower right command key area FullSizeRender.MOVAnd the other near “K” and “L” FullSizeRender.MOVIn both of these cases, it's an incrementing |
Okay, that is clearly a wraparound from negative to positive in the signed
return value from the noise function, which maps to a wrap from 0 to 255,
causing the flicker.
The reason is that you changed my very carefully tested multiplication by
136 at the end of the noise function to 145. That is what causes the
overflow. Change it back to the original value 136, and the flicker should
disappear.
|
This one? I definitely wouldn't change that without knowing what I was doing. I tried not to modify the code at all. |
I can confirm that this change seems to eliminate the issue, however! At least, mostly. I still see a little flicker on the very bottom row in the "hottest" areas, at times, but it's only really noticeable at smaller time deltas, so that seems like a win to me. |
Good to hear! Awesome project, by the way. Exactly the kind of application
I was hoping to see this code being used for. Happy hacking!
|
Arrgh. I forgot to retrofit my testing of armnoise8.c into srnoise8.c, so
they have different scaling. I'll change that right away. So, this was a
bug in my code after all. Thanks for finding it!
|
Resolved. Thanks for the bug report! |
My pleasure. While I have you, the two seem very similar, right down to the header file for srnoise8 saying Aside from the extra dimension, are there any other notable differences in low-power use? Edit: I went ahead and filed a chore issue for the header comment, so you can fix that if you want, and if you are feeling magnanimous, maybe we could get a tiny guidance comment on when to use Thanks again! |
The animation with "alpha" comes cheap, but not quite for free, so if you
don't want the swirling animation, the function without the animation
parameter should be ever so slightly faster.
And thanks for catching my sloppy coding for the header. My only excuse is
that I am used to coding noise in GLSL, a language which does not have a
proper linker or even an #include mechanism, and lacks the concept of
headers. Still, sloppy coding. I will fix that, and clarify the difference
between armnoise8 and srnoise8 like you suggested.
|
Hey, thanks a lot for sharing these libraries! I am attempting to use srnoise8.c to generate a nifty flame effect for a keyboard using an RGB led matrix (simulation here).
I've cobbled it together from some various ideas in other projects I've found, and for the most part it looks pretty great, however I'm noticing are some flickering artifacts caused by (I'm assuming) the potential overflow mentioned here.
Is that a reasonable assumption, or is it likely something else? If it is likely the overflow, is there a decent way to mitigate this somewhat?
The text was updated successfully, but these errors were encountered: