simplex-noise.js icon indicating copy to clipboard operation
simplex-noise.js copied to clipboard

analytical derivatives for noise functions

Open flo-bit opened this issue 10 months ago • 2 comments

Aims to solve #57

Disclaimer: I heavily used AI to help me write this, my maths are not good enough otherwise ^^ I did write lots of tests though to check if stuff actually works and it all seems to work fine.

There is one small thing where I had to adjust the tests compared to the normal version though: in 3D and 4D comparing the analytical derivative to the finite difference derivative only works if we don't cross the boundary of our simplex shape, but I think that makes sense as the derivative is not continuous across the border (someone please correct me if I'm wrong). I adjusted the tests here to check a smaller area (and stay in one simplex shape).

Any feedback welcome, I would like to do some more (visual) testing in the coming days, which is why I opened this as a draft PR for now, so that I could get some feedback on the tests, etc I wrote already while doing that.

flo-bit avatar Feb 14 '25 21:02 flo-bit

Hey Flo,

Thanks a lot for the PR. I don't have time to do a review right now. But I'll try to get to it. It's a pretty cool feature after all. Do you have any additional notes or references on how you arrived at the analytic derivatives? It's been a while since I've worked on this as well and I'll probably struggle to review it without seeing it derived (no pun not intended :P) in smaller steps.

Anyways really cool stuff. :)

jwagner avatar Feb 15 '25 12:02 jwagner

Sorry, missed that comment before, I'll try to write something up over the next days, as well as create a visual demo using that for "fake" erosion with fbm layers

flo-bit avatar Mar 08 '25 13:03 flo-bit