Skip to content
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

noise1 output range seems to be [-0.631 0.631] instead of [-1 1] #1

Open
pbaille opened this issue Feb 9, 2016 · 6 comments
Open
Labels

Comments

@pbaille
Copy link

pbaille commented Feb 9, 2016

( (juxt (partial apply min)(partial apply max))
  (take 100000 (map noise1 (iterate (partial + (rand)) (rand 100000)))))
;;=> [-0.6310094734594794 0.631009462592625]

maybe NORM const should be accessible to the user?

@pbaille
Copy link
Author

pbaille commented Feb 9, 2016

is it normal that it output exactly 0 more than 10% of the time?

(count (filter zero? (take 100000 (map noise1 (iterate (partial + (rand)) (rand 100000)))))) 
;;=> 10548

@postspectacular
Copy link
Member

Investigating, thanks for letting me know....

@postspectacular
Copy link
Member

Just for reference this code was ported from this OpenCL version here: https://github.com/terrybroad/Simplex_Noise_OpenCL/blob/master/Simplex_Noise.cl

@postspectacular
Copy link
Member

Just updated (and optimized) these functions, but still not 100% sure where the scaling issue is coming from (actually might be already present in the original version this code is based on). Also have added some images and renamed the namespace to thi.ng.math.noise (since I will add more noise gens, the current one is actually gradient noise, not the simplex noise, which is still waiting to be ported).

I removed the final normalization step from all fns, but noise1 now has a range of -1 .. +1. noise2 and noise3 seem to go from -1 .. +0.89....

https://github.com/thi-ng/math/blob/master/src/noise.org

@pbaille
Copy link
Author

pbaille commented Mar 9, 2016

great! I will take a look as soon as possible

@pbaille pbaille closed this as completed Mar 9, 2016
@postspectacular
Copy link
Member

let's maybe not close this just yet...
also, if you want to play around w/ it, use the [thi.ng/math "0.2.0-SNAPSHOT"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants