eGlint / wurstNoiselib

Noise Library for Wurst.
MIT License
2 stars 2 forks source link

Incorrect usage of real.lerp #2

Closed Frotty closed 3 years ago

Frotty commented 3 years ago

Hi, thanks for this lib. However I encountered weird issue when using it. This is because you are using real.lerp which is not a normal linear interpolation, see Interpolation.wurst real.lerp is a modified lerp adopted from gdx. image

Please add unit tests!

Frotty commented 3 years ago

To be honest even with this fix I can hardly get any good results. Could you improve documentation with examples and perhaps the offset/scale/amplitude mechanics?

eGlint commented 3 years ago

I just updated wurstNoiselib to v1.1.0, solving the lerp issue. I don't know if the documentation I provided is clear enough.

If you couldn't get any good results with Perlin Noise, you can try out using the 2D Open Simplex function I just added.

Frotty commented 3 years ago

Thanks, will check.

Frotty commented 3 years ago

@eGlint I finally figured out why all my results were bad... I did not call generateRandomPermutation. Nowhere does it say to do this...😬 Please add to package header doc and usage example! Is there any reason it is not called automatically in an init block? pshould never be all zeroes I think. Please fix this. Now my generation actually makes sense, thanks again for the lib.

eGlint commented 3 years ago

Well, the reason why I did not put generateRandomPermutation in the init block is because I assume there is a possibility the initialization of the other libraries that uses the noise functions might run first before the initialization of this library. Having the possibility of the permutation table still uninitialized. I expected those who will use this library can fix the issue by manually calling generateRandomPermutation in the init block of their own library.

The lack of documentation and my flawed implementation of this library is causing the issue. In the next update, I'll make sure this inconvenience you experienced won't happen again. Thanks for your feedback!

Frotty commented 3 years ago

You could still have it in init block by default though 😕 If there are issues, you can offer generateRandomPermutation as an option to use imho. Anyway closing the issue.