OpenSimplex2 icon indicating copy to clipboard operation
OpenSimplex2 copied to clipboard

Implementation issues

Open mfiano opened this issue 4 years ago • 5 comments

Hello, and thank you for all your work. I am in the process of porting these various algorithms to Common Lisp. So far I ported 2F 2D, and I'm currently wondering if my 2F 3D implementation is correct. It seems to look too regular compared to your examples, though they do share some similarities. This is difficult to debug, as I'm not seeing any graphical artifacts or anything. I am not sure if what I have looks correct or not after staring at it for so long. Below is a 2D slice of 2F 3D XY/Z, though results look pretty similar to Classic. For completion, I also provided an animated gif, moving through the third axis. My goal is to finish a correct implementation in Common Lisp, so that I can submit a PR to your repository. Thank you for your help.

Edit: My version seems to be very sparse compared to yours, with features packed much more closer together in yours.

GIF Animation

mfiano avatar Feb 11 '21 16:02 mfiano

Cancel that. The issue was a typo of the wrong XOR argument in the lattice point tree, so it was choosing the wrong success branch after the first iteration.

Anyway, once I finish with this port in a day or two, would you want to add a not so common language port to your collection, or should it go in the readme as a link? :)

mfiano avatar Feb 11 '21 23:02 mfiano

I finished impleementing them all, and will be publishing the code soon after some more optimization work, so far the results outperform C# (on my particular hardware), but there is still room for improvement. Here are the results so far:

(10 million iterations) Common Lisp CSharp Diff
OpenSimplex2F 2D 0.376s 0.547s 1.45x
OpenSimplex2F 3D 0.496s 0.806s 1.62x
OpenSimplex2F 4D 0.760s 1.758s 2.31x
OpenSimplex2S 2D 0.476s 0.622s 1.30x
OpenSimplex2S 3D 0.680s 1.085s 1.59x
OpenSimplex2S 4D 1.073s 2.044s 1.90x

Edit: Optimizations improved speed

mfiano avatar Feb 13 '21 14:02 mfiano

Cool to hear! Interested in seeing the final result. I will soon be updating this repo with faster versions of the noise based on what I wrote for FastNoiseLite (https://github.com/Auburn/FastNoiseLite), so I wonder how that will affect the comparison.

KdotJPG avatar Apr 28 '21 10:04 KdotJPG

did not want to open a new topic output values are in [-1, 1] , correct?

george-tsiros avatar May 21 '21 20:05 george-tsiros

Yes

KdotJPG avatar May 21 '21 20:05 KdotJPG