3
$\begingroup$

I am using Simplex Noise to generate a 3D field. The specific implementation is FastNoise-SIMD.

Assume I want to have a gradient (or derivative) for a sample at Sx, Sy, Sz in that field.

Do I actually need to sample the value of the field at all neighbours of sample S?

If so, that makes it a quite expensive operation, as the 4-octave Simplex Noise function I use is already quite expensive, evaluating them for all neighbours would make it too slow for my purposes.

Is there a way to directly compute the derivative of SimplexNoise that is cheaper than getting the deltas from the neighbours?

Some Perlin noise implementations have an analytical derivative. But none of the Simplex Noise implementations that I have found support sampling the gradient along with the field value.

Have analytical derivatives been done on Simplex Noise, or is it maybe not possible for Simplex Noise?

$\endgroup$
2
  • 1
    $\begingroup$ There's no reason you couldn't do analytical derivatives with simplex noise, but maybe no one has sat down and worked it out and published it yet. $\endgroup$ May 15, 2020 at 17:11
  • 1
    $\begingroup$ This shader uses a simplex noise algorithm with derivatives shadertoy.com/view/Ws23RD. Also if you want a FBM function that works with derivatives, scroll down a little bit and you'll find one here: shadertoy.com/view/XttSz2 $\endgroup$ Jan 23, 2021 at 2:58

1 Answer 1

3
$\begingroup$

I have published it, in several versions, and it's not difficult to do it. Simplex noise is a lot easier to differentiate because it's a sum of polynomials, rather than a nested polynomial interpolation as in classic Perlin noise.

GLSL code for 2-D and 3-D simplex noise with derivatives is here:

https://github.com/ashima/webgl-noise/tree/master/src

The 3-D version is in the file "noise3Dgrad.glsl". The 2-D version in "psrdnoise2D.glsl" additionally reimplements Perlin and Neyret's "flow noise" gradient rotations and can be made to tile over integer-sized rectangles. (Well, even-sized integer rectangles. The triangular/heaxagonal simplex grid placed some restrictions on tiling.)

I am currently working on a tiling version of 3-D simplex noise with rotating gradients as well (and analytical derivatives), and I will submit it for a more formal publication shortly, to hopefully make it more visible to implementers.

$\endgroup$
1
  • $\begingroup$ Can you please edit your answer so that it can be understood without the link? If the link expires for some reason, it isn't helpful anymore. $\endgroup$
    – wychmaster
    Jun 8, 2021 at 13:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.