-
Notifications
You must be signed in to change notification settings - Fork 51
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
Fix particle effect randomness #388
Conversation
Signed-off-by: Ian Chen <ichen@osrfoundation.org>
Signed-off-by: Ian Chen <ichen@osrfoundation.org>
Codecov Report
@@ Coverage Diff @@
## ign-rendering4 #388 +/- ##
===============================================
Coverage 55.91% 55.91%
===============================================
Files 147 147
Lines 13981 13983 +2
===============================================
+ Hits 7817 7819 +2
Misses 6164 6164
Continue to review full report at Codecov.
|
I knew there was something amiss with that line! Your solution is a temporary workaround though. Once time becomes large enough, the fractional part becomes always 0 (and before that, it will always be 0 and 0.5, and before that...). It's easier to mentally visualize it with half floating point format A better solution would be to fix it from C++ side of things. If you're using Ogre's auto param, IIRC there was an option to make it periodic. Update: it's |
Signed-off-by: Ian Chen <ichen@osrfoundation.org>
yeah you're right, once time becomes too large, the randomness goes away. I took the C++ approach and passed a random number to the shaders. 2690ca2 |
Signed-off-by: Ian Chen ichen@osrfoundation.org
🦟 Bug fix
Summary
The randomness algorithm in the particle effect for has issue when
time
(which is used to add randomness) becomes large in the shaders. The fix is to just use the fractional part of thetime
value for adding randomness.To Test
To reproduce the problem, one way to test this is to artificially increase the
time
value in the shaders. You can do this by applying the patch below to this branch to simulate the old behavior when time is large:Then run this example world:
https://gist.github.com/iche033/bcd3b7d3f4874e1e707e392d6dbb0aa0
The patch adds 100000 seconds (27.x hours) to time and you'll see bands across the rgbd camera :
The changes in this PR makes sure the random number never exceeds
1
and the noise pattern should stay distributed across the image:Checklist
codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge