excessive/cpml

Simplex noise constants

ggcrunchy opened this issue · 5 comments

Hi. I just stumbled upon the noise code... I didn't realize anybody was actually using it!

In case it's of any use, I did tune those multipliers a bit at the end of each function, see e.g. https://github.com/ggcrunchy/LittleGreenMen/blob/master/lib/simplex_noise.lua#L143 In 2D this brings it up closer to 1.0, in 3D it corrects occasional overshoots (and gets VERY close to 1). 4D, unfortunately, seems to vastly exceed 1 at times, so it's questionable whether the tamed multiplier is even useful any more. 😦 (Apart from those constants I don't recall making any interesting changes.)

Anyhow, if none of this has caused problems for anyone, feel free to ignore.

The tests I made can be found here: https://github.com/ggcrunchy/Strays/blob/master/Unit%20Tests/SimplexNoise.lua

Thanks! I haven't actually used the 4D function (only need 2D/3D for the map generator), so I wasn't aware of any issues in it. I'll bring those changes over.

Did you write this to begin with (or, if not, know who actually did)? I'm unsure if I attributed it correctly in LICENSE.md.

4D is USUALLY fine, which is why it's so frustrating! I've pondered filtering the output, but I don't know if that could be done while still retaining the useful noise properties.

Yep, it began life on Lua's mailing list (http://lua-users.org/lists/lua-l/2011-02/msg01248.html) and around the same time I submitted it to Stefan Gustavson. That was before I'd started putting stuff on GitHub, and I've not had a good excuse to play with LuaJIT lately, so the code hasn't had much of a home.

I didn't even check the license. 😄 It's definitely based on Dr. Gustavson's code, though.

Whatever you did in your patch, it cut the generation speed significantly. Generating a 32^2 map used to take a couple seconds, now it is nearly instant. 64^2 used to freeze LOVE, now it generates a map in 5-7 seconds.

Quick question: Will this library work well with terrain chunking? It would probably be wise to generate a bunch of 16^2 chunks instead of dealing with the exponential gen time.

@karai17 it'll work perfectly fine. you just have to pass in the same coordinates you'd be using when not chunking (and just adjust the output to be in the range you want)

Magic. I'll close this, then.