# Radius and amplitude of kernel for Simplex noise

I'm wondering if formulas exist for the radius and amplitude of the hypersphere kernel used in Simplex noise, generalized to an arbitrary number of dimensions. Ideally I'd like an answer with two equations in terms of n (number of dimensions) that give me r (radius) and a (amplitude), as well as an explanation of what makes these formulas significant.

Here is a link to a document descrbing the Simplex noise algorithm. It mentions that the radius and amplitude need to be tuned, but it doesn't specify what values to use, like they're just fudge factors.

http://www.csee.umbc.edu/~olano/s2002c36/ch02.pdf

The formula for the radius $r$ is simple. $$r^2 = \frac {1} {2}$$ This holds for all values of $N$. Let me explain.

The simplex noise kernel summation radius $r$ should be the height of the N-simplex. If the kernel summation radius is larger than this, the kernel contribution will extend outside of the simplex. This will cause visual discontinuities because contributions are only added to the containing simplex, and not the surrounding simplices.

The height of the N-simplex as a function of N is as follows. $$r = h = s\sqrt{\frac {N+1} {2N}}$$ $s$ is the length of an edge, or the distance from one vertex to another. To find this value, unskew $[1, 1 \cdots 1]$ and get the distance to $[0, 0 \cdots 0]$. Note that $unskew([0, 0 \cdots 0])$ is $[0, 0 \cdots 0]$. Using the origin like this simplifies the math.

$$s = \sqrt{\frac {N} {N+1}} = \sqrt {N \left({1 + N \frac {\frac {1} {\sqrt {N+1}} - 1} {N}}\right) ^2} = \sqrt {unskew([1, 1 \cdots 1]) \cdot unskew([1, 1 \cdots 1])}$$

We can now use this this to calculate $r$ as a function of $N$.

$$r = h = \sqrt{\frac {1} {2}} = \sqrt{\frac {N} {N+1}} \sqrt{\frac {N+1} {2N}}$$

$N$ and $N+1$ divide out and the useful term, $r^2$, always works out to $\frac {1} {2}$.

The contribution of each vertex is given by the following formula.

$$max(r^2-d^2, 0)^a \cdot (\vec{d} \cdot \vec{g})$$

$d^2$ is the squared distance from the vertex to the input point. $\vec{d}$ is the displacement vector and $\vec{g}$ is the N-dimensional gradient. My understanding is that the amplitude is $a$ in the above formala. It can be whatever you want it to be. It is 4 in Ken Perlin's reference implementation. Different values give different visual noise. Think of it as desired smoothness.

Also note that you may want a normalization factor to clamp output to a range of -1 to +1. Perlin's reference implementation uses 8. Gustavson uses different factors for different values of $N$.

Sharpe claims the following formula can be used to calculate the normalization factor $n$ as a function of $N$.

$$n = \frac {1} {\sqrt{\frac {N} {N+1}} \left( r^2 – \frac {N} {4 (N+1)} \right) ^ a} = \frac {1} {2{\frac s 2} \left( r^2 – \left( {\frac s 2} \right) ^2 \right) ^ a}$$

I am not convinced $2{\frac s 2}$ actually equates to $2(\vec{d} \cdot \vec{g})$. Sharpe is probably right that the minimum and maximum values occur on edge midpoints. I have not been able to independently verify this.

If the ideally contributing gradient $\vec{g}$ is $[1, 1 \cdots 1]$ and an edge midpoint $\vec{d}$ is $unskew([\frac 1 2,\frac 1 2 \cdots \frac 1 2])$, then $2(\vec{d} \cdot \vec{g})$ works out to the following.

$$s = {\frac {N} {\sqrt {N+1}}} = 2N \left({\frac 1 2 + \frac 1 2 N \frac {\frac {1} {\sqrt {N+1}} - 1} {N}}\right) = 2 (unskew([\frac 1 2,\frac 1 2 \cdots \frac 1 2]) \cdot [1, 1 \cdots 1])$$

Assuming Sharpe is right about edge midpoints, the scaling factor $n$ as a function of $N$ is as follows.

$$n = \frac {1} {{\frac {N} {\sqrt {N+1}}} \left( r^2 – \frac {N} {4 (N+1)} \right) ^ a} = \frac {1} {2(\vec{d} \cdot \vec{g}) \left( r^2 – \left( {\frac s 2} \right) ^2 \right) ^ a}$$

Note that this assumes the ideally contributing gradient $\vec{g}$ is $[1, 1 \cdots 1]$ and not something like $[0, 1 \cdots 1]$. A different ideal gradient changes the dot product of $(\vec{d} \cdot \vec{g})$.

References I can't link to:

• Wikipedia - Simplex Noise
• Wikipedia - Simplex
• Simplex noise demystified, Stefan Gustavson
• Thank you for coming back to this old question, digging it up, and giving it a very thorough answer. Every time I've used simplex noise since I've ended up Googling and finding nothing more than my own question from three years ago. Doh! Within the next couple days I will evaluate the method, implement it, try it out, and get this marked as the answer. – Void Star Aug 23 '16 at 15:16
• No problem. I wanted the same answers a few days ago. I have been struggling to find the normalization factor as function of N. I think I found a satisfactory function while writing this post. – Brendan A R Sechter Aug 23 '16 at 15:37
• It has taken me longer than expected to get back to this but I have a free day now so I am looking in to it. One of the desirable characteristics of simplex noise is that it is band limited. Finding n from a is very important, but finding the -3dB radius of the noise function's power in the frequency domain given a is also important. – Void Star Oct 15 '16 at 22:37
• As far as I can tell, this is correct and it works. The frequency domain problem remains unsolved. – Void Star Oct 16 '16 at 18:00